I have tried this on multiple platforms, experiencing the same issue every time.
I successfully build and run my C++ OpenFrameworks application using QtCreator - no problems are encountered.
Then, I successfully use qmake to generate the project file.
Yet when I attempt to make the executable, I receive the following error:
make
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -c -pipe -stdlib=libc++ -O2 -std=gnu++1z -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk -mmacosx-version-min=12 -Wall -Wextra -fPIC -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -I. -I. -I/opt/homebrew/lib/QtGui.framework/Headers -I/opt/homebrew/lib/QtCore.framework/Headers -I. -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/Library/Frameworks/OpenGL.framework/Headers -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/Library/Frameworks/AGL.framework/Headers -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/Library/Frameworks/OpenGL.framework/Headers -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/Library/Frameworks/AGL.framework/Headers -I/opt/homebrew/share/qt/mkspecs/macx-clang -F/opt/homebrew/lib -o main.o src/main.cpp
src/main.cpp:1:10: fatal error: 'ofMain.h' file not found
#include "ofMain.h"
^~~~~~~~~~
1 error generated.
make: *** [main.o] Error 1
I can go into the .pro file and add things to the include path manually, but I don't see why these includes aren't generated automatically?
I think I recognized your problem.
The file name is main.cpp in the src/ folder. Based on its location in the src/ folder, I think your ofMain.h file is also in the src/ folder. Now a question: did you add src/ to your include path? If not with the following line:
INCLUDEPATH += \
src/
It should work now I hope.
Have a nice day!
Related
I have a directory with Qt 5.15 for gcc_64 on Ubuntu. I know I need to link the proper .so (or .la?) file in the lib subdirectory and include the headers from the include directories. I would need to do this for several Qt modules. This is my second day using Linux and Bazel, and I'm not sure how to get a basic build setup going. I have tried using cc_import and cc_library so far without sucess.
I know everything is done automatically for you when using Qt Creator, but I am using Visual Sudio Code with a the Bazel build system for integration of other projects.
Here is a piece of the compiler input for a sample project when using Qt Creator.
g++ -c -pipe -g -Wall -Wextra -D_REENTRANT -fPIC -DQT_QML_DEBUG
-DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../addressbook -I. -I/home/joseph/Qt/5.15.0/gcc_64/include -I/home/joseph/Qt/5.15.0/gcc_64/include/QtWidgets -I/home/joseph/Qt/5.15.0/gcc_64/include/QtGui -I/home/joseph/Qt/5.15.0/gcc_64/include/QtCore -I. -isystem /usr/include/libdrm -I/home/joseph/Qt/5.15.0/gcc_64/mkspecs/linux-g++
-o addresswidget.o ../addressbook/addresswidget.cpp
I see macros, includes, and libraries added. What is all the other stuff?
An alternate route I have decided is to build a library out of a qt project and use that with Bazel. With this, how would I access GUI objects? Would I have signal and slots?
I am trying to set up Travis-CI to build this R package. The package builds locally with the following steps that closely mirror the build process on Travis (failed build here):
git clone --depth=50 --branch=master https://github.com/weinstockj/htslibr.git weinstockj/htslibr
cd weinstockj/htslibr/
git submodule update --init --recursive
cd htslibr/
R -e 'install.packages("Rcpp")'
R CMD build .
Travis fails with an error that suggests it cannot find a header file that is in a sub-directory of htslibr/src. Why does R CMD build fail to find the header on Travis (again, no issue locally)?
Travis set up is here , and locally I am also using Ubuntu 16.04.
Here an extract from the failed build log:
mkdir -p /tmp/Rtmpy1bhv4/Rinst23036acf1e4/htslibr/inst/include
cp htslib/htslib/*.h /tmp/Rtmpy1bhv4/Rinst23036acf1e4/htslibr/inst/include
g++ -std=gnu++11 -I"/home/travis/R-bin/lib/R/include" -DNDEBUG -I"/usr/local/lib/R/site-library/Rcpp/include" -I/home/travis/R-bin/include -fpic -g -O2 -c RcppExports.cpp -o RcppExports.o
g++ -std=gnu++11 -I"/home/travis/R-bin/lib/R/include" -DNDEBUG -I"/usr/local/lib/R/site-library/Rcpp/include" -I/home/travis/R-bin/include -fpic -g -O2 -c util.cpp -o util.o
util.cpp:2:24: fatal error: htslib/hts.h: No such file or directory
We see that while the headers are copied to /tmp/Rtmpy1bhv4/Rinst23036acf1e4/htslibr/inst/include, this directory is not on the include path. You can fix this by adding
PKG_CPPFLAGS = -I../inst/include -DSTRICT_R_HEADERS
to Makevars (STRICT_R_HEADERS is not needed but "best practice") and using #include <hts.h> in util.cpp. However, I am not convinced that it is correct to copy the header files to inst/include in the first place. After all, these header files do not represent an API that your packge is providing to other packages. Instead, it is the API of a library that you package uses internally. I would therefore suggest to not copy the header files and use
PKG_CPPFLAGS = -Ihtslib -DSTRICT_R_HEADERS
in Makevars.
BTW, Writing R Extensions advocates a different usage pattern for the targets:
all: $(SHLIB)
$(SHLIB): <any other needed targets>
Though this point is irrelevant if you follow my suggestion to not copy the headers.
I'm testing a Cute report writer, working with QT. My problem is that when i add the include directory to the .pro file i get the following error:
11:50:41: Running steps for project ReportTest...
11:50:41: Starting: "C:\Qt\5.9.1\mingw53_32\bin\qmake.exe" C:\Users\dkolb\Documents\Develop\test\ReportTest\ReportTest.pro -spec win32-g++
Info: creating stash file C:\Users\dkolb\Documents\Develop\test\build-ReportTest-Desktop_Qt_5_9_1_MinGW_32bit-Release\.qmake.stash
11:50:44: The process "C:\Qt\5.9.1\mingw53_32\bin\qmake.exe" exited normally.
11:50:44: Starting: "C:\Qt\Tools\mingw530_32\bin\mingw32-make.exe" qmake_all
mingw32-make: Nothing to be done for 'qmake_all'.
11:50:48: The process "C:\Qt\Tools\mingw530_32\bin\mingw32-make.exe" exited normally.
11:50:48: Starting: "C:\Qt\Tools\mingw530_32\bin\mingw32-make.exe"
C:/Qt/Tools/mingw530_32/bin/mingw32-make -f Makefile.Release
mingw32-make[1]: Entering directory 'C:/Users/dkolb/Documents/Develop/test/build-ReportTest-Desktop_Qt_5_9_1_MinGW_32bit-Release'
'C:\Qt\5.9.1\mingw53_32\bin\uic.exe' ../ReportTest/mainwindow.ui -o ui_mainwindow.h
g++ -c -fno-keep-inline-dllexport -pipe -O2 -std=gnu++11 -Wextra -Wall -W -fexceptions -mthreads -DUNICODE -DQT_DEPRECATED_WARNINGS -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I../ReportTest -I. -I"C:/Program Files (x86)/ExaroLogic/CuteReport/development/include/cutereport" -IC:/Qt/5.9.1/mingw53_32/include -IC:/Qt/5.9.1/mingw53_32/include/QtWidgets -IC:/Qt/5.9.1/mingw53_32/include/QtGui -IC:/Qt/5.9.1/mingw53_32/include/QtANGLE -IC:/Qt/5.9.1/mingw53_32/include/QtCore -Irelease -I. -IC:/Qt/5.9.1/mingw53_32/mkspecs/win32-g++ -o release/main.o ../ReportTest/main.cpp
Makefile.Release:346: recipe for target 'release/main.o' failed
mingw32-make[1]: Leaving directory 'C:/Users/dkolb/Documents/Develop/test/build-ReportTest-Desktop_Qt_5_9_1_MinGW_32bit-Release'
Makefile:36: recipe for target 'release' failed
mingw32-make[1]: *** [release/main.o] Error -1073741502
mingw32-make: *** [release] Error 2
11:50:58: The process "C:\Qt\Tools\mingw530_32\bin\mingw32-make.exe" exited with code 2.
Error while building/deploying project ReportTest (kit: Desktop Qt 5.9.1 MinGW 32bit)
When executing step "Make"
11:50:58: Elapsed time: 00:17.
For testing I'm using an empty gui application.It does compile when i take the include out.
I have download the 32bit version of the report writer as i'm compiling on 32bits, but i don't think that QT is even near the dlls. Here is the .pro file:
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = ReportTest
TEMPLATE = app
INCLUDEPATH += "C:/Program Files (x86)/ExaroLogic/CuteReport/development/include/cutereport"
# The following define makes your compiler emit warnings if you use
# any feature of Qt which as been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS
# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \
main.cpp \
mainwindow.cpp
HEADERS += \
mainwindow.h
FORMS += \
mainwindow.ui
I tried the instructions of building latest QT5-Alpha(http://qt-project.org/wiki/Qt-5-Alpha
http://qt-project.org/wiki/Building_Qt_5_from_Git)
from GIT,but facing compilation in wayland files
Ubuntu Linux 11.10
__make[4]: Entering directory `/home/xyz/build/newqt5/qt5/qtwayland/src/plugins/platforms/wayland'
g++ -c -pipe -g -fvisibility=hidden -fvisibility-inlines-hidden -D_REENTRANT -Wall -W -fPIC -DQT_NO_LIBUDEV -DQ_PLATFORM_WAYLAND -DQT_NO_WAYLAND_XKB -DQT_WAYLAND_GL_SUPPORT -DQT_WAYLAND_WINDOWMANAGER_SUPPORT -DQ_FONTCONFIGDATABASE -DQT_COMPILES_IN_HARFBUZZ -DQT_PLUGIN -DQT_GUI_LIB -DQT_CORE_LIB -I/home/xyz/build/newqt5/qt5/qtbase/mkspecs/linux-g++ -I. -I/home/xyz/build/newqt5/qt5/qtbase/include/QtCore/5.0.0 -I/home/xyz/build/newqt5/qt5/qtbase/include/QtCore/5.0.0/QtCore -I/home/xyz/build/newqt5/qt5/qtbase/include/QtCore -I/home/xyz/build/newqt5/qt5/qtbase/include/QtGui/5.0.0 -I/home/xyz/build/newqt5/qt5/qtbase/include/QtGui/5.0.0/QtGui -I/home/xyz/build/newqt5/qt5/qtbase/include/QtGui -I/home/xyz/build/newqt5/qt5/qtbase/include/QtPlatformSupport/5.0.0 -I/home/xyz/build/newqt5/qt5/qtbase/include/QtPlatformSupport/5.0.0/QtPlatformSupport -I/home/xyz/build/newqt5/qt5/qtbase/include/QtPlatformSupport -I/home/xyz/build/newqt5/qt5/qtbase/include -I../../../shared -Igl_integration/xcomposite_share -I.moc/debug-shared -o .obj/debug-shared/qwaylandintegration.o qwaylandintegration.cpp
In file included from qwaylandshmwindow.h:45:0,
from qwaylandintegration.cpp:46:
qwaylandwindow.h:112:18: error: ‘wl_callback_listener’ does not name a type
make[4]: *** [.obj/debug-shared/qwaylandintegration.o] Error 1_
Any pointers to overcome this?
Download the alpha source package here: http://releases.qt-project.org/qt5.0/alpha/ and use the steps in README file.
The master in git is NOT what was released as alpha. The build scripts are different. You have to wait for them to add alpha tag to pull it from git. But why not just grab the gz file?
I built a Qt project in Debug mode with Qt Creator, ran Callgrind to generate profiling data and tried loading it into Cachegrind. I noticed that I only see profiling information for Qt classes, so I figured I must have forgotten to turn on a crucial flag.
Qt Creator's qmake command looks like this:
qmake /path/to/project/MyProject/MyProject.pro -r -spec linux-g++-64 CONFIG+=debug
Sample compile output for one file:
g++ -c -m64 -pipe -g -Wall -W -D_REENTRANT -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++-64 -I../Flowchart -I/usr/include/QtCore -I/usr/include/QtGui -I/usr/include -I. -I. -I../Flowchart -I. -o main.o ../Flowchart/main.cpp
The -g flag is there, so debug information should be available. I verified this by running gdb on the executable and trying to look at some random source code with l.
The Callgrind command I used was:
valgrind --tool=callgrind ./MyProject
What am I missing here?
You should do:
valgrind --tool=callgrind --trace-children=yes --demangle=yes ./MyProject
Also depending on the distribution of Linux you may have to make sure that you have the Debug information in the QT libraries you are linking against.