- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am working on the mixed language programming in VS2008 with c++ and fortran. C++ is the executalbe program. After compile fortran from in Visual Fortran 11.1 and get .lib and .dll into C++ working dir, I got the question on Matching rules for .lib when I add the .lib into the working project. The project works fine with CVF.
Where are can i find the rules for intel VF 11.1? What should I do with it?
1>outputc.obj : error LNK2019: unresolved external symbol _OUTPUT@4 referenced in function _main
1>...\\outputc\\Debug\\outputc.exe : fatal error LNK1120: 1 unresolved externals
1>Project : warning PRJ0018 : The following environment variables were not found:
1>$(IFortInstallDir)
1
1>outputc - 2 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Where are can i find the rules for intel VF 11.1? What should I do with it?
1>outputc.obj : error LNK2019: unresolved external symbol _OUTPUT@4 referenced in function _main
1>...\\outputc\\Debug\\outputc.exe : fatal error LNK1120: 1 unresolved externals
1>Project : warning PRJ0018 : The following environment variables were not found:
1>$(IFortInstallDir)
1
1>outputc - 2 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Link Copied
8 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Would you please attach a ZIP of the solution to a reply here? I don't need the sources, but do want the .sln and .vcproj/.vfproj files. If you don't mind including the sources, then please do so. Do a Build > Clean before zipping.
I don't understand the issues you're seeing - normally you do not have to do anything with custom build rules. Just checking - you do have two separate projects, one for the C++ and one for the Fortran, right?
I don't understand the issues you're seeing - normally you do not have to do anything with custom build rules. Just checking - you do have two separate projects, one for the C++ and one for the Fortran, right?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, Steve, I wrapped two projects in one folder. It is a very simple test. Please check. Thank you very much for your help with this issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You need to click "Add as attachment", otherwise it can't be seen.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you, it is on this time .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ok, much better.
First, the "outputc" project had dll1.dll as a source file - that is never going to work. I expected dll1.lib to work, but as you say, Visual C++ complains that it doesn't know what to do with that. Very strange, as a Fortran project does. No matter.
The way I recommend fixing this is to add the dll1 project to the outputc solution, then right click on the outputc project, select Project Dependencies, and check the box to make dll1 a dependent of outputc. You will also want to set outputc as the "Startup project". Making dll1 a dependent will cause VS to automatically find and link in the export library from dll1. You are still responsible for getting dll1.dll in the right place - a post-build step in dll1 can do that. (But do you really need a DLL for this? Wouldn't a static library do as well?)
If you insist on keeping the solutions separate, then add the path to dll1.lib to the outputc property Linker > Input > Additional Dependencies
Second problem - remove __stdcall from the C source - that is not correct for Intel Fortran (unless you have /iface:cvf enabled.)
First, the "outputc" project had dll1.dll as a source file - that is never going to work. I expected dll1.lib to work, but as you say, Visual C++ complains that it doesn't know what to do with that. Very strange, as a Fortran project does. No matter.
The way I recommend fixing this is to add the dll1 project to the outputc solution, then right click on the outputc project, select Project Dependencies, and check the box to make dll1 a dependent of outputc. You will also want to set outputc as the "Startup project". Making dll1 a dependent will cause VS to automatically find and link in the export library from dll1. You are still responsible for getting dll1.dll in the right place - a post-build step in dll1 can do that. (But do you really need a DLL for this? Wouldn't a static library do as well?)
If you insist on keeping the solutions separate, then add the path to dll1.lib to the outputc property Linker > Input > Additional Dependencies
Second problem - remove __stdcall from the C source - that is not correct for Intel Fortran (unless you have /iface:cvf enabled.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, Steve,
Thank you so much. With _stdcall removed, dll link works fine now. What 's the reason for c++ needing _stdcall from CVF but not from Intel Fortran.
I would like to make the static link work. However, that still did not work with the removal of _stdcall. I attached the projects as well.
Thank you so much. With _stdcall removed, dll link works fine now. What 's the reason for c++ needing _stdcall from CVF but not from Intel Fortran.
I would like to make the static link work. However, that still did not work with the removal of _stdcall. I attached the projects as well.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Intel Fortran has a different default calling convention than CVF, matching that of Microsoft C++ and most other Fortran compilers on the Windows platform. For more information, see Migrating from Compaq Visual Fortran.
To fix the other problems you have:
To fix the other problems you have:
- In the Fortran project, set the property Libraries > Runtime Library to "Debug Multithreaded DLL", matching that of the C++ project.
- In the C++ project, Linker properties, remove Lib1.lib under Additional Dependencies. (You can also delete the Lib1.lib file you placed in the C++ project folder.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, Steve,
Thank you so much for your knowledge and help!
Thank you so much for your knowledge and help!

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