DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stefan Baranoff <sbaranoff@gmail.com>
To: Hamid Ramazani <mrramazani@gmail.com>
Cc: dev@dpdk.org
Subject: Re: [dpdk-dev] g++: undefined reference to
Date: Thu, 2 Jan 2014 08:19:56 -0500	[thread overview]
Message-ID: <CAHzKxpY8fUej+XEQEX5v==0i-=p2d8buPRDiaZFN_rXg2svXDg@mail.gmail.com> (raw)
In-Reply-To: <CACu58pBirLHpm51RCXWbsQZF=NVGtCYkc-+e9ffUQLxpOgxNeQ@mail.gmail.com>

Hamid,

I do not think your attachments made it through but it looks like you are
not linking the DPDK object files in this line:
g++ helloClass.o
-I/home/hamid/dpdk/dpdk-1.5.1r1/x86_64-default-linuxapp-gcc/include
-lstdc++

There would need to be many more files beyond helloClass.o listed. Try
adding the relevant DPDK object files (I do not have the path off hand but
I believe they are in the "build" folder) and recompiling. The files you
need to add are those built when your build DPDK itself.

This is similar to missing -lpcap if compiling against libpcap but in this
case you need to link against object files, not a shared library.

Good luck!
Stefan

Sent from my smart phone; people don't make typos, Swype does!
On Jan 2, 2014 4:35 AM, "Hamid Ramazani" <mrramazani@gmail.com> wrote:

> 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
>

  reply	other threads:[~2014-01-02 13:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-02  9:35 Hamid Ramazani
2014-01-02 13:19 ` Stefan Baranoff [this message]
2014-01-02 16:40   ` Hamid Ramazani
     [not found]     ` <CAHzKxpZ0c8ryHxh3Nh-PEckKZD8a9XiYGy09ucgv4QjrFBPGbg@mail.gmail.com>
2014-01-03  0:46       ` Stefan Baranoff
2014-01-03 10:48         ` Hamid Ramazani
2014-01-03 11:07           ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAHzKxpY8fUej+XEQEX5v==0i-=p2d8buPRDiaZFN_rXg2svXDg@mail.gmail.com' \
    --to=sbaranoff@gmail.com \
    --cc=dev@dpdk.org \
    --cc=mrramazani@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).