|
Fail to Make 5.x CPP demo program (_Unwind_Resume) |
Posted by Kerwin on Aug-14-2014 09:50 |
|
Hi,
When I make a CPP demo program , it fail !
ex: I make cppdemo/symbolline
The Error is:
make
g++ -I../../include -L../../lib -Wl,-R../../lib symbolline.cpp -lchartdir -o symbolline
/tmp/cc21NHCs.o(.text+0xec): In function `main':
: undefined reference to `_Unwind_Resume'
I just download the Charydir CPP 5.1 version!
% g++ -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.3/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --
infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --
with-system-zlib --enable-__cxa_atexit --enable-languages=c,c++ --disable-libgcj --
host=i386-redhat-linux
Thread model: posix
gcc version 3.2.3 20030502 (Red Hat Linux 3.2.3-47.3)
g++32: no input files
% uname -a
Linux 2.6.9-89.ELsmp #1 SMP Mon Apr 20 10:34:33 EDT 2009 i686 i686 i386 GNU/Linux |
Re: Fail to Make 5.x CPP demo program (_Unwind_Resume) |
Posted by Peter Kwan on Aug-15-2014 04:11 |
|
Hi Kerwin,
In your case, the code in "main" seems to be using "_Unwind_Resume". It compiles
successfully. However, the linker cannot find this symbol in the c and c++ runtime library,
so it outputs the error.
The "main" is compiled by your gcc 3.2.3 20030502 compiler. I am suspecting your
compiler is somehow generated code that cannot be linked by your linker, possibly due to
some mis-configuration of the compiler or linker.
As far as I know, the _Unwind_Resume should be in the file libgcc_s.so. The g++ should
automatically linked any C++ code with this file (as well as some other system library).
May be you can try to add "-lgcc_s" to explicitly link to this file to see if it can solve the
problem.
Have you ever compiled any C++ code with your compiler? If you have not tested it yet,
you may use the following "Hello World" example to check if it can compile and link C++
code normally.
//=== mytest.cpp ===
#include <stdio.h>
class ABC
{
private:
int abc;
public :
ABC(int a) { abc = a; }
~ABC() { printf("Hello World\\n"); }
void dummy() { abc = 10; }
};
int main(int argc, char *argv[]){
int i = 10;
for (int j = 0; j < 2; ++j)
{
ABC xxx(44);
if (i * i <= 100)
break;
xxx.dummy();
}
}
//================
g++ -I../../include -L../../lib -Wl,-R../../lib mytest.cpp -o mytest
If even the above mytest.cpp does not work, the error is probably due to mis-
configuration of the g++ and not related to ChartDirector (as the above mytest.cpp does
not use ChartDirector at all).
Regards
Peter Kwan |
Re: Fail to Make 5.x CPP demo program (_Unwind_Resume) |
Posted by Kerwin on Aug-15-2014 09:39 |
|
Hi Peter,
Just as you said, when I add "-lgcc_s" , it works !
Thanks a lot ! |
|