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

error 11018 linking C++ projects with fortran projects in VS2010

mallyna_ihabi
Beginner
1,410 Views

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 to a fortran DLL (i.e., fortran DLL depends on C++ 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'

This error only happens when using the solutions' project dependencies. When using only the linker input (additional dependencies) explicitly specifying C++ .lib file, it works fine. We need to use the project dependencies to get the build order right and support parallel builds.

It can't find the c++ lib correctly when I use the project dependencies approach. I saw that someone else was having the same problem http://software.intel.com/en-us/forums/showthread.php?t=78761&p=1&wapkw=(ipo+error+11018)

but i can't use his approach because we have other Visual Studio Solutions (i.e., sln) that reference the fortran project but not the c++ project.

is there another way to do this?

Thanks,

Mallyna

0 Kudos
14 Replies
Steven_L_Intel1
Employee
1,410 Views
There is a section in the Fortran release notes that describes this - see especially the last paragraph.

3.6.2 Adjusting Project Dependencies
If you are converting a project from an earlier version of Visual Studio and had established
Project Dependencies, these are converted to References by Visual Studio 2010. A Fortran
project that is referenced by a C/C++ project will prevent the C/C++ project from building, with
an MSB4075 error. To solve this:

1. Right click on the C/C++ project and select References.
2. If any Fortran project is shown as a reference, click Remove Reference. Repeat this for
all Fortran projects shown as a reference. Click OK.
3. Repeat the above steps for any other C/C++ project

Now you have to reestablish project dependencies.
1. Right click on the C/C++ project and select Project Dependencies.
2. Check the box for each project that is a dependent of this project.
3. Click OK.
4. Repeat the above steps for any other C/C++ project that has dependencies.

Unlike earlier versions of Visual Studio, Visual Studio 2010 does not automatically link in the
output library of dependent projects, so you will need to add those libraries explicitly to the
parent project under Linker > Additional Dependencies. You can use the Visual Studio macros
$(ConfigurationName) and $(PlatformName) as required to qualify the path. For example:
..\FLIB\$(ConfigurationName)\FLIB.lib
Where $(ConfigurationName) will expand to Release or Debug,
0 Kudos
mallyna_ihabi
Beginner
1,410 Views

I got the link 11018 error when trying to build the fortran project not the c++ project. the solution above is not the solution for my problem. the fortran project is depending on c++ lib and not the other way around. I alreadyhad those c++ libraries explicitly in the fortran project under Linker > Input > Additional Dependencies. but still trying to find the c++ lib in completely different path. If I took out the dependency out from solution project dependency (with the c++ libraries explicitly in the fortran project under Linker > Input > Additional Dependencies), it will not get the error. But we need to work with solution project dependency because we do a parallel build (have solution with more than 100 projects) to improve build time.

0 Kudos
Steven_L_Intel1
Employee
1,410 Views
Ok, I didn't realize that. Have you checked the Linker > General > Link Library Dependencies property?
0 Kudos
mallyna_ihabi
Beginner
1,410 Views
yes. the option is set to yes.
0 Kudos
Steven_L_Intel1
Employee
1,410 Views
I just tried the supplied Fortran-Calls-C sample (under MixedLanguage) in VS2010 and it worked with a project dependency. Unzip MixedLanguage.zip into a convenient folder (not under Program Files) and open the .sln file with VS2010. Does this build for you?
0 Kudos
mallyna_ihabi
Beginner
1,410 Views
that build for me because clib was build to default location. if you change the output location for clib.lib, it will not build. i'm attaching the zip with my changes. if you open the solution and do rebuild solution, you will get the link error.
0 Kudos
Steven_L_Intel1
Employee
1,410 Views
Ah, yes, but you also get this error:

1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppBuild.targets(1151,5): warning MSB8012: TargetPath(C:\Users\sblionel\Desktop\Fortran_Calls_C\Clib\Release\Clib.lib) does not match the Library's OutputFile property value (C:\Users\sblionel\Desktop\Fortran_Calls_C\Clib\Release\Test\Clib.lib). This may cause your project to build incorrectly. To correct this, please make sure that $(OutDir), $(TargetName) and $(TargetExt) property values match the value specified in %(Lib.OutputFile).

When I fix this - and remove the explicit reference to a library in C:\TEMP you added, it works. The fix is to set the C project property "Output Directory" to \Release\Test and to change the Librarian output file to "inherit from project defaults".
0 Kudos
mallyna_ihabi
Beginner
1,410 Views

I think I didn't give you the exact problem before. The attached solution is the exact problem. The intermediate and output path is different.

thanks for your help and patient with me.

0 Kudos
Steven_L_Intel1
Employee
1,410 Views
In Fmain, you have the Linker > Input > Additional Dependencies property set to C:\temp\MixedLanguage\Fortran_Calls_C\Clib\Release\Test1\clib.lib. You don't want that. Also, you left off the __declspec(dllexport) on the C routine, so no export library was generated. I recognize that the latter is probably not representative of your real code.

However, after fixing these there does seem to be a problem here and I will investigate.
0 Kudos
Steven_L_Intel1
Employee
1,410 Views
We have an existing problem report DPD200163240 on this - I added yours to it. It has not yet been fixed. For now you will have to add the export library manually - sorry.
0 Kudos
mallyna_ihabi
Beginner
1,410 Views
is this problem has been fix yet?
0 Kudos
Anonymous66
Valued Contributor I
1,410 Views
No, it has not. We will update this thread if and when a fix has been found. Annalee
0 Kudos
Mike_W_3
Beginner
1,410 Views

We've just converted our C++ and fortran projects from VS2005, Intel 10.1 to VS2010, with the new intel compiler (v12) and am having the same problem.

I assume the problem has not been fixed.  Is there a due date for it?

0 Kudos
Steven_L_Intel1
Employee
1,410 Views

There is not a due date. Some of the problem is on Microsoft's side as they stopped providing dependent project information to other language integrations. It is still open on our end, but we need Microsoft's cooperation to fix it and they don't seem inclined to want to do that. You'll need to manually add the library dependency.

0 Kudos
Reply