Compiler error & link problem

Compiler error & link problem

Dear All,

I am just switching from VC++ (Visual Studio 2008) to Intel C++ (2011, update6) and have the following compiling error:

1>ipo_51045obj.obj : error LNK2001: unresolved external symbol ___intel_sse2_strncmp
1>ipo_51045obj.obj : error LNK2001: unresolved external symbol ___intel_sse2_strcpy
1>ipo_51045obj.obj : error LNK2001: unresolved external symbol ___intel_sse2_strncat
1>ipo_51045obj.obj : error LNK2001: unresolved external symbol ___intel_sse2_strcat

The code compiles well in VC++.

I removed all 3rd party solvers, leaving only the MKL_pardiso and MKL_dss in the code. It can then compile & link but I see no executable files produced. However it all works fine if I just switch to VC++ option.

Could you please tell me what could be the issue with this?

Many thanks in advance & regards

Giang

publicaciones de 16 / 0 nuevos
Último envío
Para obtener más información sobre las optimizaciones del compilador, consulte el aviso sobre la optimización.

Hi Giang,

Those symbols should be defined in the libirc or libintlc libraries provided with the Intel compiler. Make sure your Tools->Options->Intel Composer XE ->C++->Compilers settings has the right directories set up for the Libraries and make sure those libraries exist in something like c:\program files (x86)\Intel\Composer XE 2011\compiler\lib\intel64. Also, if you're using /NODEFAULTLIB and specifying your own libraries, you'll need to manually add these Intel runtime libraries to the linker options. If you want to see what libraries are linked in, you can open an object file in a text editor and look for the string "defaultlib". Let me know if that helps.

Brandon Hewitt Technical Consulting Engineer Tools Knowledge Base: "http://software.intel.com/en-us/articles/tools" Software Product Support info: "http://www.intel.com/software/support"

Hi Brandon,

Many thanks for a quick reply.

I removed the /NODEFAULTLIB, set the path explicitly to the folder with libirc.lib but the same compiler errors still occur. I however cannot find libintcl.lib in my machine.

On the other hand other project with the same code but 3rd party solvers removed compiles & link well (as I said above), but produces no executable file. The compiler errors above are however associated with my code, not the 3rd party solvers.

It's very strange to me that I got these errors in one project, and got no executable file in another.

Many thanks in advance for your advice.

Regards,
Giang

Hi Giang,

Sorry, the libintlc library is only on Linux - my confusion.

Can you do a dumpbin /symbols libirc.lib on your libirc library and verify that those symbols are defined there?  They are on my installation.  I suspect you may be linking in an older version of the runtime somehow.

Why the other project is linking but not creating an executable is odd.  I would check and make sure the executable is being output where you expect.  You may want to do a drive search to see if the executable is being placed somewhere else.  Alternatively, you may be missing a compiler or linker error somewhere.  Read over the generated BuildLog by Visual Studio and see if that doesn't reveal something.

Brandon Hewitt Technical Consulting Engineer Tools Knowledge Base: "http://software.intel.com/en-us/articles/tools" Software Product Support info: "http://www.intel.com/software/support"

>>I am just switching from VC++ (Visual Studio 2008) to Intel C++ (2011, update6) and have the following compiling error:
>>
>>1>ipo_51045obj.obj : error LNK2001: unresolved external symbol ___intel_sse2_strncmp
>>1>ipo_51045obj.obj : error LNK2001: unresolved external symbol ___intel_sse2_strcpy
>>1>ipo_51045obj.obj : error LNK2001: unresolved external symbol ___intel_sse2_strncat
>>1>ipo_51045obj.obj : error LNK2001: unresolved external symbol ___intel_sse2_strcat

I just verified and all these symbols are defined in:

..\lib\ia32\libirc.lib
..\lib\ia32\libircmt.lib

Note: for a 32-bit Windows platform and 32-bit Intel C/C++ compiler

Could you add libircmt.lib to a list of libraries?

>>I am just switching from VC++ (Visual Studio 2008) to Intel C++ (2011, update6) and have the following compiling error:
>>
>>1>ipo_51045obj.obj : error LNK2001: unresolved external symbol ___intel_sse2_strncmp
>>1>ipo_51045obj.obj : error LNK2001: unresolved external symbol ___intel_sse2_strcpy
>>1>ipo_51045obj.obj : error LNK2001: unresolved external symbol ___intel_sse2_strncat
>>1>ipo_51045obj.obj : error LNK2001: unresolved external symbol ___intel_sse2_strcat

I also would like to add that these are Linker errors, not Compiler.

Hi Brandon & Sergey,

Thanks a lot. I tried all your suggestions and things worked in the end. The project that did not link (with the above errors) finally did and produced .exe file after I dragged (using mouse) the two library files into the project window. Before I added link to the folder contaning these library files, as I did successfully for all MKL library files, but it did not work. What is wrong with that?

The other project that did not produce .exe file still did not work. I could not find the exe file any where in my computer. There is also no error (but few warnings) that I saw in Buildlog file.

Anyway, at least it works now. If you could point out the issues then that would help me a lot when working with VS and Intell C++ compiler.

Many thanks in advance.

Giang

Hi Giang,

>>...The project that did not link (with the above errors) finally did and produced .exe file after I dragged (using mouse) the two
>>library files into the project window...

I'm glad to see that you partially solved your problems. Actually, when I asked you to add one of mentioned libraries I expected that you would add it in your VS project in a different way:

Select project in Solution Explorer -> Project Properties -> Configuration Properties -> Linker -> Input -> Additional Dependencies

>>Before I added link to the folder contaning these library files, as I did successfully for all MKL library files, but it did
>>not work. What is wrong with that?

Sorry but I never tried to do this.

If you still have some problems please post a complete log of compiler or/and linker errors.

Hi Sergey,

Thank you. I tried what you'd suggested but it did not work. I still have no idea.

It just works when I drag and drop those library files in the project. This is what I usually do when having to link with an external library. I'll try to figure out why.

Thanks again,

Giang

Hi Giang,

>>...This is what I usually do when having to link with an external library. I'll try to figure out why...

Please also consider ( at least in the future ) a very flexible method of controlling link libraries in source codes:
...
#pragma comment ( lib, "../MyLibrary.lib" )
...

Hi Sergey,

The compiler is already effectively adding this pragma comment for the Intel libraries in question, so he'd still likely get linker errors regardless.  Using /nodefaultlib on the linker line would remove those pragma comments (although you can use /nodefaultlib:<library> for specific libraries, but since Giang would be using the same library names, his pragma comments would be removed).

Giang, would you be willing to send us your solution and source so we can see the problem on our side?  If that is not doable, perhaps just the .vcproj and .icproj files and the BuildLogs might reveal something to us.

Typically, the Intel library path is set from Tools->Options->Intel Composer XE->C++->Compilers, so you should check those settings and ensure they're correct.

For the project that's not emitting an executable, the only thing I can think of is that perhaps you have a Static Analysis setting in there.  The compiler option for that is something along the lines of /Qdiag-enable:scN where N is a number.  Static Analysis does static error checking across modules and does not create binaries.

Brandon Hewitt Technical Consulting Engineer Tools Knowledge Base: "http://software.intel.com/en-us/articles/tools" Software Product Support info: "http://www.intel.com/software/support"

Dear Brandon,

Thank you. I sent you the files.

I tried your option: "Typically, the Intel library path is set from Tools->Options->Intel Composer XE->C++->Compilers, so you should check those settings and ensure they're correct" but it did not work on my computer.

Regards,

Giang

Hi Giang,

Looking at the Buildlog you sent me, I see two different LIBPATH settings with different compiler paths in them, like so:

/LIBPATH:"C:\Program Files\Intel\Compiler\11.1\067\lib\ia32"

/LIBPATH:"C:\Program Files\Intel\Composer XE 2011 SP1\compiler\lib\ia32"

(/LIBPATH:"C:\Program Files\Intel\Composer XE 2011 SP1\compiler\lib\ia32" gets repeated again as well, but that should be harmless)

I strongly suspect that the first path with 11.1 libraries is getting picked up first and causing your linker problems.  Can you find out where that LIBPATH setting is originating from and remove it?  This way only the 2011 SP1 directory with the more up to date compiler runtime libraries will be linked in.

Brandon Hewitt Technical Consulting Engineer Tools Knowledge Base: "http://software.intel.com/en-us/articles/tools" Software Product Support info: "http://www.intel.com/software/support"

Hi Brandon,

>>...
>>/LIBPATH:"C:\Program Files\Intel\Compiler\11.1\067\lib\ia32"
>>
>>/LIBPATH:"C:\Program Files\Intel\Composer XE 2011 SP1\compiler\lib\ia32"
>>...

The most interesting thing is that on my Windows XP ( 32-bit ) both folders have absolutely identical libraries ( I'd like to stress, no differences at all! ). It means, that it doesn't matter which path is selected first or second ( if both defined ) the same libraries will be linked.

Same library names, but different library versions.  The Composer XE 2011 libraries are more up to date and should be used.  They are backwards compatible with code generated by older compilers, so you only need the latest.

Or are you saying that you diff'd the libraries and they are bit-wise the same?  That would mean something is wrong.  The library contents do change over time - they get built with newer compilers for one thing even if nothing else changed.  But a linker error like Giang described is definitely feasible if you're using a newer compiler generating code that calls library functions with an older version of the library that doesn't have those definitions.

Brandon Hewitt Technical Consulting Engineer Tools Knowledge Base: "http://software.intel.com/en-us/articles/tools" Software Product Support info: "http://www.intel.com/software/support"

>>...Or are you saying that you diff'd the libraries and they are bit-wise the same?

Yes and it means something is wrong with my ICC environment. However, I don't have any issues, linker problems, etc. with Intel C++ compiler for a long time.

Inicie sesión para dejar un comentario.