Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

errors linking C++ projects with fortran projects in VS2010

nick6
Beginner
440 Views
Hi,

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?


Cheers,
Nick.
0 Kudos
9 Replies
Steven_L_Intel1
Employee
440 Views
I see forward slashes in the paths - did you put those there?
0 Kudos
nick6
Beginner
440 Views
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.
0 Kudos
nick6
Beginner
440 Views
actually, changing the output directory to "..\bin\debug" seems to have fixed it...?
0 Kudos
nick6
Beginner
440 Views
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..?
0 Kudos
Steven_L_Intel1
Employee
440 Views
Can you attach a zip containing the .vfproj files for the projects and the buildlog.htm that fails?
0 Kudos
nick6
Beginner
440 Views
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?
0 Kudos
nick6
Beginner
440 Views

,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?

Cheers.

0 Kudos
Steven_L_Intel1
Employee
440 Views

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.

0 Kudos
nick6
Beginner
440 Views

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!

0 Kudos
Reply