[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: undefined reference to 'something'



Yinghong Zhou wrote:

> Thank you very much for your reply!
> 
> Your are absolute right. The wsmp was written by Fortran. 
> After I added the underscore, I have new "undefined reference" coming up.
> Here is a few examples of them:
> : undefined reference to `ftn_i_jishft'
> ./lib/libwsmp64.a(torder.o)(.text+0x11f9): In function `fllagbgref5_':
> : undefined reference to `ftn_i_jishft'
> ./lib/libwsmp64.a(torder.o)(.data+0x10): In function `.C4_283':
> : undefined reference to `pgf90_compiled'

[snip]
> Could you please tell me how to solve those errors. They are not functions
> in wsmp, but called by wsmp. 

Try adding the FORTRAN library at the end of the linking command.  G++
doesn't know to look for it if you don't tell it.  So if the wsmp64
library was originally compiled by G77, you would need to add -lg2c at
the end of this command:

>>>	 g++ -o wgsmp wgsmp_ex1.cpp -L../lib/libgoto_opteron-64-r0.99-3.so
>>>-L../lib -lwsmp64 -lpthread -Wno-deprecated

However it looks like your libwsmp64 was instead originally compiled
with pgf90, judging by the undefined "pgf90_compiled" references.  I
don't know offhand what magic incantations are needed to make G++ link
against pgf90 libraries.  Section 6.13 of this web page I found via
Google looks like it might be helpful:

http://www.dcsc.sdu.dk/docs/PGI/pgiws_ug/pgiug_07.htm#Heading97

The table of contents for the page is here:
http://www.dcsc.sdu.dk/docs/PGI/pgiws_ug/pgiug_.htm

Good luck,

-- 
Kevin B. McCarty <kmccarty@princeton.edu>   Physics Department
WWW: http://www.princeton.edu/~kmccarty/    Princeton University
GPG: public key ID 4F83C751                 Princeton, NJ 08544



Reply to: