From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ig0-x234.google.com (mail-ig0-x234.google.com [IPv6:2607:f8b0:4001:c05::234]) by dpdk.org (Postfix) with ESMTP id 733C62E8A for ; Thu, 2 Jan 2014 14:18:46 +0100 (CET) Received: by mail-ig0-f180.google.com with SMTP id m12so2543776iga.1 for ; Thu, 02 Jan 2014 05:19:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=bJReqzag3AbFzN8uIQ7Gm5zYqu6GuE0QDDyUhw1NGZs=; b=tJHm9+fg1Rnt9IlBsIpIGqAOesAm1NKG66LalJCtklmHzZTdIJstMBX1uWZ4xIb44u NrRFCI8Sw5i8grGDnEg9ifYWmZgsGyEIhnXtOff1LU9qeIhDmTOaTBU4yMFM+Sl5X0za uQvJYf4xVaMtccKyyLuoRcO7BmQIN85YWsL1s6s8VVr/i5Sux124494qwG+TkeBOpmx9 TfcMoVA97mrCU6X82iIp56q0XH3Py8X1snMsNF2U9/c9KI8JF2eL0oKIJ1MHfdyFvr7t hS3l13hOqWJP9uyKmlM4hzuocI+IL6SHgCuwpSl6Cvihaxh6jCdC/L0Uk7OMDYjhBWXy Mdcw== MIME-Version: 1.0 X-Received: by 10.50.122.38 with SMTP id lp6mr71028722igb.30.1388668796446; Thu, 02 Jan 2014 05:19:56 -0800 (PST) Received: by 10.64.89.67 with HTTP; Thu, 2 Jan 2014 05:19:56 -0800 (PST) Received: by 10.64.89.67 with HTTP; Thu, 2 Jan 2014 05:19:56 -0800 (PST) In-Reply-To: References: Date: Thu, 2 Jan 2014 08:19:56 -0500 Message-ID: From: Stefan Baranoff To: Hamid Ramazani Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Cc: dev@dpdk.org Subject: Re: [dpdk-dev] g++: undefined reference to X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Jan 2014 13:18:47 -0000 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" 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 >