Permalink
Browse files

gcc seems to want the libraries at the end of the command line

  • Loading branch information...
1 parent 470cd7f commit de4ca29311de8cc70cd8560db1953f6716fb568d @gvissers gvissers committed Nov 22, 2011
Showing with 1 addition and 1 deletion.
  1. +1 −1 map_editor/Makefile.linux
@@ -86,7 +86,7 @@ all: $(EXE)
$(EXE): $(OBJS)
@echo " LINK $(EXE)"
- @$(LINK) $(CFLAGS) $(LIBS) $(GTK2_LIBS) -o $@ $^
+ @$(LINK) $(CFLAGS) -o $@ $^ $(LIBS) $(GTK2_LIBS)
release:
make -f Makefile.linux 'CFLAGS=$(_CFLAGS)'

6 comments on commit de4ca29

Collaborator

pjbroad replied Nov 22, 2011

That was not a problem for me! Which version of gcc are you using?

Collaborator

gvissers replied Nov 23, 2011

I've always had this problem, and I've never understood why. I'm using the default gcc that comes with Ubuntu 11.10:

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.6.1/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.6.1-9ubuntu3' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++,go --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-plugin --enable-objc-gc --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.6.1 (Ubuntu/Linaro 4.6.1-9ubuntu3) 
Collaborator

gvissers replied Nov 23, 2011

According to http://gcc.gnu.org/onlinedocs/gcc/Link-Options.html , the order does make a difference:

It makes a difference where in the command you write this option; the linker searches and processes libraries and object files in the order they are specified. Thus, foo.o -lz bar.o' searches libraryz' after file foo.o but before bar.o. If bar.o refers to functions in `z', those functions may not be loaded.

Owner

raduprv replied Nov 23, 2011

Collaborator

pjbroad replied Nov 23, 2011

One last comment then:(
You can turn off notifications in your account settings; the control is quite fine grained too. It does seem a shame not to use the social aspects of gitHub as they are very nice. Being able to discuss a particular commit like this is very useful and would be extremely clunky on the forums. Of course, more significant programming discussion would be better done on the forums.

Owner

raduprv replied Nov 23, 2011

Please sign in to comment.