Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. #include "MathFunctions" highlights with "no such file"
Forum Updated to NodeBB v4.3 + New Features

#include "MathFunctions" highlights with "no such file"

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 2 Posters 1.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    framontb
    wrote on last edited by framontb
    #1

    Hello,
    From a Qt Creator 4.1.0 Based on Qt 5.7.0 (GCC 4.9.1 20140922 (Red Hat 4.9.1-10), 64 bit),
    I create a library: File > New File or Project > Library > C++ Library
    called "MathFunctions" and does't touch a file. So there are the skeleton files, and build them, with the release and debug flavors; all going well without errors.

    Now I create another project: File > New File or Project > Application > Qt Console Application: "MathFunctionsTest"
    After that, right click over the project "MathFunctionsTest" and: Add library > External library

    • selected: Library file; Include path; Linux

    MathFunctionsTest.pro ends up with this snippet inserted:

    unix:!macx: LIBS += -L$$PWD/../../MathFunctions/build-MathFunctions-Desktop_Qt_5_7_0_GCC_64bit-Release/ -lMathFunctions
    
    INCLUDEPATH += $$PWD/../../MathFunctions/build-MathFunctions-Desktop_Qt_5_7_0_GCC_64bit-Release
    DEPENDPATH += $$PWD/../../MathFunctions/build-MathFunctions-Desktop_Qt_5_7_0_GCC_64bit-Release
    
    unix:!macx: PRE_TARGETDEPS += $$PWD/../../MathFunctions/build-MathFunctions-Desktop_Qt_5_7_0_GCC_64bit-Release/libMathFunctions.a
    
    

    Now I go to main.cpp and try to add:

    #include "MathFunctions"
    

    Qt creator highlights with "no such file", but directories and files do exist.

    Please, any ideas?

    Regards

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      Your INCLUDEPATH is likely wrong unless you have your libraries headers in the shadow build where your library is located.

      Just point it to where your library headers are located.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      F 1 Reply Last reply
      3
      • SGaistS SGaist

        Hi and welcome to devnet,

        Your INCLUDEPATH is likely wrong unless you have your libraries headers in the shadow build where your library is located.

        Just point it to where your library headers are located.

        F Offline
        F Offline
        framontb
        wrote on last edited by
        #3

        @SGaist

        Thanks for your reply !

        Yes, you are true. I change the snippet generated by Add library > External library to:

        unix:!macx: LIBS += -L$$PWD/../../MathFunctions/build-MathFunctions-Desktop_Qt_5_7_0_GCC_64bit-Release/ -lMathFunctions
        
        INCLUDEPATH += $$PWD/../../MathFunctions/MathFunctions
        DEPENDPATH += $$PWD/../../MathFunctions/build-MathFunctions-Desktop_Qt_5_7_0_GCC_64bit-Release
        
        unix:!macx: PRE_TARGETDEPS += $$PWD/../../MathFunctions/build-MathFunctions-Desktop_Qt_5_7_0_GCC_64bit-Release/libMathFunctions.a
        

        The headers are in a directory at the same level of builds, with source code called "MathFunctions".
        But problem remains.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          What the exact file path ? Filename included

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          F 1 Reply Last reply
          2
          • SGaistS SGaist

            What the exact file path ? Filename included

            F Offline
            F Offline
            framontb
            wrote on last edited by framontb
            #5

            @SGaist

            Absolute Path to headers:

            /home/ramon/programacion/c++/qt/packBookExamples/mathfunctions/mathfunctions/mathfunctions.h
            

            In .pro:

            INCLUDEPATH += $$PWD/../../mathfunctions/mathfunctions
            

            PD: I rewrite all to lowercase, testing for failures, but still the same problem.

            EDIT:
            In my shadow directory (MathFunctions/build-MathFunctions-Desktop_Qt_5_7_0_GCC_64bit-Release), there are the following files:
            -rw-rw----. 1 ramon ramon 1578 nov 1 22:18 libmathfunctions.a
            -rw-rw----. 1 ramon ramon 30826 nov 1 22:18 Makefile
            -rw-rw----. 1 ramon ramon 1392 nov 1 22:18 mathfunctions.o
            -rw-rw----. 1 ramon ramon 362 nov 1 22:18 .qmake.stash

            EDIT2:
            Solved ! I forget run qmake after changes you suggested. Thanks for your help !

            1 Reply Last reply
            1
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Great !

              Then please mark the thread as solved using the "Topic Tools" button so that other forum users may know a solution has been found :)

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              1

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved