Re: Linking problems - newbie problems

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

 



Hello Sasank,

Try /usr/local/lib/pkgconfig also.

If there will be no gtk.pc or smth like this - that means you have not
have gtk installed or your gtk package does not have .pc file.

In that case you will need to manually specify all compiler flags. The
command line should be looking like this:

gcc -o program program.cpp -L/usr/local/lib -lgdk -lglib -lgtk
-I/usr/local/include

Please, consult gtk documentation for more details.

Thanks,
- Alex.

On Wed, Dec 24, 2008 at 3:52 PM,  <sasank.kuntimaddi@xxxxxxxxx> wrote:
> Hi Alex,
>
> Thanks once again,
> I was browsing through the ./usr/lib/pkconfig and I did not find any libgdk file. Does it mean that I am missing the required library and hence getting these errors?
>
> Can you please let me know how to solve this
>
> Regards
> Sasank
>
> -----Original Message-----
> From: Alex Chardash [mailto:achardash@xxxxxxxxx]
> Sent: Wednesday, December 24, 2008 5:54 PM
> To: Sasank Kuntimaddi (WT01 - PES-ADS-IAC Practice)
> Subject: Re: Linking problems - newbie problems
>
> Sasank,
>
> It looks like libgdk is missed in the list returned by pkg-config or is absent in the target path.
>
> Also, it would be useful to try adding extern "C" directive around #include <gtk/gtk.h>.
>
> - Alex
>
>
>
>
>
> On Wed, Dec 24, 2008 at 3:09 PM,  <sasank.kuntimaddi@xxxxxxxxx> wrote:
>> Hi Alex,
>>
>> Thanks for you time.
>> There was a typo from my end. I had to re-type the whole program
>> because my_window.cpp was corrupted and had set the include file as
>> <gdk/gtk.h>. I corrected it and compiled it with  command
>> g++ -o my_window my_window.cpp `pkg-config --cflags --libs gtk+-2.0`.
>> I don't get the compile errors now but the linker errors are still
>> present
>>
>> /usr/lib/gcc/i586-suse-linux/4.3/../../../libgtk-x11-2.0.so: undefined reference to `gdk_threads_add_idle_full'
>> /usr/lib/gcc/i586-suse-linux/4.3/../../../libgtk-x11-2.0.so: undefined reference to `gdk_window_thaw_toplevel_updates_libgtk_only'
>> /usr/lib/gcc/i586-suse-linux/4.3/../../../libgtk-x11-2.0.so: undefined reference to `gdk_window_set_startup_id'
>> /usr/lib/gcc/i586-suse-linux/4.3/../../../libgtk-x11-2.0.so: undefined reference to `gdk_window_freeze_toplevel_updates_libgtk_only'
>> /usr/lib/gcc/i586-suse-linux/4.3/../../../libgtk-x11-2.0.so: undefined reference to `gdk_color_to_string'
>> /usr/lib/gcc/i586-suse-linux/4.3/../../../libgtk-x11-2.0.so: undefined reference to `gdk_window_set_opacity'
>> /usr/lib/gcc/i586-suse-linux/4.3/../../../libgtk-x11-2.0.so: undefined reference to `gdk_threads_add_timeout'
>> /usr/lib/gcc/i586-suse-linux/4.3/../../../libgtk-x11-2.0.so: undefined reference to `gdk_threads_add_timeout_full'
>> /usr/lib/gcc/i586-suse-linux/4.3/../../../libgtk-x11-2.0.so: undefined reference to `gdk_notify_startup_complete_with_id'
>> /usr/lib/gcc/i586-suse-linux/4.3/../../../libgtk-x11-2.0.so: undefined reference to `gdk_event_request_motions'
>> /usr/lib/gcc/i586-suse-linux/4.3/../../../libgtk-x11-2.0.so: undefined reference to `gdk_window_beep'
>> /usr/lib/gcc/i586-suse-linux/4.3/../../../libgtk-x11-2.0.so: undefined reference to `gdk_threads_add_idle'
>> collect2: ld returned 1 exit status
>>
>> Regards
>> Sasank
>>
>> -----Original Message-----
>> From: Alex Chardash [mailto:achardash@xxxxxxxxx]
>> Sent: Wednesday, December 24, 2008 5:32 PM
>> To: Sasank Kuntimaddi (WT01 - PES-ADS-IAC Practice)
>> Subject: Re: Linking problems - newbie problems
>>
>> I suppose pkg-config gives incorrect flags for compiler.
>>
>> If you wish, you can copy it's output and send me.
>>
>> On Wed, Dec 24, 2008 at 2:32 PM,  <sasank.kuntimaddi@xxxxxxxxx> wrote:
>>> Hi Alex,
>>>
>>> Thanks for the response. I tried compiling with the command line you suggested. But I am getting compile time errors:
>>>
>>> linux-ls4f:/ # gcc -o my_window my_window.cpp `pkg-config --cflags
>>> --libs gtk+-2.0`
>>> my_window.cpp:1:21: error: gdk/gtk.h: No such file or directory
>>> my_window.cpp:3: error: expected initializer before â*â token
>>> my_window.cpp:5: error: variable or field âdestroyâ declared void
>>> my_window.cpp:5: error: âGtkWidgetâ was not declared in this scope
>>> my_window.cpp:5: error: âwidgetâ was not declared in this scope
>>> my_window.cpp: In function âint main(int, char**)â:
>>> my_window.cpp:12: error: âgtk_initâ was not declared in this scope
>>> my_window.cpp:13: error: âmain_windowâ was not declared in this scope
>>> my_window.cpp:13: error: âGTK_WINDOW_TOPLEVELâ was not declared in
>>> this scope
>>> my_window.cpp:13: error: âgtk_window_newâ was not declared in this
>>> scope
>>> my_window.cpp:14: error: âGTK_WINDOWâ was not declared in this scope
>>> my_window.cpp:14: error: âgtk_window_set_titleâ was not declared in
>>> this scope
>>> my_window.cpp:15: error: âG_OBJECTâ was not declared in this scope
>>> my_window.cpp:15: error: âdestroyâ was not declared in this scope
>>> my_window.cpp:15: error: âNULLâ was not declared in this scope
>>> my_window.cpp:15: error: âG_CALLBACKâ was not declared in this scope
>>> my_window.cpp:16: error: âGTK_WIDGETâ was not declared in this scope
>>> my_window.cpp:16: error: âgtk_widget_show_allâ was not declared in
>>> this scope
>>> my_window.cpp:17: error: âgtk_mainâ was not declared in this scope
>>>
>>> Regards
>>> Sasank
>>>
>>> -----Original Message-----
>>> From: Alex Chardash [mailto:achardash@xxxxxxxxx]
>>> Sent: Wednesday, December 24, 2008 4:51 PM
>>> To: Sasank Kuntimaddi (WT01 - PES-ADS-IAC Practice)
>>> Subject: Re: Linking problems - newbie problems
>>>
>>> Hi Sasank,
>>>
>>> As far as I understand, with that command your my_window.cpp should be corrupted with the compiler output, since -o option specifies the output module name.
>>>
>>> Please try: gcc -o my_window  my_window.cpp `pkg-config --cflags
>>> --libs gtk+-2.0`
>>>
>>> Thanks,
>>> - Alex.
>>>
>>> 2008/12/24  <sasank.kuntimaddi@xxxxxxxxx>:
>>>
>>>> Hi,
>>>>
>>>> I am new to programming with GTK and am trying to create a small
>>>> test window. I am getting a linker errors. Can someone please
>>>> suggets me a solution for this.
>>>>
>>>> The code is compiled using =>  gcc -o  my_window.cpp `pkg-config
>>>> --cflags --libs gtk+-2.0`
>>>>
_______________________________________________
gnome-list mailing list
gnome-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gnome-list


[Index of Archives]     [Fedora Desktop]     [Trinity Users]     [KDE]     [Gimp]     [Yosemite News]

  Powered by Linux