- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am using Compaq visual Fortran 6.6a & Visual C++ 6.0. I have a subroutine display.f that calls a subroutine WRITETIFF.C I have include WRITETIFF.C in my project and it compiles seemlessly however when I link them I get the following LNK error (note the WRITETIFF.OBJ file shows up in the correct directory
Done Searching Libraries
End Pass1
DISPLAY.obj : error LNK2001: unresolved external symbol _WRITETIFF@32
Debug/adved_ns_slice.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe
End Pass1
DISPLAY.obj : error LNK2001: unresolved external symbol _WRITETIFF@32
Debug/adved_ns_slice.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe
Do I need to do something special to get display to recognize WRITETIFF.C. I did a /verbose and it is finding all the correct libraries and everything else that it needs. Listedin attachmentis the begining of display.f and the call to WRITETIFF.C and then WRITETIFF.C
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
subroutine display use opengl_gl use opengl_glut interface integer function WriteTiff(filename, description, & xx, yy, wwidth, hheight) !DEC$ATTRIBUTES STDCALL, DECORATE, ALIAS: "WriteTiff":: WriteTiff !DEC$ATTRIBUTES REFERENCE: WriteTiff !DEC$ATTRIBUTES REFERENCE: filename !DEC$ATTRIBUTES REFERENCE: description character(*):: filename, description integer:: xx, yy, wwidth, hheight end function end interfaceOn C side:
int __stdcall WriteTiff(char* filename etc.
ALIAS name in Fortran must match the case of C name. REFERENCE attributes for filename and description say that string length should not be passed. REFERENCE attribute for WriteTiff says that all arguments are by reference. __stdcall is not mandatory, but if you omit it in C, you should spell "C" instead of "STDCALL" in Fortran.
Jugoslav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you. I made the changes you suggested and it links without errors but in the compile it gives the following syntex errors (in fact when I inserted your piece of code the !DEC lines are in green indicating that they are comment lines. Is this supposed to be?
Camille
C:Exchangeadveds4_15_04graphicsFortranadved_ns-sliceDISPLAY.f
C:Exchangeadveds4_15_04graphicsFortranadved_ns-sliceDISPLAY.f(9) : Info: Syntax error, found IDENTIFIER 'WRITETIFF' when expecting one of:
!DEC$ATTRIBUTES REFERENCE: WriteTiff
--------------------------------------^
C:Exchangeadveds4_15_04graphicsFortranadved_ns-sliceDISPLAY.f(10) : Info: Syntax error, found IDENTIFIER 'FILENAME' when expecting one of:
!DEC$ATTRIBUTES REFERENCE: filename
--------------------------------------^
C:Exchangeadveds4_15_04graphicsFortranadved_ns-sliceDISPLAY.f(11) : Info: Syntax error, found IDENTIFIER 'DESCRIPTION' when expecting one of:
!DEC$ATTRIBUTES REFERENCE: description
!DEC$ATTRIBUTES REFERENCE: WriteTiff
--------------------------------------^
C:Exchangeadveds4_15_04graphicsFortranadved_ns-sliceDISPLAY.f(10) : Info: Syntax error, found IDENTIFIER 'FILENAME' when expecting one of:
!DEC$ATTRIBUTES REFERENCE: filename
--------------------------------------^
C:Exchangeadveds4_15_04graphicsFortranadved_ns-sliceDISPLAY.f(11) : Info: Syntax error, found IDENTIFIER 'DESCRIPTION' when expecting one of:
!DEC$ATTRIBUTES REFERENCE: description
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I mistyped -- should be double-colon (::) instead of single.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page