errors linking C++ projects with fortran projects in VS2010

errors linking C++ projects with fortran projects in VS2010


We've just converted our C++ and fortran projects from VS2008 to VS2010, with the new intel compiler (v12).
However, we're getting some weird errors when linking a C++ DLL with a fortran DLL:

1>ipo: error #11018: Cannot open D:\\codebase\\projects\\Common\\../bin/DebugCommon.lib
1>LINK : fatal error LNK1181: cannot open input file 'D:\\codebase\\projects\\Common\\../bin/DebugCommon.lib'

Our directory structure is something like;

\\common - C++ project code folder
\\fortran_proj1 - fortran project code folder
\\bin\\debug - debug DLL/EXEoutput folder
\\bin\\release - release DLL/EXE output folder

This error only happens when using the solutions' project dependencies. When using only the linker input (additional dependancies) with the C++ .lib file, it works fine. We need to use the project dependencies to get the build order right (we have 56 projects, including 10 fortran DLLs).

Any ideas?


10 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

I see forward slashes in the paths - did you put those there?

Retired 12/31/2016

the fortran project had '../bin/debug' in the "output directory" in the project configuration. Ive changed it to "..\bin\debug" and it still gives me the same errors.

actually, changing the output directory to "..\bin\debug" seems to have fixed it...?

Scratch that. It seems to be getting the path to the C++ lib file incorrectly alot.

Sometimes I'm getting:
1>ipo: error #11018: Cannot open C:\Windows\system32\..\bin\Debug\Common.lib

other times it looks for it in a different subfolder of another project being compiled, ie.
1>ipo: error #11018: Cannot open D:\codebase\projects\subfolder\cproj_2\..\bin\Debug\Common.lib

this is looking like an internal compiler problem..?

Can you attach a zip containing the .vfproj files for the projects and the buildlog.htm that fails?

Retired 12/31/2016

Attached is a small example C++ DLL and fortran app that reproduces the issue.

It seems to be related to the /IMPLIB linker option in the C++ projects. When /IMPLIB:$(outdir)\common.lib is specified, the fortran project cant find the library. When you remove the /IMPLIB option, it finds it okay.

For now I've removed all /IMPLIB options from our projects, and instead use the $(targetpath) and $(targetname) options to ensure our libs/dlls use the correct names.

Is this a bug or am I using the option incorrectly?


Downloadapplication/zip TestLink.zip12.07 KB

,Hi Steve

Has anything has happened with this issue? I'm still experiencing this problem in VS 2012 with the latest fortran compiler and on some projects removing the IMPLIB doesnt seem to fix it. Is this a bug in the compiler? Do you have any suggestions how to resolve it?


Sorry, I missed updating this. Right now the ZIP you attached is not working (I think this is our problem not yours). I do know of an issue with VS2012 and dependent C++ projects where the Fortran VS integration tries to link in a nonexistent library. This will be fixed in Update 2 and a workaround is to set the property Linker > General > Link Library Dependencies to No. I am not sure if this is your issue.

Retired 12/31/2016

Thats the flag I missed, thank you. Most of our projects have all dependancies defined in the Linker->Input->Additional Dependancies anyway so this workaround works well for us.

Thanks for the quick response!

Leave a Comment

Please sign in to add a comment. Not a member? Join today