LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-28-2009, 06:13 PM   #1
scarypajamas
LQ Newbie
 
Registered: May 2009
Distribution: Ubuntu
Posts: 15

Rep: Reputation: 0
Problem while compiling Qt App.


I'm using Qt creator and I started a brand new project using file->new->qt4 gui application, and when I hit the compile button, I get this error:

Code:
/usr/bin/ld: cannot find -lgobject-2.0
collect2: ld returned 1 exit status
I haven't made any changes to the code. All I did was make a new project and hit the compile button.

Last edited by scarypajamas; 06-28-2009 at 06:14 PM.
 
Old 06-28-2009, 10:00 PM   #2
axobeauvi
Member
 
Registered: Apr 2003
Posts: 128

Rep: Reputation: 16
I'm not sure what distro you're using but some have separate devel packages.
you might need to see if gobject and gobject-devel are installed (the names might be slightly different depending on the distro)
or you might check your LD_LIBRARY_PATH variable includes the right paths
 
Old 06-28-2009, 10:40 PM   #3
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
Missing 'lgobject-2.0' means that
/usr/lib/libgobject-2.0.so is missing.

'libgobject-2.0.so' is from the package
libglib2.0_0-devel, glib2-devel, libglib2.0-dev :
Different Linux ... different package name.

When a lib is asked for by configuring or
compiling : l<name> = lib<name>.so , which
is always provided by the '-devel' version of
the library in question.
.....

Last edited by knudfl; 06-28-2009 at 10:42 PM.
 
Old 06-29-2009, 12:46 AM   #4
graemef
Senior Member
 
Registered: Nov 2005
Location: Hanoi
Distribution: Fedora 13, Ubuntu 10.04
Posts: 2,379

Rep: Reputation: 148Reputation: 148
Did you install Qt4 from a package manager or from the source (You did install Qt4 didn't you)? If you got it from a package manager then it should have ensured that all the necessary development libraries are also installed, and so that may mean that you have an issue with your path to the libraries.
 
Old 06-29-2009, 08:43 AM   #5
i92guboj
Gentoo support team
 
Registered: May 2008
Location: Lucena, Córdoba (Spain)
Distribution: Gentoo
Posts: 4,083

Rep: Reputation: 405Reputation: 405Reputation: 405Reputation: 405Reputation: 405
Quote:
Originally Posted by knudfl View Post
When a lib is asked for by configuring or
compiling : l<name> = lib<name>.so , which
is always provided by the '-devel' version of
the library in question.
.....
.so files are required for the package to run, hence they usually don't go into -devel packages. -devel stuff packages usually contain header and source files that are needed when compiling, but are not needed to run the final binary.

Note that the error issued above is not from the compiler either, but from the linker (ld). Since the binaries are linked after being compiled, I think that the -devel stuff must be in place. Otherwise he wouldn't be reaching the linking stage at all.

scarypajamas, if the library (.so) file has been installed manually or using a non-standard package into a non-standard location you might need to pass the path to the library to kdevelop. Don't ask me how, it should be configured in some place on the project properties or wherever.

With gcc in command line you would use -L for that.

You might need also to add the path to your LD_LIBRARY_PATH variable if it isn't already there to be able to run the binary file, unless you link it statically.

Last edited by i92guboj; 06-29-2009 at 08:47 AM.
 
Old 10-01-2009, 11:33 AM   #6
pdallas
LQ Newbie
 
Registered: Dec 2007
Posts: 8

Rep: Reputation: 0
I had the same problem. I think it is just a "silly" with some distros.
Install package "glib2-devel", and it should work fine.
This is what happens:
- Package libgobject_2-0 actually contains /usr/lib/libgobject-2.0.so. However this is not enough, you also need a file called /usr/lib/libgobject-2.0.a.
- This libgobject-2.0.a file is actually contained in package "glib2-devel", for some obscure reason.
Good luck, do let us know if it worked!

Last edited by pdallas; 10-01-2009 at 11:38 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
cross-compiling a gtk app with glade-3 jiml8 Programming 3 04-11-2009 03:53 PM
Cross-compiling directx app for win32 entz Programming 0 05-10-2007 08:05 AM
Problem Compiling a GTK App (G2IPMSG) in Slackware11 duryodhan Slackware 2 03-03-2007 12:37 PM
compiling gtk1 app against gtk2 cs-cam Linux - Newbie 3 01-11-2005 02:53 AM
probs with compiling kdevelop app joeman3429 Programming 1 08-27-2004 07:41 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 01:11 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration