Frage

so I've been working on a project on the university lab computers, and I want to be able to work on it at home on my laptop. My laptop runs ubuntu 11.10.

I used

sudo apt-get install gnome-core-devel build-essential libgtk2.0-dev libgtk2.0-doc devhelp

and that's all done.

Yet when I try compile my program, it gives me a bunch of

undefined reference to [all the gtk functions]

What's going on here? What am I doing wrong? Program compiles fine on the lab computers. makefile is here http://pastebin.com/H7Pi55NQ

War es hilfreich?

Lösung

The library arguments should now come after the files you want to link or they are ignored:

    $(CC) -o mainout main.o draw.o floyds.o simpletools.o graph.o tads.o bucket.o $(LIBS)

Reason: The new version of GCC that comes in U11.10 passes the --as-needed switch for the linker by default. This means that if the library is not needed by anything that precedes it in the command line it is ignored. You can change this behaviour if you use the --no-as-needed linker switch.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top