Qt World Summit: Submit your Presentation

Can't find library during compilation

  • Hey,
    I've been trying to run a code for solving the laplacian equation using sparse matrices.

    The code can be found "here":http://eigen.tuxfamily.org/dox-devel/group__TutorialSparse.html under "First example" and the rest of the functions are "here":http://eigen.tuxfamily.org/dox-devel/TutorialSparse_example_details.html.

    A qimage plotting functionality is included to visualise the result.
    I have installed the 5.2.1 version and am currently trying to find where all the header files are so that I can compile the code without a problem. Right now the error that I am getting is:

    "fatal error: QImage: No such file or directory"

    and during compilation I have included: -L /home/andkamen/program_files/Qt5.2.1/5.2.1/gcc/include/QtGui which I belive will tell the compiler where the appropriate headers are.

    My question is, is there a way to include the header files under /usr/local/include as I have included various other header files like the Eigen classes for matrix manipulation?
    Or is the only way to use Qt via the QT creator?

  • welcome to devnet

    You do not give enough details to give a complete answer.

    Assuming that you are starting to use Qt I am suggesting to use also Qt creator. Qt creator is not absolutely required for use of Qt libs and their features, but the Qt creator is an IDE making live a bit easier. The IDE allows adding more external headers and also source code if required.

    With the current information my first guess would be that you are missing out to add gui in qmake. The error message you are showing is probably still from the compilation step.

    If you are using already Qt creator you can check out the .pro file, it should not have a line in there like

    QT -= gui

    core and gui is default for qmake, but if you have
    QT += gui

    this is ok too.

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Both pages you link to only show the "solution". You need to setup a Qt project in order to avoid all these missing includes and the rest. You don't need Qt Creator for that, but it'll make your life easier.

    A simple pro file like that:
    QT += gui core
    INCLUDEPATH += /path/to/eigen/include

    SOURCE += main.cpp your_file.cpp
    HEADER += your_header.h

    Should be enough

    Run qmake, make and you should be good to go

    Hope it helps

  • thanks for the quick replies. I will see what I can do with the information that you provided and If I get stuck again I will post my current progress.

    If I set the file in QT creator can I pass information to it and then run it using a bash file?
    OR if I need can I have function call in my main to functions that are set up in QT creator?

    ps. sorry if my questions are somewhat stupid. I'm still very new to more involved programing projects. Which also explains why I am having a bit of a hard time conveying what exactly I'm trying to ask. :)

Log in to reply