I got some problems which is "undefined reference to XXX"

Open discussion of PAPI.

I got some problems which is "undefined reference to XXX"

Postby wan0573 » Thu Oct 03, 2013 4:04 am

I followed the INSTALL.txt and has installed papi-5.2.0.

my cpu is Intel(R) Core(TM) i7-3610QM CPU @ 2.30GHz

my OS is CentOS6.4

--------------------------------------------------------my code-----------------------------------------------
int main(){
int retval;
PAPI_dmem_info_t dmem;
retval = PAPI_library_init(PAPI_VER_CURRENT);
if (retval != PAPI_VER_CURRENT)
printf("Mem Size:\t\t%lld\n",dmem.size);
printf("Mem Resident:\t\t%lld\n",dmem.resident);
printf("Mem High Water Mark:\t%lld\n",dmem.high_water_mark);
printf("Mem Shared:\t\t%lld\n",dmem.shared);
printf("Mem Text:\t\t%lld\n",dmem.text);
printf("Mem Library:\t\t%lld\n",dmem.library);
printf("Mem Heap:\t\t%lld\n",dmem.heap);
printf("Mem Locked:\t\t%lld\n",dmem.locked);
printf("Mem Stack:\t\t%lld\n",dmem.stack);
printf("Mem Pagesize:\t\t%lld\n",dmem.pagesize);
return 0;


Then,I used the Command like this:

[root@localhost src]# gcc -o mywork mywork.c
/tmp/cc6CkiIm.o: In function `main':
mywork.c:(.text+0xe): undefined reference to `PAPI_library_init'
mywork.c:(.text+0x29): undefined reference to `PAPI_library_init'
mywork.c:(.text+0x44): undefined reference to `handle_error'
mywork.c:(.text+0x50): undefined reference to `PAPI_get_dmem_info'
collect2: ld 返回 1

I am confused about the error.Does anyone can give me a little advice.

Posts: 2
Joined: Thu Oct 03, 2013 3:52 am

Return to General discussion (read-only)

Who is online

Users browsing this forum: No registered users and 2 guests