Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Krátký__Michal
New Contributor I
235 Views

Cannot link ittnotify with generated object files

Jump to solution

Hello,

I am trying to use a VTune API (ittnotify.h) in C++ code. When I try to compile and link files with single command it works correctly. But when performing separate compilation and linking I get following error: 

test.cpp:6: undefined reference to `__itt_pause_ptr__3_0'
test.cpp:6: undefined reference to `__itt_pause_ptr__3_0'
test.cpp:7: undefined reference to `__itt_resume_ptr__3_0'
test.cpp:7: undefined reference to `__itt_resume_ptr__3_0'

Solution 1 

icpc -Wall -c test.cpp -g -I/data/development/intel/vtune_amplifier_xe_2015/include -o test.o
icpc -g -I/data/development/intel/vtune_amplifier_xe_2015/include /data/development/intel/vtune_amplifier_xe_2015/lib64/libittnotify.a -lpthread test.o -o test

Solution 2: 

icpc -g test.cpp -I/data/development/intel/vtune_amplifier_xe_2015/include /data/development/intel/vtune_amplifier_xe_2015/lib64/libittnotify.a -lpthread -o test 

test.cpp

#include "stdio.h"
#include "ittnotify.h"

int main(int argc, char* argv[])
{
    __itt_pause();
    __itt_resume();
    return 1;
}

For my reasons I cannot use single command version in solution 2. Can you please help me fix steps in solution 1?

System: SLES 11 SP3, Intel Parallel Studio 2015 Pro Update 1

 

0 Kudos
1 Solution
Krátký__Michal
New Contributor I
235 Views

I already found what was wrong. On line 2 in solution 1 test.o has to be before linker flags. In that case it is linked correctly.

View solution in original post

3 Replies
Krátký__Michal
New Contributor I
236 Views

I already found what was wrong. On line 2 in solution 1 test.o has to be before linker flags. In that case it is linked correctly.

View solution in original post

Peter_W_Intel
Employee
235 Views

It's great that you found the root-cause...

If you use Pause/Resume API in MPI program, please read this article.

If you use Pause/Resume API in Intel(R) Xeon Phi(TM) program, please read this article.

235 Views

Thanks!!

This helped a lot!

I was stuck on this for eternity!

Reply