Important: Please read the Qt Code of Conduct -

3rd Part library do not compile with Qt Creator...

  • Hi,

    I am using a 3rd Party library GBDI Arboretum ( in a Qt with OpenGL project. For a time it worked well, but now I need to add some .cpp files and when I compile the project I receive thousands errors like: "multiple definition of" some function....

    I am following an example which uses the same includes, and this example works very well. However this example is not a Qt project, it is only a .cpp file that I compile using: @g++ -I ./arboretum/include/ -I ./arboretum/src/ main-app.cpp@

    So, the problem is not in fact that I have included some .cpp, it is something that Qt is doing...

    I added the INCLUDEPATH in .pro file:
    @INCLUDEPATH += ./arboretum/include/

    Qt can find the library files, but can not compile it correctly.

    I tried everything which I found in Qt help, but nothing worked for me...

    To make sure that the problem is in Qt, I did a test using Netbeans and the same arboretum library and includes. To compile I only had to do was add "arboretum/src" and "arboretum/include" in the include path and it worked well.

    Once again, the problem seems be only in Qt...

    Does anyone have any suggestion?

  • What are the actual error messages? Are they from the compiler or the linker?

  • [quote author="Volker" date="1342122841"]What are the actual error messages? Are they from the compiler or the linker?[/quote]

    I think they are from compiler here is an example:
    @g++ -Wl,-O1 -o Simulador_de_Particulas main.o janelaprincipal.o opengl.o trackball.o fastareader.o clusterclass.o moc_janelaprincipal.o moc_opengl.o qrc_shader.o -L/usr/lib -L/usr/X11R6/lib -lQtOpenGL -lQtGui -lQtCore -lGLU -lGL -lpthread
    janelaprincipal.o: In function stPage::GetPageSize()': janelaprincipal.cpp:(.text+0x0): multiple definition ofstPage::GetPageSize()'
    main.o:main.cpp:(.text+0x0): first defined here
    janelaprincipal.o: In function stPage::GetData()': janelaprincipal.cpp:(.text+0x10): multiple definition ofstPage::GetData()'
    main.o:main.cpp:(.text+0x10): first defined here
    janelaprincipal.o: In function stLockablePage::GetPageSize()': janelaprincipal.cpp:(.text+0x20): multiple definition ofstLockablePage::GetPageSize()'
    main.o:main.cpp:(.text+0x20): first defined here
    janelaprincipal.o: In function stLockablePage::GetData()': janelaprincipal.cpp:(.text+0x30): multiple definition ofstLockablePage::GetData()'
    main.o:main.cpp:(.text+0x30): first defined here@

    and they continue for thousands of lines...

    If you want to see all messages, I uploaded the output from make on my server:

Log in to reply