c++ - Why am I getting an “Undefined reference” error when I run my Makefile on some computers, but not others? -
i doing research on parallel processing , need test counter output different parallel-ization apis. every time try make code, undefined reference 'papi_...
.
i using papi 5.1.1 , know directories libpapi.a
, papi.h
in. had no issues running makefile on pc on other 1 need, doesn't seem working. here's have
cc=g++ cflags="-fopenmp" lib=/usr/local/lib/libpapi.a -lm -lpthread include=-i/usr/local/include all: test echo "done" test: testpandp.cpp ${cc} ${cflags} ${lib} ${include} -o test testpandp.cpp clean: ${rm} *.o test
i have read other posts asking undefined reference but, every 1 i've seen suggested use -l/usr/local/lib
or /usr/local/lib/libpapi.a
, i'm doing.
does have other suggestions?
depending on version of linker, order of libs might give trouble. why can compile in machines not in others.
changing order of compilation should it:
test: testpandp.cpp ${cc} ${cflags} ${include} -o test testpandp.cpp ${lib}
further information in question linking order.
Comments
Post a Comment