bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: undefined reference to `_program_name' (error.c)


From: Bruno Haible
Subject: Re: undefined reference to `_program_name' (error.c)
Date: Sun, 1 Jun 2008 03:33:27 +0200
User-agent: KMail/1.5.4

Hello,

Daniel Martin wrote:
> When I finally come to linking my program, (again this is when
> cross-compiling to mingw32) I'm getting the following error:
> 
> i386-mingw32-g++ -I/home/dan/usr/cross/i386-mingw32/include -ggdb3 -Wall
> -I/home/dan/usr/cross/i386-mingw32/include -s -o pendulum.exe
> pendulum-arguments.o pendulum-interface.o pendulum-maths.o
> pendulum-main.o pendulum-pendulum.o pendulum-simulation.o
> pendulum-vec3.o  -L/home/dan/usr/cross/i386-mingw32/lib
> guis/.libs/libguis.a -L/home/dan/usr/cross/i386-mingw32//lib
> -lwx_base-2.8 -lwx_base_net-2.8 -lwx_msw_core-2.8 -lwx_msw_adv-2.8
> -lwx_msw_gl-2.8
> systems/.libs/libsystems.a ../gnulib/src/.libs/libgnu.a  
> ../gnulib/src/.libs/libgnu.a(error.o):error.c:(.text+0xe1): undefined
> reference to `_program_name'
> ../gnulib/src/.libs/libgnu.a(error.o):error.c:(.text+0x1a1): undefined
> reference to `_program_name'
> 
> This can be worked around by replacing line 98 or error.c:
> 
> extern char *program_name;
> 
> with:
> 
> char* program_name = "";
> 
> But I'm pretty sure that's not the correct way to do it!
> 
> Where is program_name supposed to be set?

The program_name variable is supposed to be defined either in the 'progname'
module or in your main program. And it should be filled when your main
program starts. See also the gnulib doc at
http://www.gnu.org/software/gnulib/manual/html_node/error-and-progname.html

Bruno





reply via email to

[Prev in Thread] Current Thread [Next in Thread]