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-----------------------------------------------
#include<stdio.h>
#include<papi.h>
#include<stdlib.h>
int main(){
int retval;
PAPI_dmem_info_t dmem;
if (PAPI_library_init(PAPI_VER_CURRENT) != PAPI_VER_CURRENT)
exit(1);
retval = PAPI_library_init(PAPI_VER_CURRENT);
if (retval != PAPI_VER_CURRENT)
handle_error(retval);
PAPI_get_dmem_info(&dmem);
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;
}
----------------------------------------------------------------end-------------------------------------
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.
Thanks!
