[dpdk-dev] g++: undefined reference to

Hamid Ramazani mrramazani at gmail.com
Thu Jan 2 10:35:00 CET 2014


Hi,

I wanted to write a simple program using class (object oriented). I've
attached my helloClass.cpp and also Makefile. after runnig make I get
below errors.
I think:
1. it is the problem of using c code in c++
2. I've used extern "C" in helloClass.cpp
3. Should I recompile the DPDK from source with gcc -c argument for
compatibility with g++?

Thanks in advance.

g++ -c  helloClass.cpp
-I/home/hamid/dpdk/dpdk-1.5.1r1/x86_64-default-linuxapp-gcc/include
g++ helloClass.o
-I/home/hamid/dpdk/dpdk-1.5.1r1/x86_64-default-linuxapp-gcc/include
-lstdc++
helloClass.o: In function `rte_lcore_id':
helloClass.cpp:(.text+0x7): undefined reference to `per_lcore__lcore_id'
helloClass.o: In function `rte_get_master_lcore':
helloClass.cpp:(.text+0x15): undefined reference to `rte_eal_get_configuration'
helloClass.o: In function `rte_lcore_is_enabled':
helloClass.cpp:(.text+0x2a): undefined reference to `rte_eal_get_configuration'
helloClass.o: In function `HelloClass::HelloClass(int, char**)':
helloClass.cpp:(.text._ZN10HelloClassC2EiPPc[_ZN10HelloClassC5EiPPc]+0x20):
undefined reference to `rte_eal_init'
helloClass.cpp:(.text._ZN10HelloClassC2EiPPc[_ZN10HelloClassC5EiPPc]+0x4b):
undefined reference to `__rte_panic'
helloClass.o: In function `HelloClass::run()':
helloClass.cpp:(.text._ZN10HelloClass3runEv[HelloClass::run()]+0x3f):
undefined reference to `rte_eal_remote_launch'
helloClass.cpp:(.text._ZN10HelloClass3runEv[HelloClass::run()]+0x80):
undefined reference to `rte_eal_mp_wait_lcore'
collect2: ld returned 1 exit status
make: *** [helloClass.o] Error 1


All the Best,
Hamid


More information about the dev mailing list