Intel® C++ Compiler
Support and discussions for creating C++ code that runs on platforms based on Intel® processors.
Announcements
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!
For the latest information on Intel’s response to the Log4j/Log4Shell vulnerability, please see Intel-SA-00646
7597 Discussions

Problem linking C/C++ objects after Compiler upgrade (Linux)

benz__alexander
Beginner
133 Views
Hi!



After switching from the 8.1 compiler version to the latest one, we're having linker issues compiling our project under Redhat linux using the 3.2 version of the standard lib.

It seems that these problems have something to do with C code compiles, although I'm having troubles finding the exact source. Maybe anyone can help me out.

The linker problems show up like this:



Image.o(.text+0x1e16): In function 'my_error_exit(jpeg_common_struct*)'

Image.cpp:1028: undefined reference to `scaleImage'



"nm" gives me the following symbols:



"nm -C Image.o |grep scaleImage":

U scaleImage



"nm -C scale.o |grep scaleImage":

00000000 T scaleImage(unsigned, int, int, unsigned, void const*, int, int, unsigned, void*)

00000000 d _Z10scaleImagejiijPKviijPv$$LSDA



Any help would be appreciated.



Cheers,

ALex
0 Kudos
2 Replies
benz__alexander
Beginner
133 Views
Ok I tracked down the problem. I compiled all code with icpc instead of using icc for the C code.
Somehow this worked in earlier versions, although I'm not sure why.
Anyway, problem solved :-)

- ALex
John_O_Intel
Employee
133 Views

Hi ALex,

Glad you figured this out. As you figured out, icpc compiles as C++ code, so uses C++ "mangled" names for functions, whereas icc compiles a C code, and just gives the function name. I tried with the latest 8.1 compilers (8.1.036) and I see the same behavior. Perhaps you were using an older 8.1 compiler ? gcc and g++ have the same behavior, ie g++ compiles C source files as C++.

regards,

_|ohnO

Reply