I downloaded a project named MVCClone from github. It's a QT project that needs CGAL to run. I installed boost and CGAL on my Windows 10. QT 5.5.1 mingw is installed.
When I build the project I get the error:
boost/config.hpp: No such file or directory
in one of CGAL header files.
Here is the .pro file for QT project:
QT += core gui opengl
TARGET = MVCDemo
TEMPLATE = app
SRC_DIR = $${PWD}/src
SOURCES += $${SRC_DIR}/glwidget.cpp \
$${SRC_DIR}/main.cpp \
$${SRC_DIR}/mainwindow.cpp \
$${SRC_DIR}/MVCCloner.cpp \
$${SRC_DIR}/sourcewidget.cpp \
$${SRC_DIR}/utils.cpp
HEADERS += $${SRC_DIR}/CloningParameters.h \
$${SRC_DIR}/CoordinatesMesh.h \
$${SRC_DIR}/glwidget.h \
$${SRC_DIR}/mainwindow.h \
$${SRC_DIR}/mvcshaders.h \
$${SRC_DIR}/MVCCloner.h \
$${SRC_DIR}/sourcewidget.h \
$${SRC_DIR}/utils.h
## using pkg-config
#linux {
# CONFIG += link_pkgconfig
# PKGCONFIG += glu
#}
# CGAL
*-g++* {
QMAKE_CXXFLAGS += -frounding-math
}
LIBS += -lCGAL -lgmp
RESOURCES += images/images.qrc \
src/shaders.qrc
LIBS += "C:/dev/CGAL-4.8.1/lib/release/CGAL_Core-vc140-mt-4.8.1.lib"
INCLUDEPATH += "C:/dev/CGAL-4.8.1/include"
LIBS+="C:\local\boost_1_61_0\lib64-msvc-14.0"
INCLUDEPATH +="C:/local/boost_1_61_0/lib64-msvc-14.0"
Also I can't #include any boost headers in the project.
INCLUDEPATH +="C:/local/boost_1_61_0/lib64-msvc-14.0"
should be:
INCLUDEPATH +="C:/local/boost_1_61_0/"
there you will find a folder named boost containing all headers.
Related
In QT Creator I decided to create autotest project where my tests will sit. My first step was to make my main project subdirs,but when I added the subdirs template , project won't build. It seems all classes which inherit from QObject are now "unknown type".
Here is my main project .pro file:
QT += quick
QT += core gui
QT += network
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TEMPLATE = subdirs
# the line above breaks project. Whithout it project compiles...
CONFIG += c++11 qml_debug declarative_debug console
win32 {
LIBS += -lws2_32
}
# You can make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
SOURCES += \
applicationservice.cpp \
blinkingtimer.cpp \
shapes/genericshape.cpp \
shapes/circle.cpp \
shapes/textprint.cpp \
shapes/tracksection.cpp \
shapes/triangle.cpp \
main.cpp \
shapes/square.cpp \
shapes/trainsignal.cpp \
cliarguments.cpp \
guimanager.cpp \
desktopgeometry.cpp \
tinyxml2/tinyxml2.cpp
RESOURCES += qml.qrc
# Additional import path used to resolve QML modules in Qt Creator's code model
QML_IMPORT_PATH =
# Additional import path used to resolve QML modules just for Qt Quick Designer
QML_DESIGNER_IMPORT_PATH =
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target
DISTFILES +=
HEADERS += \
applicationservice.h \
blinkingtimer.h \
customtypes.h \
shapes/genericshape.h \
shapes/circle.h \
shapes/textprint.h \
shapes/tracksection.h \
shapes/triangle.h \
shapes/square.h \
shapes/trainsignal.h \
cliarguments.h \
guimanager.h \
desktopgeometry.h \
tinyxml2/tinyxml2.h
A project cannot be both subdirs and app at the same time, which is what you're trying here.
The best way would be to move your main project into a subfolder (I've called it "App" here), same as your tests project ("Tests"). You then add an overarching subdirs project in the root folder:
Folder structure:
Rootdir/
|-- RootProject.pro
|-- App/
|-- App.pro
|-- <source files etc>
|-- Tests/
|-- Tests.pro
|-- <source files etc>
RootProject.pro
TEMPLATE = subdirs
SUBDIRS += \
App \
Tests \
I use Qt5.12.0, Qt Creator 4.8.0. So it doesn't contain QFtp but I need to use it. So I follow the way I found on the Internet, I put the .h, .lib, .prl, .dll files of Qt5Ftp to the corresponding directories in 'Qt\Qt5.12.0\5.12.0\msvc2017_64'. Then I built my project, the compiling process is successful, but there's an error in the linking process—
LINK : fatal error LNK1181: cannot open input file 'Qt5Ftp.obj'
I'd tried to rerun qmake, clean all, rebuild all, etc, everything I could try, but I still got this error.
Here's the content of the .pro file of my project—
QT += core gui network webenginewidgets
CONFIG += c++11
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
include(qtsingleapplication/src/qtsingleapplication.pri)
TARGET = YunQuBrowser
TEMPLATE = app
DEFINES += QT_DEPRECATED_WARNINGS
SOURCES += main.cpp\
mainwindow.cpp \
webview.cpp \
webpage.cpp \
ftpclient.cpp \
logfile.cpp \
cmdconfig.cpp
HEADERS += mainwindow.h \
webview.h \
webpage.h \
ftpclient.h \
logfile.h \
cmdconfig.h \
common.h
INCLUDEPATH += ./include
FORMS += mainwindow.ui
RESOURCES += \
YunQuBrowser.qrc \
RC_FILE = YunQuBrowserDesktopIcon.rc
CONFIG(debug, debug|release) {
LIBS += Qt5Ftpd
} else {
LIBS += Qt5Ftp
}
The last comment I post contains a mistake. The correct way is to change the whole CONFIG block into LIBS += -L"QFtp/qtftp_lib", which should be a directory, but not a path of a .lib file.
I am using qtcreator with subdir project structure. The case is that:
I have 2 projects. Project A and B. After A compiles, then B, but in B, I must use the headers of A (classes, functions, etc.). I`ve found in wiki the depends and subdir project setup, but when I try to include class A from project A into class B into project B ( these names are for convininece ) it gives me undefined referencies. Here is my .pro file from main project (and subprojects respectively ):
#base pro file
TEMPLATE = subdirs
SUBDIRS += \
message \
daemon \
receiver
daemon.subdir = daemon
message.subdir = message
daemon.depends = message
subproject A:
TEMPLATE = app
CONFIG += console c++11
CONFIG -= app_bundle
CONFIG -= qt
SOURCES += main.cpp \
daemon.cpp \
logwriter.cpp
HEADERS += \
daemon.h \
logwriter.h \
defs.h
LIBS += -lpthread
subproject B:
TEMPLATE = app
CONFIG += console c++11
CONFIG -= app_bundle
CONFIG -= qt
SOURCES += \
message.cpp \
main.cpp
HEADERS += \
message.h
So I need the project B classes into project A and further on when I extend the project.
Regards.
EDIT: A .pri example would be appreciated, if I'm going to set project A to be a library (-lclssA )
"undefined references" are generally link problems, not header include problems. You may have to link your project A with B if you need to use it.
e.g in A :
LIBS += ../path/to/libB.so
The simplest way is to include it as a lib, the easiest way was from qtcreator, rightclick on the dependee and "Add library" -> "Existing library from build tree". This will generate the following in the .pro:
win32:CONFIG(release, debug|release): LIBS += -L$$OUT_PWD/../message/release/ -lmessage
else:win32:CONFIG(debug, debug|release): LIBS += -L$$OUT_PWD/../message/debug/ -lmessage
else:unix: LIBS += -L$$OUT_PWD/../message/ -lmessage
INCLUDEPATH += $$PWD/../message
DEPENDPATH += $$PWD/../message
However I am losing the ability to make tests for my message class in it's main class. So if there is a better way, I'd accept it.
I have been tasked with converting a project that was built in QtCreator to .NET
The first thing I am trying to do is build the project in QtCreator so that I can step thru its execution to follow the flow and see some of the variables at play (real values).
When I build, I get a lot of errors like this:
error: C1083: Cannot open include file: 'QFrame': No such file or directory
error: C1083: Cannot open include file: 'QMainWindow': No such file or directory
error: C1083: Cannot open include file: 'QSpinBox': No such file or directory
When I search my drive, I do find 'QFrame', but in paths that have things like this in them:
android_armv7
msvc2013_64
winphone_x86
winrt_x64
Here is my .pro file
TEMPLATE = app
CONFIG *= warn_on
CONFIG(debug, debug|release): CONFIG *= console
QT += widgets
#------------------------------------------------------------
# Source Files
#------------------------------------------------------------
FORMS += \
GUIDemo.ui \
Registration.ui \
HEADERS += \
CustomFrames.h \
GUIDemo.h \
MultiRadar.h \
QControlUtils.h \
ScannerInfo.h \
TabAdvanced.h \
TabBScan.h \
TabGuardZone.h \
TabImage.h \
TabInstallation.h \
TabPPI.h \
TabTargets.h \
SOURCES += \
CustomFrames.cpp \
GUIDemo.cpp \
MultiRadar.cpp \
QControlUtils.cpp \
ScannerInfo.cpp \
TabAdvanced.cpp \
TabBScan.cpp \
TabGuardZone.cpp \
TabImage.cpp \
TabInstallation.cpp \
TabPPI.cpp \
TabTargets.cpp \
main.cpp \
#------------------------------------------------------------
# Include directories
#------------------------------------------------------------
INCLUDES = \
../../include \
#------------------------------------------------------------
# UI Generation
#------------------------------------------------------------
CONFIG(debug, debug|release): TARGET_DIR = debug
CONFIG(release, debug|release): TARGET_DIR = release
UI_DIR = GeneratedFiles
MOC_DIR = $${UI_DIR}/$${TARGET_DIR}
INCLUDEPATH += $${UI_DIR}
#------------------------------------------------------------
# Libraries
#------------------------------------------------------------
LIBS += \
-L../../lib/$${TARGET_DIR} \
-lNRPClient \
-lNRPPPI \
#------------------------------------------------------------
# Final config
#------------------------------------------------------------
#set the qmake variables
DEPENDPATH += $$INCLUDES
INCLUDEPATH += $$INCLUDES
The folder indicated by INCLUDES is there and contains a bunch of project-specific header files.
I have a feeling that I am missing some part of QtCreator that would allow me to build for Win7.
Qt Creator is just the IDE. You need to have installed the Qt libraries as well, so make sure you have them.
These errors suggest that the project's .pro file should add the widgets module:
QT += widgets
This makes sure the project includes the right include directories (the ones that have QFrame and such) and library directories on Qt 5.x.
EDIT:
After a little bit of chat, we discovered that Qt SDK for MS2010 was installed, but since the OP had MS2013 on his box, what solved the problem was downloading and installing Qt SDK for MS2013.
I want to develop a Qt GUI application with MongoDB serving as the back-end database. So I need to use MongoDB C driver or C++ driver.
Truth be told, it's kind of difficult to build a C++ driver under Windows. When I do "scons", it can't find boost and I have installed boost. I don't know why.
So I choose MongoDB C driver. When I did "scons", it went all well and generated four files (bson.lib, bson.dll, mongoc.lib, mongoc.dll). But I don't know exactly how to use these libs and DLL's to make it work in Qt Creator.
I haven't done the C driver, but I'm in the process of doing the C++ one with Qt Creator. You need to include the boost libraries in your project, and--for the version of MongoDB client C++ that I downloaded anyway--they need to be the Boost 1.49 libraries, no more and no less. Download it and just have it build all the libraries, even though you only need about four of them for this. The following is the relevant code from my Qt Creator .pro file, and note that everything in my C:/MongoDB folder is downloaded from the MongoDB source, or at least built by scons from that direct download.
INCLUDEPATH += C:/MongoDB/src \
C:/MongoDB/src/mongo/client \
C:/MongoDB/src/third_party/boost \
C:/MongoDB/src/third_party/boost/boost \
C:/MongoDB/src/mongo \
C:/MongoDB/src/third_party/boost/boost/algorithm \
C:/MongoDB/src/third_party/boost/boost/asio \
C:/MongoDB/src/third_party/boost/boost/bind \
C:/MongoDB/src/third_party/boost/boost/concept \
C:/MongoDB/src/third_party/boost/boost/config \
C:/MongoDB/src/third_party/boost/boost/container \
C:/MongoDB/src/third_party/boost/boost/date_time \
C:/MongoDB/src/third_party/boost/boost/detail \
C:/MongoDB/src/third_party/boost/boost/exception \
C:/MongoDB/src/third_party/boost/boost/filesystem \
C:/MongoDB/src/third_party/boost/boost/function \
C:/MongoDB/src/third_party/boost/boost/functional \
C:/MongoDB/src/third_party/boost/boost/integer \
C:/MongoDB/src/third_party/boost/boost/io \
C:/MongoDB/src/third_party/boost/boost/iterator \
C:/MongoDB/src/third_party/boost/boost/math \
C:/MongoDB/src/third_party/boost/boost/move \
C:/MongoDB/src/third_party/boost/boost/mpl \
C:/MongoDB/src/third_party/boost/boost/numeric \
C:/MongoDB/src/third_party/boost/boost/optional \
C:/MongoDB/src/third_party/boost/boost/pending \
C:/MongoDB/src/third_party/boost/boost/preprocessor \
C:/MongoDB/src/third_party/boost/boost/program_options\
C:/MongoDB/src/third_party/boost/boost/random \
C:/MongoDB/src/third_party/boost/boost/range \
C:/MongoDB/src/third_party/boost/boost/regex \
C:/MongoDB/src/third_party/boost/boost/smart_ptr \
C:/MongoDB/src/third_party/boost/boost/spirit \
C:/MongoDB/src/third_party/boost/boost/system \
C:/MongoDB/src/third_party/boost/boost/test \
C:/MongoDB/src/third_party/boost/boost/thread \
C:/MongoDB/src/third_party/boost/boost/tuple \
C:/MongoDB/src/third_party/boost/boost/type_traits \
C:/MongoDB/src/third_party/boost/boost/typeof \
C:/MongoDB/src/third_party/boost/boost/units \
C:/MongoDB/src/third_party/boost/boost/unordered \
C:/MongoDB/src/third_party/boost/boost/utility \
DEFINES += _UNICODE \
SYM_STATICLIB
QMAKE_CFLAGS_RELEASE += /MT
QMAKE_CXXFLAGS_RELEASE += /MT
QMAKE_CFLAGS_DEBUG += /MTd
QMAKE_CXXFLAGS_DEBUG += /MTd
LIBS += -L$$PWD/../../../../../../MongoDB/src/third_party -lWS2_32
LIBS += -L$$PWD/../../../../../../MongoDB/src/third_party -lDbgHelp
CONFIG(debug, debug|release) {
LIBS += -LC:\MongoDB\build\win32\debug\client_build -lmongoclient
LIBS += -L$$PWD/../../../../../../Boost/1.49/bin.v2/libs/thread/build/msvc-10.0/debug/link-static/runtime-link-static/threading-multi/ -llibboost_thread-vc100-mt-sgd-1_49
LIBS += -L$$PWD/../../../../../../Boost/1.49/bin.v2/libs/date_time/build/msvc-10.0/debug/link-static/runtime-link-static/threading-multi/ -llibboost_date_time-vc100-mt-sgd-1_49
LIBS += -L$$PWD/../../../../../../Boost/1.49/bin.v2/libs/system/build/msvc-10.0/debug/link-static/runtime-link-static/ -llibboost_system-vc100-sgd-1_49
LIBS += -L$$PWD/../../../../../../Boost/1.49/bin.v2/libs/filesystem/build/msvc-10.0/debug/link-static/runtime-link-static/ -llibboost_filesystem-vc100-sgd-1_49
}
CONFIG(release, debug|release) {
LIBS += -LC:\MongoDB\build\win32\release\client_build -lmongoclient
LIBS += -L$$PWD/../../../../../../Boost/1.49/bin.v2/libs/thread/build/msvc-10.0/release/link-static/runtime-link-static/threading-multi/ -llibboost_thread-vc100-mt-s-1_49
LIBS += -L$$PWD/../../../../../../Boost/1.49/bin.v2/libs/date_time/build/msvc-10.0/release/link-static/runtime-link-static/threading-multi/ -llibboost_date_time-vc100-mt-s-1_49
LIBS += -L$$PWD/../../../../../../Boost/1.49/bin.v2/libs/system/build/msvc-10.0/release/link-static/runtime-link-static/ -llibboost_system-vc100-s-1_49
LIBS += -L$$PWD/../../../../../../Boost/1.49/bin.v2/libs/filesystem/build/msvc-10.0/release/link-static/runtime-link-static/ -llibboost_filesystem-vc100-s-1_49
}
Note that Qt is known to misbehave when built against static C++ runtimes, so it's probably best to follow the advice I was given here and wrap the driver in a non-Qt C++ dll which is built against static runtimes, and then use that dll inside the main Qt app which would be built against the dynamic runtimes.
Also note that I had to manually copy the winsock and help libs into a root folder and include them manually because Qt Creator wouldn't accept the "Program Files (x86)" path since it had spaces in it.
I realize this isn't a "Mongo C" answer, but you did mention that you're only using the C driver out of frustration getting the C++ one to work, so I thought I'd share what I know.