473,406 Members | 2,867 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

getopt_long problem

HI!
I write a little test program.
In witch I use getopt_long function...
I included unstd.h , optget.h , stdio.h and stdlib.h
when i try to link the program with gcc -o result main.o
( within a makefile , i.e I run make)
it says

tmp/ccGfK1gp.o(.eh_frame+0x11): undefined reference to
`__gxx_personality_v0'
collect2: ld returned 1 exit status
make: *** [run] Error 1

As result it doesn't generate binary file :(
When I remove call of getopt_long functions the problem disapears...
Realy strange!...
Any ideas ?
10x in advance .
Nov 14 '05 #1
2 4194
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

jenea <pu*****@gmail.com> writes:
I write a little test program.
In witch I use getopt_long function...
I included unstd.h , optget.h , stdio.h and stdlib.h
when i try to link the program with gcc -o result main.o

tmp/ccGfK1gp.o(.eh_frame+0x11): undefined reference to
`__gxx_personality_v0'
collect2: ld returned 1 exit status
make: *** [run] Error 1

When I remove call of getopt_long functions the problem disapears...


$ nm -D -C /usr/lib/libstdc++.so.6 | grep __gxx_personality_v0
000a0e70 T __gxx_personality_v0

You are writing C++, not C, and so you need to use g++ rather than gcc
to link.

getopt_long is a red herring; you need to check if you are
unintentionally using C++ features in your program. Assuming you are
writing C, since this is a C group, you need to remove the C++
features from your code and then linking should work fine.
Regards,
Roger

- --
Roger Leigh
Printing on GNU/Linux? http://gimp-print.sourceforge.net/
Debian GNU/Linux http://www.debian.org/
GPG Public Key: 0x25BFB848. Please sign and encrypt your mail.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.8 <http://mailcrypt.sourceforge.net/>

iD8DBQFCH3kKVcFcaSW/uEgRAmxhAKDwUQyJod9XpQqV0I0fZUwGHk4NtACeMxm8
yYMzxBelw1S4vRmhFYzoU9Y=
=82rr
-----END PGP SIGNATURE-----
Nov 14 '05 #2
jenea wrote:
HI!
I write a little test program.
In witch I use getopt_long function...
I included unstd.h , optget.h , stdio.h and stdlib.h
when i try to link the program with gcc -o result main.o
( within a makefile , i.e I run make)
it says

tmp/ccGfK1gp.o(.eh_frame+0x11): undefined reference to
`__gxx_personality_v0'
collect2: ld returned 1 exit status
make: *** [run] Error 1

As result it doesn't generate binary file :(
When I remove call of getopt_long functions the problem disapears...
Realy strange!...
Any ideas ?
10x in advance .


The same message appeared in a similar thread just a few
hours ago: (Subject: GCC linker throws weird error message)
I am compiling with GCC 3.2, and it works well enough. However,
sometimes when I try to link libraries, the linker throws
"NOTAD.o(.eh_frame+0x11):NOTAD.C: undefined reference to
`__gxx_personality_v0'". This never happened until about 3 days ago.

The solution is: because your filename is in UPPER CASE gcc is treating it as a C++
source. rename extension to lower case (.c instead of .C) and it
should work.
Posted by Rex.

Truly a *clear* error message:
tmp/ccGfK1gp.o(.eh_frame+0x11): undefined reference to
`__gxx_personality_v0'
collect2: ld returned 1 exit status


Nov 14 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Bruce Davis | last post by:
I'm having a problem on windows (both 2000 and XP) with a multi-threaded tkinter gui application. The problem appears to be a deadlock condition when a child thread pops up a Pmw dialog window in...
117
by: Peter Olcott | last post by:
www.halting-problem.com
2
by: Karthik | last post by:
hi everyone, I am using getopt_long() in one of my programs to parse out the command line arguments. The library call returns a character code of "1" which i am not sure whether it is a errno...
28
by: Jon Davis | last post by:
If I have a class with a virtual method, and a child class that overrides the virtual method, and then I create an instance of the child class AS A base class... BaseClass bc = new ChildClass();...
6
by: Ammar | last post by:
Dear All, I'm facing a small problem. I have a portal web site, that contains articles, for each article, the end user can send a comment about the article. The problem is: I the comment length...
16
by: Dany | last post by:
Our web service was working fine until we installed .net Framework 1.1 service pack 1. Uninstalling SP1 is not an option because our largest customer says service packs marked as "critical" by...
2
by: Mike Collins | last post by:
I cannot get the correct drop down list value from a drop down I have on my web form. I get the initial value that was loaded in the list. It was asked by someone else what the autopostback was...
1
by: Angel Tsankov | last post by:
Does anyone know of a port of getopt and getopt_long for Windows, especially one that compiles and links with VC++?
1
by: ff0000 | last post by:
Hi everyone, Preamble: i'm a newbie :-) I've a doubt about the behaviour of variable "hasarg" in the option struct (from getopt(3)): struct option { const char *name; int has_arg;...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.