flat assembler
Message board for the users of flat assembler.

Index > Linux > HELP Compiling

Author
Thread Post new topic Reply to topic
Grincheux



Joined: 15 Apr 2008
Posts: 17
Location: Mathenay, France
Grincheux 29 Apr 2008, 20:16
I am trying to build a program that uses 'g_file_test' function but I get an error while linking. What are the libraries to add ?

Here are the make file and the build result :

====== MAKE FILE =====
Code:
gAE: gAE.o
    gcc -Wall -s -O3  gAE.o -o gAE -L/lib/libglib-2.0.so.0 `gnome-config --cflags gnome gnomeui` `gtk-config --cflags` `gtk-config --libs`
gAE.o: gAE.asm cdecl.inc gtk.inc
      fasm gAE.asm gAE.o
    

===== BUILD RESULT =====
Code:
Exécuter : Construire

Using makefile from ~/Documents/gAE
make: entrant dans le répertoire « /home/Grincheux/Documents/gAE »
gcc -Wall -s -O3  gAE.o -o gAE -L/lib/libglib-2.0.so.0 `gnome-config --cflags gnome gnomeui` `gtk-config --cflags` `gtk-config --libs`
gAE.oSad.text+0x8): undefined reference to `g_file_test'
make: quittant le répertoire « /home/Grincheux/Documents/gAE »
collect2: ld a retourné 1 code d'état d'exécution
make: *** [gAE] Erreur 1
    


===== END OF BUILD RESULT =====

Can someone help me ?

_________________
____________Kenavo_________________

Grincheux
Post 29 Apr 2008, 20:16
View user's profile Send private message Reply with quote
kohlrak



Joined: 21 Jul 2006
Posts: 1421
Location: Uncle Sam's Pad
kohlrak 29 Apr 2008, 20:36
No more giving back...


Last edited by kohlrak on 07 Aug 2008, 14:54; edited 1 time in total
Post 29 Apr 2008, 20:36
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger Reply with quote
Grincheux



Joined: 15 Apr 2008
Posts: 17
Location: Mathenay, France
Grincheux 29 Apr 2008, 20:41
Here is the source file, sorry but the comments are in French.

Here are all the files used stocked into an archive file.

Thanks


Description:
Download
Filename: gAE.tar.gz
Filesize: 2.38 KB
Downloaded: 558 Time(s)


_________________
____________Kenavo_________________

Grincheux
Post 29 Apr 2008, 20:41
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 29 Apr 2008, 20:43
obviously you reference external symbol "g_file_test", which is not defined in any object you link to.
Post 29 Apr 2008, 20:43
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Grincheux



Joined: 15 Apr 2008
Posts: 17
Location: Mathenay, France
Grincheux 29 Apr 2008, 20:49
This symbol is declared into the "Linux.inc" file included from "gAE.inc". This the way to do for any symbol. When linking you just have to add the right library, and it is not what I am doing !
Post 29 Apr 2008, 20:49
View user's profile Send private message Reply with quote
gunblade



Joined: 19 Feb 2004
Posts: 209
gunblade 29 Apr 2008, 21:04
Hey man, theres a typo in your building procedure:
gcc -Wall -s -O3 gAE.o -o gAE -L/lib/libglib-2.0.so.0 `gnome-config --cflags gnome gnomeui` `gtk-config --cflags` `gtk-config --libs`

You should replace that -L/lib/libglib... with `pkg-config --libs glib-2.0` (with the `` quotes)
-L is for specifying directories to look for libraries in, -l is for specifying those actual libraries, and you dont need the .so part of the name, or the directory leading up to it.. just it's name (without the lib part either).

Will try it out to see if it works.

Edit: Just edited my post to have the right code, my first attempt didnt work, in case you read it. So yeah, just use `pkg-config --libs glib-2.0` instead of -L/lib/libglib-2.0.so.0


Last edited by gunblade on 29 Apr 2008, 21:09; edited 1 time in total
Post 29 Apr 2008, 21:04
View user's profile Send private message Reply with quote
Grincheux



Joined: 15 Apr 2008
Posts: 17
Location: Mathenay, France
Grincheux 29 Apr 2008, 21:08
I have re-read the doc about glib and found the answer, I join the new make file.

Thanks for your help


Description: The new make file
Download
Filename: makefile.tar.gz
Filesize: 257 Bytes
Downloaded: 543 Time(s)


_________________
____________Kenavo_________________

Grincheux
Post 29 Apr 2008, 21:08
View user's profile Send private message Reply with quote
gunblade



Joined: 19 Feb 2004
Posts: 209
gunblade 29 Apr 2008, 21:11
Damn, you were too fast Smile

But yeah, -lglib-2.0 will work, its suggested you use `pkg-config --libs glib-2.0`, as it'll include all the other libraries you need too (in this case, it makes sure that it include -liconv, since some parts of glib need it i believe.. although gcc may include it by default, either way.. cant hurt).
Post 29 Apr 2008, 21:11
View user's profile Send private message Reply with quote
Grincheux



Joined: 15 Apr 2008
Posts: 17
Location: Mathenay, France
Grincheux 29 Apr 2008, 21:14
Thanks, but today I don't know all the needed libraries. I spend a lot of time in libraries searching...
Post 29 Apr 2008, 21:14
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.