- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Here are the steps:
1. Created new solution with some Fortran code
2. Added new project to existing solution. It's a win32 static library.
3. Made Fortran project dependent on win32 static library as it's suggested in Intel Fortran compiler. It is now automaticly linked to Fortran program.
Now I have this error:
Link: executing 'link'
proba.obj : error LNK2019: unresolved external symbol _CADDIJ referenced in function _MAIN__
Debug/Fortran_Console2.exe : fatal error LNK1120: 1 unresolved externals
Now I guess the problem is that fortran program can't find external c function by it's name.
Please help!
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is the C function named CADDIJ with that exact case? It needs to be unless you want to add directives to the Fortran code to change the name. Please read the chapter on mixed-language programming in the "Building Applications" book of the Intel Fortran on-disk documentation.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You have two problems. One is that you spelled the routine "caddij" in the C routine but Fortran upcases names by default. The other is that you added __stdcall, which is not compatible with Intel Fortran defaults. Try this:
voidCADDIJ (int *i, int *j, int *k)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I did that, and now I get these errors:
Warning1 warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/INCREMENTAL:NO' specificationFortran_Console2
Error2 error LNK2005: "private: __thiscall type_info::type_info(class type_info const &)" (??0type_info@@AAE@ABV0@@Z) already defined in LIBCMTD.lib(typinfo.obj)Fortran_Console2
Error3 error LNK2005: "private: class type_info & __thiscall type_info::operator=(class type_info const &)" (??4type_info@@AAEAAV0@ABV0@@Z) already defined in LIBCMTD.lib(typinfo.obj)Fortran_Console2
Warning4 warning LNK4098: defaultlib 'MSVCRTD' conflicts with use of other libs; use /NODEFAULTLIB:libraryFortran_Console2
Error5 fatal error LNK1169: one or more multiply defined symbols foundFortran_Console2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks, that did the trick finaly but only for debug version.
For Release version it just keep linking the files until all my virtual ram is consumed.
I hope that this thread will help anyone starting with Fortran and Visual Studio.

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