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

linking error while using -parallel compiler option

Ctech_Ctech
Beginner
1,074 Views
[bash]Hi All,

When I follow the steps given below using -parallel compiler option, I come across "undefined reference" linking errors for the lines begining with "int main()" and some return statements in my source code:

icpc -g -fPIC -O2 -parallel -c myapp.cc -o myapp.o icpc -o myapp myapp.o myapp.o: In function `main': myapp.cc:230: undefined reference to `__kmpc_begin' //"int main()" line myapp.cc:230: undefined reference to `__kmpc_global_thread_num' //"return false" line myapp.cc:1852: undefined reference to `__kmpc_end' //"return false" line myapp.cc:1842: undefined reference to `__kmpc_end' //"return false" line myapp.cc:1832: undefined reference to `__kmpc_end' //"return false" line myapp.cc:1822: undefined reference to `__kmpc_end' //"return false" line myapp.o: In function `__sti__$E': myapp.cc:1921: undefined reference to `__kmpc_begin' myapp.o: In function `__sti__$E': /usr/include/c++/4.4.1/iostream:65536: undefined reference to `__kmpc_end' make: *** [myapp] Error 1 [/bash]
What may be causing this ? and What is the possible solution ?

Thanks.
0 Kudos
1 Reply
Feilong_H_Intel
Employee
1,074 Views
Hi there,

You need to add -parallel in your link command line. That should solve the problem.

Thank you.
--
Feilong H.
Intel Developer Support

Tools Knowledge Base: http://software.intel.com/en-us/articles/tools
0 Kudos
Reply