Results 1 to 4 of 4

Thread: Link error with Qt 4.8.2 and SOIL

  1. #1
    Join Date
    Nov 2012
    Posts
    18
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Link error with Qt 4.8.2 and SOIL

    I'm using the Simple OpenGL Image Library to load a TGA file and get a GLuint texture ID for use with OpenGL 3.1, rather than through Qt's QImage and QGL wrappers. I added LIBS += C:/Qt/qtcreator-2.5.2/lib/libSOIL.lib and INCLUDEPATH += C:/Qt/qtcreator-2.5.2/include/ to my project's .PRO file. I also put SOIL.h in C:/Qt/qtcreator-2.5.2/include/, and libSOIL.lib in C:/Qt/qtcreator-2.5.2/lib. Lastly, I added #include <SOIL.h> to all headers that required it.

    The project compiles fine if I don't call any SOIL functions. The moment I try to call a SOIL function, though, I get a link error talking about an unresolved external symbol in libSOIL.lib. Has anyone gotten SOIL to link properly with Qt Creator 2.5.2? What could be causing the problem I'm seeing? Are there any other methods of loading a TGA file in Qt, aside from writing my own loader from scratch?

    Is there a way of using Qt to load a tga file and get back a normal GLuint texture ID?
    Last edited by fiodis; 22nd June 2013 at 20:43.

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Link error with Qt 4.8.2 and SOIL

    Qt Creator 2.5.2 is not a compiler or linker. It makes no sense to ask "Has anyone gotten SOIL to link properly with Qt Creator 2.5.2?"

    Remove the files you copied into the Qt directories.

    In your PRO file:
    Qt Code:
    1. SOILPATH = "c:/Simple OpenGL Image Library"
    2. INCLUDEPATH += "$${SOILPATH}/src"
    3. LIBS += -L"$$(SOILPATH)/lib" -lSOIL
    To copy to clipboard, switch view to plain text mode 
    Adjust SOILPATH to point at where you extracted/built the SOIL library. If it still does not link post the actual error messages and tell us what compiler/toolchain you are using.

    A TGA (Targa) file format plugin is part of Qt5. You may be able to easily back port it or simply use Qt5. This will not give you anything direct OpenGL related though.

  3. The following user says thank you to ChrisW67 for this useful post:

    fiodis (23rd June 2013)

  4. #3
    Join Date
    Nov 2012
    Posts
    18
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Link error with Qt 4.8.2 and SOIL

    Making those adjustments fixed the issue, thanks! Quick question: what do the flags in the LIBS += line mean?

  5. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Link error with Qt 4.8.2 and SOIL

    qmake Project Files : Declaring Other Libraries
    The paths to the libraries themselves can be given, or the familiar Unix-style notation for specifying libraries and paths can be used if preferred.
    These are the "familiar Unix-style notation"
    -Lpath: adds a path to the list of paths the linker will search looking for libraries it needs to resolve missing symbols
    -lname: (lower case L) names a library to use when linking the program. On UNIX-like systems (and MingW) the library file is actually named libname.a and on Windows with MSVC the library file is name.lib

Similar Threads

  1. DSO link error in qt 5
    By wxf04125 in forum Qt Programming
    Replies: 0
    Last Post: 2nd June 2013, 18:55
  2. moc link error
    By Zalwou06 in forum Qt Programming
    Replies: 3
    Last Post: 13th September 2012, 03:03
  3. Replies: 11
    Last Post: 5th May 2011, 14:05
  4. Link error
    By emrares in forum Qt Programming
    Replies: 1
    Last Post: 12th November 2010, 13:45
  5. moc link error
    By user_mail07 in forum Qt Programming
    Replies: 3
    Last Post: 3rd July 2007, 19:30

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.