Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Gordon_F_
Beginner
147 Views

Project dependencies in Visual Studio

Hello,

I'm using Visual Studio 2013, where I created 4 projects - all built with the Intel C++ compiler. 3 of them are static libraries and one contains my main program. The projects use MPI and I've learned that I need to explicitly add the MPI library to the list of libraries in the project.

To the project that contains main I added a project dependency on the other 3. However, when I link it, it does not know about these dependencies. I've been able to get around this by adding the explicit .lib files to the main project; but every time I move from a Debug to a Release configuration I need to remove these files and add the other ones.

On top of that, I would like to be able to debug the program - even setting breakpoints in the dependent libraries.

I've used project dependencies when using the Microsoft compiler/linker with no problem; Visual Studio seamlessly uses all libraries in my list of project dependencies to link.

Do I need to do anything else when using the Intel compiler and linker so that it will detect and use the dependency on the other projects?

Thanks.

0 Kudos
7 Replies
JenniferJ
Moderator
147 Views

how did you use Intel C++ Compiler with your projects? did you set the compiler to "Use Intel C++" from the "Project" menu or Context menu?

another question is: which version of Intel C++ compiler are you using?

Jennifer

Gordon_F_
Beginner
147 Views

Jennifer,

First of all, thanks for the quick reply. It's much appreciated.

I set "Use Intel C++" from the "Project" menu. I'm not even sure I understand what you mean by the "Context menu". Do you mean I should right-click on the solution itself and choose the Intel C++ compiler there rather than on individual projects?

I reinstalled everything yesterday, version 2016 update 3. My installation shows directories compilers_and_libraries_2016.3.207.

Thanks again.

 

 

Gordon_F_
Beginner
147 Views

Jennifer,

I right-clicked on the solution and chose Intel compiler for all projects. If that's what I had to do, it still didn't work. If I remove the .lib files I added to my main project the linker fails. And it fails with unresolved external symbols - meaning it didn't even know it had to add those dependent libraries to the build.

JenniferJ
Moderator
147 Views

I tried VS2013 U4, it has the same issue too.

1>------ Rebuild All started: Project: lib1, Configuration: Debug Win32 ------
2>------ Rebuild All started: Project: lib2, Configuration: Debug Win32 ------
2>  Microsoft (R) C/C++ Optimizing Compiler Version 18.00.40629 for x86
1>  Microsoft (R) C/C++ Optimizing Compiler Version 18.00.40629 for x86
1>  Copyright (C) Microsoft Corporation.  All rights reserved.
2>  Copyright (C) Microsoft Corporation.  All rights reserved.
2> 
1> 
2>  cl /c /ZI /W3 /WX- /sdl /Od /Oy- /D WIN32 /D _DEBUG /D _LIB /D _UNICODE /D UNICODE /Gm /EHsc /RTC1 /MDd /GS /Zc:wchar_t /Zc:forScope /Yc"stdafx.h" /Fp"Debug\lib2.pch" /Fo"Debug\\" /Fd"Debug\vc120.pdb" /Gd /TP /analyze- /errorReport:prompt stdafx.cpp
1>  cl /c /ZI /W3 /WX- /sdl /Od /Oy- /D WIN32 /D _DEBUG /D _LIB /D _UNICODE /D UNICODE /Gm /EHsc /RTC1 /MDd /GS /Zc:wchar_t /Zc:forScope /Yc"stdafx.h" /Fp"Debug\lib1.pch" /Fo"Debug\\" /Fd"Debug\vc120.pdb" /Gd /TP /analyze- /errorReport:prompt stdafx.cpp
2> 
1> 
2>  stdafx.cpp
1>  stdafx.cpp
1>  Microsoft (R) C/C++ Optimizing Compiler Version 18.00.40629 for x86
2>  Microsoft (R) C/C++ Optimizing Compiler Version 18.00.40629 for x86
2>  Copyright (C) Microsoft Corporation.  All rights reserved.
1>  Copyright (C) Microsoft Corporation.  All rights reserved.
1> 
2> 
1>  cl /c /ZI /W3 /WX- /sdl /Od /Oy- /D WIN32 /D _DEBUG /D _LIB /D _UNICODE /D UNICODE /Gm /EHsc /RTC1 /MDd /GS /Zc:wchar_t /Zc:forScope /Yu"stdafx.h" /Fp"Debug\lib1.pch" /Fo"Debug\\" /Fd"Debug\vc120.pdb" /Gd /TP /analyze- /errorReport:prompt foo1.cpp
2>  cl /c /ZI /W3 /WX- /sdl /Od /Oy- /D WIN32 /D _DEBUG /D _LIB /D _UNICODE /D UNICODE /Gm /EHsc /RTC1 /MDd /GS /Zc:wchar_t /Zc:forScope /Yu"stdafx.h" /Fp"Debug\lib2.pch" /Fo"Debug\\" /Fd"Debug\vc120.pdb" /Gd /TP /analyze- /errorReport:prompt foo2.cpp
1> 
2> 
2>  foo2.cpp
1>  foo1.cpp
1>  lib1.vcxproj -> C:\TEMP\issues\Forum\main\Debug\lib1.lib
2>  lib2.vcxproj -> C:\TEMP\issues\Forum\main\Debug\lib2.lib
3>------ Rebuild All started: Project: main, Configuration: Debug Win32 ------
3>  Microsoft (R) C/C++ Optimizing Compiler Version 18.00.40629 for x86
3>  Copyright (C) Microsoft Corporation.  All rights reserved.
3> 
3>  cl /c /ZI /W3 /WX- /sdl /Od /Oy- /D WIN32 /D _DEBUG /D _CONSOLE /D _LIB /D _UNICODE /D UNICODE /Gm /EHsc /RTC1 /MDd /GS /Zc:wchar_t /Zc:forScope /Yc"stdafx.h" /Fp"Debug\main.pch" /Fo"Debug\\" /Fd"Debug\vc120.pdb" /Gd /TP /analyze- /errorReport:prompt stdafx.cpp
3> 
3>  stdafx.cpp
3>  Microsoft (R) C/C++ Optimizing Compiler Version 18.00.40629 for x86
3>  Copyright (C) Microsoft Corporation.  All rights reserved.
3> 
3>  cl /c /ZI /W3 /WX- /sdl /Od /Oy- /D WIN32 /D _DEBUG /D _CONSOLE /D _LIB /D _UNICODE /D UNICODE /Gm /EHsc /RTC1 /MDd /GS /Zc:wchar_t /Zc:forScope /Yu"stdafx.h" /Fp"Debug\main.pch" /Fo"Debug\\" /Fd"Debug\vc120.pdb" /Gd /TP /analyze- /errorReport:prompt main.cpp
3> 
3>  main.cpp
3>  Microsoft (R) Incremental Linker Version 12.00.40629.0
3>  Copyright (C) Microsoft Corporation.  All rights reserved.
3> 
3>  "/OUT:C:\TEMP\issues\Forum\main\Debug\main.exe" /INCREMENTAL kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MANIFEST "/MANIFESTUAC:level='asInvoker' uiAccess='false'" /manifest:embed /DEBUG "/PDB:C:\TEMP\issues\Forum\main\Debug\main.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT "/IMPLIB:C:\TEMP\issues\Forum\main\Debug\main.lib" /MACHINE:X86 Debug\main.obj
3>  Debug\stdafx.obj
3>main.obj : error LNK2019: unresolved external symbol "int __cdecl foo2(int,int)" (?foo2@@YAHHH@Z) referenced in function _wmain
3>main.obj : error LNK2019: unresolved external symbol "int __cdecl foo1(int,int)" (?foo1@@YAHHH@Z) referenced in function _wmain
3>C:\TEMP\issues\Forum\main\Debug\main.exe : fatal error LNK1120: 2 unresolved externals
========== Rebuild All: 2 succeeded, 1 failed, 0 skipped ==========

Gordon_F_
Beginner
147 Views

Jennifer,

Do I assume then that this is a bug? I hope I'll be able to set breakpoints in multiple libraries as I debug my own code. It appears that for the moment we have hit a dead end and we need to wait for a new release. But thanks anyways.

I have an unrelated issue and don't know exactly where to post the problem. My multiple projects are in C, C++, and Fortran. They all use the MKL libraries. I had some unresolved externals on MKL from lapack, and after some research I learned that I had to manually install these libraries from the Cluster version - which I have.

So I went back to the installation and re-installed the Intel tools - this time asking to install everything. It certainly worked and the missing libraries are all there. But I ran into the following problem: when building my Fortran project all I get now is the following message:

Error: The operation could not be completed. Unspecified error

I suspect I can delete the project and recreate it from scratch. But that will be very, very time consuming and error prone. Is there a way to easily fix this problem?

Also, if you believe this should be moved to a new thread, please do so and post a link to it here.

Thanks.

JenniferJ
Moderator
147 Views

No, it's not a bug in the Intel C++ Compiler IDE integration. It seems there is a bug in the VS2013 U4 release. The VS2013 U5 is released, I just haven't installed it yet.

About the other error you're having with the Fortran project, I saw one posting related to it: https://software.intel.com/fr-fr/node/622225

Jennifer

Gordon_F_
Beginner
147 Views

Jennifer,

Finally, I have an update for you:

1) I completely uninstalled all Intel tools. Then I installed Visual Studio Update 5. Then reinstalled all Intel tools.

2) My Fortran projects now build fine. Thanks for that link.

3) But VS U5 failed to resolve the problem with the dependent libraries. I had to manually add the libraries to the project or it failed to find all external symbols. Either this is a bug in VS or there's something else I need to know.

But the good news is that my test program is running with MPI. Thanks.

Reply