Re: Parsing command line arguments using Glib



On Mon, Mar 20, 2006 at 09:42:35AM +1100, Randima Niroshini wrote:
> I am trying to use GOption feature in my program to pass command line 
> arguments. However, when I try to use GOption functions I am getting the 
> following error.
> 
> g++  -g -O2 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include     -o param  
> param-scanner.o param.o param-driver.o param-parser.o
> param.o: In function `main':./param.cc:17: undefined reference to 
> `g_option_context_new'
> :./param.cc:18: undefined reference to `g_option_context_add_main_entries'
> :./param.cc:19: undefined reference to `g_option_context_parse'
> :./param.cc:20: undefined reference to `g_option_context_free'
> :./param.cc:22: undefined reference to `g_print'
> collect2: ld returned 1 exit status
> 
> I found that GOption is only available in Glib>=2.6 and I checked it in 
> configure.ac and and found it is available. However, it is only failing to 
> locate above functions. Other GOption types referred correctly.(ex: 
> gboolean,GOptionEntry,GOptionContext)
> 
> Please let me know your thoughts on this?

You do not link with glib at all (hint1: g_print is not
found either so this is not a glib version problem;
hint2: where is any -lglib-2.0?;  hint3: always use
pkg-config to get the compiler and linker options).

Yeti


--
That's enough.



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