Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7956 Discussions

Cant compile, getting undefined reference even though including lib.

cptanpanic
Beginner
498 Views
I am trying to compile a simple program that consists of 2 objects and a library. I compiled the library with icc, and it doesn't complain that it doesn't exist but the methods I am using show up as undefined references. Any help would be greatly appreciated.
Thanks,
Brian

icc -g -c -o do_delta.o do_delta.cpp
icc -g -c -o PerfTest.o PerfTest.cpp
icc -L. -lperfctr_icc2 do_delta.o PerfTest.o -o do_delta
PerfTest.o(.text+0x11a5): In function `RunTest':
/home/panic/devo/perfTest/PerfTest.cpp:102: undefined reference to `vperfctr_read_tsc(vperfctr const*)'
PerfTest.o(.text+0x11d5):/home/panic/devo/perfTest/PerfTest.cpp:104: undefined reference to `vperfctr_read_tsc(vperfctr const*)'
PerfTest.o(.text+0x12b9):/home/panic/devo/perfTest/PerfTest.cpp:110: undefined reference to `vperfctr_read_ctrs(vperfctr const*, perfctr_sum_ctrs*)'
PerfTest.o(.text+0x12db):/home/panic/devo/perfTest/PerfTest.cpp:112: undefined reference to `vperfctr_read_ctrs(vperfctr const*, perfctr_sum_ctrs*)'
PerfTest.o(.text+0x136d): In function `Initialize':
/home/panic/devo/perfTest/PerfTest.cpp:69: undefined reference to `vperfctr_open()'
PerfTest.o(.text+0x13bb):/home/panic/devo/perfTest/PerfTest.cpp:74: undefined reference to `vperfctr_info(vperfctr const*, perfctr_info*)'
PerfTest.o(.text+0x1407):/home/panic/devo/perfTest/PerfTest.cpp:79: undefined reference to `perfctr_info_print(perfctr_info const*)'
PerfTest.o(.text+0x149e): In function `Enable':
/home/panic/devo/perfTest/PerfTest.cpp:138: undefined reference to `vperfctr_control(vperfctr const*, vperfctr_control*)'
0 Kudos
1 Reply
cptanpanic
Beginner
498 Views
I have been trying things, and it has to do with the library being C and the program is in C++. I am using extern "C" but I am seeing if I can find what is wrong.
0 Kudos
Reply