Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
FPGA community forums and blogs on community.intel.com are migrating to the new Altera Community and are read-only. For urgent support needs during this transition, please visit the FPGA Design Resources page or contact an Altera Authorized Distributor.

Linking with C Library Project

dannycat
New Contributor I
587 Views
Hi everyone,

I have recently converted a Visual Studio 6 C project containing several libraries with one being dependent upon each of the others using the VS8.

MainLib
|
|--------------------------|----------------------------------------|----------------------------|
SubLib1 SubLib2 SubLib3 SubLib4


I intend call up subroutines from the dependent C library from my IVF Fortran project, where I have added the "MainLib" library in the Linker Additional Dependencies and appropriate directory path in Additional Library Directories. Unfortunately when I try to link a get several unresolved external symbols which are all from functions/subroutines within the other (SubLib*) libraries in the C solution. Do I have to add all libraries and paths separately or is there a setting that will get the linker to search all libraries that the dependent C library requires?

If I link to the old VS6 library there is no problemcalling up the MainLib only and all symbols are resolved, which indicates that something is not set correctly in the new C project solution.

The mainreason for moving on the VS8 is to produce a 64 bit version of the library, otherwise I would carry on using the old library project.

Any help would be appreciated.
0 Kudos
2 Replies
Steven_L_Intel1
Employee
587 Views
It's not completely clear to me what you have done. The linker will look at libraries only if it has been told the names of libraries to search. That can be explicitly in the project settings or from linker directives inserted by the compiler. It sounds to me as if you also need to name Sublib.lib here. You can enable "Show progress messages" in the linker property page and then view the build log to see what the linker is doing and where it is looking.
0 Kudos
dannycat
New Contributor I
587 Views
It's not completely clear to me what you have done. The linker will look at libraries only if it has been told the names of libraries to search. That can be explicitly in the project settings or from linker directives inserted by the compiler. It sounds to me as if you also need to name Sublib.lib here. You can enable "Show progress messages" in the linker property page and then view the build log to see what the linker is doing and where it is looking.
Hi Steve, I've had a look at the libraries and it looks as thoughthe VS6 project produces all the individual SubLib libraries but also includes their contents (object files)in the top library MainLib, whereas in the VS8 solution the MainLib library only contains files within the MainLib project and not the whole solution. This implies there is someway of loading all the object files into the main library within Visual Studio. If this is no longer possible I will add all libraries explicitly.

Having just said all that I've found a switch in the Properties/Librarian/General "Link Library Dependecies" that was set to No in the VC8 solution. Changing this to Yes has loaded all dependent objects into the top level library. This was probably a default setting in VC6 and there doesn't seem to be a switch in the IDE.

Thanks for your help nevertheless.
0 Kudos
Reply