GTKmm linkerproblem



  • hi,
    ich hab hier ein kleines sample-programm aus 2 Dateien bestehend, welches ein Fenster mit Button erzeugt. Wenn ich das jetzt versuche zu linken (mit ld main.o helloworld.o `pkg-config --libs gtkmm-2.4`), regnet es Fehlermeldungen, wie linkt man sowas korrekt?



  • Du musst neben --libs noch --cflags reinnehmen.



  • GPC, für mich sieht es so aus, als hätte er die beiden Dateien schon kompiliert und will sie jetzt nur noch linken.

    Dann müsste der Aufruf nämlich stimmen.

    mariechen: Zeig am besten mal einen Teil der Fehler, sonst wirds schwer.
    Vielleicht könntest du auch mal den Output von pkg-config --libs gtkmm-2.4 ansehen, und schauen ob alle darin aufgeführte Dateien existieren.



  • The-Kenny schrieb:

    GPC, für mich sieht es so aus, als hätte er die beiden Dateien schon kompiliert und will sie jetzt nur noch linken.

    Dann müsste der Aufruf nämlich stimmen.

    Richtig... hab' ich gar nicht drangedacht, hier wird ja nur gelinkt.



  • Also, das ist der output von "ld helloworld.o main.o `pkg-config --libs gtkmm-2.4`" (den Quellcode hab ich im ersten Beitrag verlinkt, falls sich das mal jemand anschauen will):

    ld: warning: cannot find entry symbol _start; defaulting to 0000000000400cf0
    helloworld.o: In function \_\_static\_initialization\_and\_destruction_0(int, int)': helloworld.cpp:(.text+0x3f): undefined reference to__dso_handle'
    helloworld.cpp:(.text+0x62): undefined reference to \_\_dso\_handle' helloworld.cpp:(.text+0x85): undefined reference to__dso_handle'
    helloworld.cpp:(.text+0xa8): undefined reference to \_\_dso\_handle' helloworld.cpp:(.text+0xcb): undefined reference to__dso_handle'
    helloworld.o:helloworld.cpp:(.text+0xee): more undefined references to \_\_dso\_handle' follow helloworld.o: In functionhelloworld::helloworld()':
    helloworld.cpp:(.text+0x355): undefined reference to VTT for helloworld' helloworld.cpp:(.text+0x36f): undefined reference toVTT for helloworld'
    helloworld.cpp:(.text+0x386): undefined reference to vtable for helloworld' helloworld.cpp:(.text+0x39e): undefined reference tovtable for helloworld'
    helloworld.cpp:(.text+0x445): undefined reference to VTT for helloworld' helloworld.cpp:(.text+0x465): undefined reference toVTT for helloworld'
    main.o: In function \_\_static\_initialization\_and\_destruction_0(int, int)': main.cpp:(.text+0x35): undefined reference to__dso_handle'
    main.cpp:(.text+0x58): undefined reference to \_\_dso\_handle' main.cpp:(.text+0x7b): undefined reference to__dso_handle'
    main.cpp:(.text+0x9e): undefined reference to \_\_dso\_handle' main.cpp:(.text+0xc1): undefined reference to__dso_handle'
    main.o:main.cpp:(.text+0xe4): more undefined references to \_\_dso\_handle' follow main.o: In functionmain':
    main.cpp:(.text+0x26f): undefined reference to helloworld::~helloworld()' main.cpp:(.text+0x28b): undefined reference tohelloworld::~helloworld()'



  • Oh, ich hatte einfach nur den destruktor vergessen *hehe* 🙄


Anmelden zum Antworten