Linking error (v12.8, stl_algo.h)

Hi~

Now, I try to compile the original codes by pgc++, which are compiled g++ well.
Compiling step is fine but there are endless errors in linking step.

Actually, almost errors are like that:

aaa.cpp : undefined reference to ‘__blt_pgi_clzl’
aaa.o: In function ‘std::__lg(long)’:
/usr/lib/gcc/x86_64-redhat-linux/include/c++/bits/stl_algo.h:2324:undefined referene to ‘__blt_pgi_clzl’

I think these errors are related to which library I should use.
How do I fix these errors?

You should probably link with pgc++.
__blt_pgi_clzl lives in libpgc.a

If you must use g++ to link, then you will need to add the pgi libraries
‘pgc++ -dryrun t.o’ will show you the link line that we use.
At a minimum, you will probably have to add something like
-L/usr/pgi/linux86-64/lib -lpgatm -lpgmp -lpgc