Software Archive
Read-only legacy content

functions like pow() used in offload programming

Qiang_L_
Beginner
367 Views

Hi,

I am using the offload programming model on Xeon Phi, and in the code which  I want to offload to the Xeon Phi, I need  to use some math functions like pow() function, however when I  compile the code ,there are some errors during link stage. the error show that it seem the compiler can not find the reference of the pow function. so which path environment should set ?

Thank you!

Qiang

0 Kudos
5 Replies
Frances_R_Intel
Employee
367 Views

If you sourced the compilervars script, then the environment variables should have been properly set for you:

source /opt/intel/composerxe/bin/compilervars.sh intel64

If you did that and still had problems, perhaps you could post an example.

0 Kudos
Qiang_L_
Beginner
367 Views

Hi Frances,

Thank you. I find the reason, it is because I add the "using namespace std" at the beginning of the source file . then the compiler can not find definition of  std::pow() function 

Qiang

0 Kudos
Frances_R_Intel
Employee
367 Views

I'm sorry - I am still having trouble reproducing the error. Something I am doing isn't matching what you are doing. Perhaps something on the compile command? Something about the include files? Can you provide a small test case?

0 Kudos
Qiang_L_
Beginner
367 Views

Hi Frances,

You can find the test in the attachment, in the code I add "using namespace std;" ,that is cause of compiling error.

The only thing I should do is enable the "using namespace std" then is OK.

Thank you

Qiang

0 Kudos
Frances_R_Intel
Employee
367 Views

Now I see why I wasn't able to produce the error - I messed up and didn't include stdlib.h - but you are fine just removing the using namespace line. I'm glad you have resolved your problem.

0 Kudos
Reply