Solved #include "MathFunctions" highlights with "no such file"
-
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
-
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.
-
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. -
What the exact file path ? Filename included
-
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.stashEDIT2:
Solved ! I forget run qmake after changes you suggested. Thanks for your help ! -
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 :)