An undefined reference error on minGW 8.1 in Qt 5.15.2 with any build-up in VS2015. With mvsc 2015 and 2017, the compiler works fine, but with minGW, it gives an error on undefined reference. What needs to be done to make it work on minGW too? Has anyone come across this?
.pro file:
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
CONFIG += c++11
PRODDIR = "../.."
SOURCES += "$${PRODDIR}/include/qsecureblackbox.cpp" main.cpp archivewriter.cpp certificate.cpp filetablemodel.cpp newarchive.cpp openarchive.cpp progress.cpp
HEADERS += "$${PRODDIR}/include/qarchivereader.h" "$${PRODDIR}/include/qarchivewriter.h" "$${PRODDIR}/include/qasicsigner.h" "$${PRODDIR}/include/qasicverifier.h" "$${PRODDIR}/include/qauthenticator.h" "$${PRODDIR}/include/qauthenticodesigner.h" "$${PRODDIR}/include/qauthenticodeverifier.h" "$${PRODDIR}/include/qcadessigner.h" "$${PRODDIR}/include/qcadesverifier.h" "$${PRODDIR}/include/qcertificatemanager.h" "$${PRODDIR}/include/qcertificatestorage.h" "$${PRODDIR}/include/qcertificatevalidator.h" "$${PRODDIR}/include/qcrlmanager.h" "$${PRODDIR}/include/qcryptokeymanager.h" "$${PRODDIR}/include/qcryptokeystorage.h" "$${PRODDIR}/include/qdcauth.h" "$${PRODDIR}/include/qdcauthwebserver.h" "$${PRODDIR}/include/qdtlsclient.h" "$${PRODDIR}/include/qdtlsserver.h" "$${PRODDIR}/include/qftpclient.h" "$${PRODDIR}/include/qftpserver.h" "$${PRODDIR}/include/qhashfunction.h" "$${PRODDIR}/include/qhttpclient.h" "$${PRODDIR}/include/qhttpserver.h" "$${PRODDIR}/include/qimapclient.h" "$${PRODDIR}/include/qkmipclient.h" "$${PRODDIR}/include/qkmipserver.h" "$${PRODDIR}/include/qmailreader.h" "$${PRODDIR}/include/qmailwriter.h" "$${PRODDIR}/include/qmessagecompressor.h" "$${PRODDIR}/include/qmessagedecompressor.h" "$${PRODDIR}/include/qmessagedecryptor.h" "$${PRODDIR}/include/qmessageencryptor.h" "$${PRODDIR}/include/qmessagesigner.h" "$${PRODDIR}/include/qmessagetimestamper.h" "$${PRODDIR}/include/qmessagetimestampverifier.h" "$${PRODDIR}/include/qmessageverifier.h" "$${PRODDIR}/include/qoauthclient.h" "$${PRODDIR}/include/qocspmanager.h" "$${PRODDIR}/include/qocspserver.h" "$${PRODDIR}/include/qofficedecryptor.h" "$${PRODDIR}/include/qofficeencryptor.h" "$${PRODDIR}/include/qofficequicksigner.h" "$${PRODDIR}/include/qofficesigner.h" "$${PRODDIR}/include/qofficeverifier.h" "$${PRODDIR}/include/qotpclient.h" "$${PRODDIR}/include/qotpserver.h" "$${PRODDIR}/include/qpasswordvault.h" "$${PRODDIR}/include/qpdfdecryptor.h" "$${PRODDIR}/include/qpdfencryptor.h" "$${PRODDIR}/include/qpdfsigner.h" "$${PRODDIR}/include/qpdfverifier.h" "$${PRODDIR}/include/qpgpkeymanager.h" "$${PRODDIR}/include/qpgpkeyring.h" "$${PRODDIR}/include/qpgpreader.h" "$${PRODDIR}/include/qpgpwriter.h" "$${PRODDIR}/include/qpop3client.h" "$${PRODDIR}/include/qpublickeycrypto.h" "$${PRODDIR}/include/qrestclient.h" "$${PRODDIR}/include/qrestserver.h" "$${PRODDIR}/include/qrnd.h" "$${PRODDIR}/include/qsamlidpserver.h" "$${PRODDIR}/include/qsamlreader.h" "$${PRODDIR}/include/qsamlspserver.h" "$${PRODDIR}/include/qsamlwriter.h" "$${PRODDIR}/include/qsftpclient.h" "$${PRODDIR}/include/qsftpserver.h" "$${PRODDIR}/include/qsmtpclient.h" "$${PRODDIR}/include/qsoapclient.h" "$${PRODDIR}/include/qsoapquicksigner.h" "$${PRODDIR}/include/qsoapsigner.h" "$${PRODDIR}/include/qsoapverifier.h" "$${PRODDIR}/include/qsshclient.h" "$${PRODDIR}/include/qsshkeymanager.h" "$${PRODDIR}/include/qsymmetriccrypto.h" "$${PRODDIR}/include/qtlsclient.h" "$${PRODDIR}/include/qtlsserver.h" "$${PRODDIR}/include/qtspserver.h" "$${PRODDIR}/include/qusermanager.h" "$${PRODDIR}/include/qwebdavclient.h" "$${PRODDIR}/include/qwebdavserver.h" "$${PRODDIR}/include/qwebsocketclient.h" "$${PRODDIR}/include/qwebsocketserver.h" "$${PRODDIR}/include/qxadessigner.h" "$${PRODDIR}/include/qxadesverifier.h" "$${PRODDIR}/include/qxmldecryptor.h" "$${PRODDIR}/include/qxmlencryptor.h" "$${PRODDIR}/include/qxmlsigner.h" "$${PRODDIR}/include/qxmlverifier.h" archivewriter.h certificate.h filetablemodel.h newarchive.h openarchive.h progress.h
FORMS += archivewriter.ui certificate.ui newarchive.ui openarchive.ui progress.ui
INCLUDEPATH += "$${PRODDIR}/include"
DEPENDPATH += "$${PRODDIR}/include"
greaterThan(QT_MAJOR_VERSION, 4) { TARGET_ARCH = $${QT_ARCH} } else { TARGET_ARCH = $${QMAKE_HOST.arch} }
contains(TARGET_ARCH, x86_64) { LIBDIR = lib64 } else { LIBDIR = lib }
CONFIG(debug, debug|release) { VARIANT = debug } else { VARIANT = release }
PLATDIR = windows
LIBS += -ladvapi32
LIBNAME = qtsecureblackbox20
# Ensures the product's DLL is copied to the output directory.
LIBPATH = "$${PRODDIR}/$${LIBDIR}/$${PLATDIR}/$${LIBNAME}.dll"
copydll.commands = $(COPY_FILE) \"$$replace(LIBPATH, /, \\)\" \"$$replace(OUT_PWD, /, \\)\\$${VARIANT}\"
first.depends = $(first) copydll
export(first.depends)
export(copydll.commands)
QMAKE_EXTRA_TARGETS += first copydll
LIBS += -L"$${PRODDIR}/$${LIBDIR}/$${PLATDIR}" -l$${LIBNAME}
Related
The below is the Makefile for cyttsp4 inside the Linux kernel that I'm compiling for Android, using the kyasu msm8974 project (https://github.com/kyasu/android_kernel_samsung_msm8974).
### CYTTSP
#obj-m += cyttsp4.o
obj-$(CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP4) += cyttsp4_core.o
obj-$(CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP4) += cyttsp4_i2c.o
obj-$(CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP4) += cyttsp4_platform.o
obj-$(CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP4) += cyttsp4_devtree.o
obj-$(CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP4) += cyttsp4_mt_common.o
obj-$(CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP4) += cyttsp4_mtb.o
obj-$(CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP4) += cyttsp4_btn.o
obj-$(CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP4) += cyttsp4_debug.o
obj-$(CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP4) += cyttsp4_device_access.o
obj-$(CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP4) += cyttsp4_loader.o
obj-$(CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP4) += cyttsp4_samsung_sysfs.o
CY_CFLAG_ADD =\
-DCONFIG_TOUCHSCREEN_CYPRESS_CYTTSP4\
-DCONFIG_TOUCHSCREEN_CYPRESS_CYTTSP4_DEVICETREE_SUPPORT\
-DCONFIG_TOUCHSCREEN_CYPRESS_CYTTSP4_BUTTON\
-DCONFIG_TOUCHSCREEN_CYPRESS_CYTTSP4_DEVICE_ACCESS\
-DCONFIG_TOUCHSCREEN_CYPRESS_CYTTSP4_LOADER\
-DCONFIG_TOUCHSCREEN_CYPRESS_CYTTSP4_PLATFORM_FW_UPGRADE\
-DCONFIG_TOUCHSCREEN_CYPRESS_CYTTSP4_BINARY_FW_UPGRADE
CY_CFLAG_REMOVE =\
-DCYTTSP4_PDATA_IN_PLATFORM_C\
-DCONFIG_TOUCHSCREEN_CYPRESS_CYTTSP4_PROXIMITY\
-DCONFIG_TOUCHSCREEN_CYPRESS_CYTTSP4_PLATFORM_TTCONFIG_UPGRADE\
-DCONFIG_TOUCHSCREEN_CYPRESS_CYTTSP4_DEVICE_ACCESS_API\
-DCONFIG_TOUCHSCREEN_CYPRESS_CYTTSP4_DEBUG\
-DCONFIG_TOUCHSCREEN_CYPRESS_CYTTSP4_MANUAL_TTCONFIG_UPGRADE
CFLAGS_cyttsp4_core.o += $(CY_CFLAG_ADD) -DDEBUG
CFLAGS_cyttsp4_i2c.o += $(CY_CFLAG_ADD) -DDEBUG
CFLAGS_cyttsp4_spi.o += $(CY_CFLAG_ADD)
CFLAGS_cyttsp4_mta.o += $(CY_CFLAG_ADD)
CFLAGS_cyttsp4_mtb.o += $(CY_CFLAG_ADD)
CFLAGS_cyttsp4_mt_a.o += $(CY_CFLAG_ADD)
CFLAGS_cyttsp4_mt_b.o += $(CY_CFLAG_ADD)
CFLAGS_cyttsp4_mt_common.o += $(CY_CFLAG_ADD)
CFLAGS_cyttsp4_btn.o += $(CY_CFLAG_ADD)
CFLAGS_cyttsp4_proximity.o += $(CY_CFLAG_ADD)
CFLAGS_cyttsp4_samsung_sysfs.o += $(CY_CFLAG_ADD)
CFLAGS_cyttsp4_device_access.o += $(CY_CFLAG_ADD)
CFLAGS_cyttsp4_test_device_access_api.o += $(CY_CFLAG_ADD)
CFLAGS_cyttsp4_loader.o += $(CY_CFLAG_ADD)
CFLAGS_cyttsp4_debug.o += $(CY_CFLAG_ADD)
CFLAGS_cyttsp4_devtree.o += $(CY_CFLAG_ADD) -DDEBUG
CFLAGS_cyttsp4_platform.o += $(CY_CFLAG_ADD) -DDEBUG
CFLAGS_cyttsp4_core.o -= $(CY_CFLAG_REMOVE)
CFLAGS_cyttsp4_i2c.o -= $(CY_CFLAG_REMOVE)
CFLAGS_cyttsp4_spi.o -= $(CY_CFLAG_REMOVE)
CFLAGS_cyttsp4_mta.o -= $(CY_CFLAG_REMOVE)
CFLAGS_cyttsp4_mtb.o -= $(CY_CFLAG_REMOVE)
CFLAGS_cyttsp4_mt_a.o -= $(CY_CFLAG_REMOVE)
CFLAGS_cyttsp4_mt_b.o -= $(CY_CFLAG_REMOVE)
CFLAGS_cyttsp4_mt_common.o -= $(CY_CFLAG_REMOVE)
CFLAGS_cyttsp4_btn.o -= $(CY_CFLAG_REMOVE)
CFLAGS_cyttsp4_proximity.o -= $(CY_CFLAG_REMOVE)
CFLAGS_cyttsp4_samsung_sysfs.o -= $(CY_CFLAG_REMOVE)
CFLAGS_cyttsp4_device_access.o -= $(CY_CFLAG_REMOVE)
CFLAGS_cyttsp4_test_device_access_api.o -= $(CY_CFLAG_REMOVE)
CFLAGS_cyttsp4_loader.o -= $(CY_CFLAG_REMOVE)
CFLAGS_cyttsp4_debug.o -= $(CY_CFLAG_REMOVE)
CFLAGS_cyttsp4_devtree.o -= $(CY_CFLAG_REMOVE)
CFLAGS_cyttsp4_platform.o -= $(CY_CFLAG_REMOVE)
The error I'm getting is:
/home/USER/Projects/OS/android_kernel_samsung_msm8974/drivers/gpu/gpu_sysfs/Kbuild:29: **** Make sure target file is defined. Check the TARGET and GPU configs in Makefile and Kernel Config. Module won't work without target file. ****
/home/USER/Projects/OS/android_kernel_samsung_msm8974/drivers/input/touchscreen/cyttsp4/Makefile:50: *** missing separator. Stop.
scripts/Makefile.clean:94: recipe for target 'drivers/input/touchscreen/cyttsp4' failed
make[3]: *** [drivers/input/touchscreen/cyttsp4] Error 2
scripts/Makefile.clean:94: recipe for target 'drivers/input/touchscreen' failed
make[2]: *** [drivers/input/touchscreen] Error 2
scripts/Makefile.clean:94: recipe for target 'drivers/input' failed
make[1]: *** [drivers/input] Error 2
Makefile:1201: recipe for target '_clean_drivers' failed
make: *** [_clean_drivers] Error 2
This is (partially) written using my S4 i9506 as a keyboard, if you want Nethunter on your S4 comment your interest and ill get started on a guide to port it yourself. I'll make one soon anyway but if people are interested I'll put more effort into making a guide to porting Nethunter faster.
Basically, as mentioned by #Tsyvarev, there's no -= command in Makefiles. Basically, whoever made the Makefile for Cyttsp4 (at least in the kernel sources I had) didn't do a very good job and after some research they probably thought just like me that the separator missing error was due to a missing tab somewhere which everyone suggests when you search for this issue. A quick search with #Tsyvarev's info about -= not existing I found the proper way to do what they want. Here's the complete Makefile with the proper alteration. You use $(filter-out, VARS_TO_REMOVE, RESULT) to remove flags.
The error is so stupid I don't see how it was made in the first place, considering it was found inside the source code of a kernel, and the people that make kernels are generally not this unskilled, or else they wouldn't be making kernels.
Wait a minute... I'm making errors and I'm... Oh...
Anyway, here's the code!
### CYTTSP
#obj-m += cyttsp4.o
obj-$(CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP4) += cyttsp4_core.o
obj-$(CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP4) += cyttsp4_i2c.o
obj-$(CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP4) += cyttsp4_platform.o
obj-$(CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP4) += cyttsp4_devtree.o
obj-$(CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP4) += cyttsp4_mt_common.o
obj-$(CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP4) += cyttsp4_mtb.o
obj-$(CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP4) += cyttsp4_btn.o
obj-$(CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP4) += cyttsp4_debug.o
obj-$(CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP4) += cyttsp4_device_access.o
obj-$(CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP4) += cyttsp4_loader.o
obj-$(CONFIG_TOUCHSCREEN_CYPRESS_CYTTSP4) += cyttsp4_samsung_sysfs.o
CY_CFLAG_ADD =\
-DCONFIG_TOUCHSCREEN_CYPRESS_CYTTSP4\
-DCONFIG_TOUCHSCREEN_CYPRESS_CYTTSP4_DEVICETREE_SUPPORT\
-DCONFIG_TOUCHSCREEN_CYPRESS_CYTTSP4_BUTTON\
-DCONFIG_TOUCHSCREEN_CYPRESS_CYTTSP4_DEVICE_ACCESS\
-DCONFIG_TOUCHSCREEN_CYPRESS_CYTTSP4_LOADER\
-DCONFIG_TOUCHSCREEN_CYPRESS_CYTTSP4_PLATFORM_FW_UPGRADE\
-DCONFIG_TOUCHSCREEN_CYPRESS_CYTTSP4_BINARY_FW_UPGRADE
CY_CFLAG_REMOVE =\
-DCYTTSP4_PDATA_IN_PLATFORM_C\
-DCONFIG_TOUCHSCREEN_CYPRESS_CYTTSP4_PROXIMITY\
-DCONFIG_TOUCHSCREEN_CYPRESS_CYTTSP4_PLATFORM_TTCONFIG_UPGRADE\
-DCONFIG_TOUCHSCREEN_CYPRESS_CYTTSP4_DEVICE_ACCESS_API\
-DCONFIG_TOUCHSCREEN_CYPRESS_CYTTSP4_DEBUG\
-DCONFIG_TOUCHSCREEN_CYPRESS_CYTTSP4_MANUAL_TTCONFIG_UPGRADE
CFLAGS_cyttsp4_core.o += $(CY_CFLAG_ADD) -DDEBUG
CFLAGS_cyttsp4_i2c.o += $(CY_CFLAG_ADD) -DDEBUG
CFLAGS_cyttsp4_spi.o += $(CY_CFLAG_ADD)
CFLAGS_cyttsp4_mta.o += $(CY_CFLAG_ADD)
CFLAGS_cyttsp4_mtb.o += $(CY_CFLAG_ADD)
CFLAGS_cyttsp4_mt_a.o += $(CY_CFLAG_ADD)
CFLAGS_cyttsp4_mt_b.o += $(CY_CFLAG_ADD)
CFLAGS_cyttsp4_mt_common.o += $(CY_CFLAG_ADD)
CFLAGS_cyttsp4_btn.o += $(CY_CFLAG_ADD)
CFLAGS_cyttsp4_proximity.o += $(CY_CFLAG_ADD)
CFLAGS_cyttsp4_samsung_sysfs.o += $(CY_CFLAG_ADD)
CFLAGS_cyttsp4_device_access.o += $(CY_CFLAG_ADD)
CFLAGS_cyttsp4_test_device_access_api.o += $(CY_CFLAG_ADD)
CFLAGS_cyttsp4_loader.o += $(CY_CFLAG_ADD)
CFLAGS_cyttsp4_debug.o += $(CY_CFLAG_ADD)
CFLAGS_cyttsp4_devtree.o += $(CY_CFLAG_ADD) -DDEBUG
CFLAGS_cyttsp4_platform.o += $(CY_CFLAG_ADD) -DDEBUG
CFLAGS_cyttsp4_core.o := $(filter-out $(CY_CFLAG_REMOVE),$(CFLAGS_cyttsp4_core.o))
CFLAGS_cyttsp4_i2c.o := $(filter-out $(CY_CFLAG_REMOVE),$(CFLAGS_cyttsp4_i2c.o))
CFLAGS_cyttsp4_spi.o := $(filter-out $(CY_CFLAG_REMOVE),$(CFLAGS_cyttsp4_spi.o))
CFLAGS_cyttsp4_mta.o := $(filter-out $(CY_CFLAG_REMOVE),$(CFLAGS_cyttsp4_mta.o))
CFLAGS_cyttsp4_mtb.o := $(filter-out $(CY_CFLAG_REMOVE),$(CFLAGS_cyttsp4_mtb.o))
CFLAGS_cyttsp4_mt_a.o := $(filter-out $(CY_CFLAG_REMOVE),$(CFLAGS_cyttsp4_mt_a.o))
CFLAGS_cyttsp4_mt_b.o := $(filter-out $(CY_CFLAG_REMOVE),$(CFLAGS_cyttsp4_mt_b.o))
CFLAGS_cyttsp4_mt_common.o := $(filter-out $(CY_CFLAG_REMOVE),$(CFLAGS_cyttsp4_mt_common.o))
CFLAGS_cyttsp4_btn.o := $(filter-out $(CY_CFLAG_REMOVE),$(CFLAGS_cyttsp4_btn.o))
CFLAGS_cyttsp4_proximity.o := $(filter-out $(CY_CFLAG_REMOVE),$(CFLAGS_cyttsp4_proximity.o))
CFLAGS_cyttsp4_samsung_sysfs.o := $(filter-out $(CY_CFLAG_REMOVE),$(CFLAGS_cyttsp4_samsung_sysfs.o))
CFLAGS_cyttsp4_device_access.o := $(filter-out $(CY_CFLAG_REMOVE),$(CFLAGS_cyttsp4_device_access.o))
CFLAGS_cyttsp4_test_device_access_api.o := $(filter-out $(CY_CFLAG_REMOVE),$(CFLAGS_cyttsp4_test_device_access_api.o))
CFLAGS_cyttsp4_loader.o := $(filter-out $(CY_CFLAG_REMOVE),$(CFLAGS_cyttsp4_loader.o))
CFLAGS_cyttsp4_debug.o := $(filter-out $(CY_CFLAG_REMOVE),$(CFLAGS_cyttsp4_debug.o))
CFLAGS_cyttsp4_devtree.o := $(filter-out $(CY_CFLAG_REMOVE),$(CFLAGS_cyttsp4_devtree.o))
CFLAGS_cyttsp4_platform.o := $(filter-out $(CY_CFLAG_REMOVE),$(CFLAGS_cyttsp4_platform.o))
In the Plug & Paint Example the .pro presents the following:
LIBS = -Lplugins -lpnp_basictools
if(!debug_and_release|build_pass):CONFIG(debug, debug|release) {
mac:LIBS = $$member(LIBS, 0) $$member(LIBS, 1)_debug
win32:LIBS = $$member(LIBS, 0) $$member(LIBS, 1)d
}
Which, for that particular case, appends a d to the lib name in debug mode, pnp_basictools becomes pnp_basictoolsd. But it doesn't scale well, i.e.:
LIBS = -Lplugins -lplugin_1 -lplugin_2 -lplugin_3
if(!debug_and_release|build_pass):CONFIG(debug, debug|release)
win32:LIBS = $$member(LIBS, 0) $$member(LIBS, 1)d
Seems not to append d to plugin_2 and plugin_3.
So, may I ask for another method to add the d to the lib name in debug mode?
The issue was also mentioned here.
$$member(X, pos) returns the item at the position pos of the list variable X. So, the code you found only handles 2 of the elements of that list (0 => -Lplugins and 1 => -lpnp_basictools).
There is a for loop that could help you handle all the elements of the list, but instead you can "simply" use a regular expression with the ~= operator :
win32:LIBS ~= s/-l(.*)/-l\1d/g
I'm making a static library with Qt Creator, this library will be used in a larger GUI based application. I've used Rcpp before but with R as my starting point - so moving R data to C++ functions to do stuff and get the result and I'm used to doing it with R studio. This time I'm starting in a Qt project and I have need for a table to store some data in and Rcpp::Dataframe would fit the job nicely, as would some of the vector classes. In my .cpp source file I have the include statement #include <Rcpp.h> and I took a look on the web and found an example of the Rcpp / RInside libraries being used in Qt - although it's more about RInside than Rcpp: RInside and Qt
It seems some thing need to be added to the .pro file to get qmake to do the right thing. I've included what I think are required for Rcpp in my .pro file attached below. The problem I'm having is that before inclusion of the Rcpp stuff in the .pro file and the include statement in the .cpp file, the inclusion of the bpp libraries which you can also see in the .pro file below does not result in any errors or warnings in compilation. After the inclusion of the statements to include R and Rcpp in the .pro file, I get many warnings and one error to do with a component of bpp, specifically: /local/yrq12edu/local/bpp/dev/include/Bpp/Numeric/NumConstants.h:96: error: expected unqualified-id before numeric constant. There are also a lot of Wunused-parameter messages, again most of these seem to be comming from files from within bpp. This is the first time I've had to deal with something like this, and although I've read a lot of the Qt docs I'm still a very fresh Qt newb. Why would I get no errors before to do with bpp, but get them now I've tried including Rcpp into my Qt project? And what should I do to take steps to solve this?
#-------------------------------------------------
#
# Project created by QtCreator 2014-09-05T23:27:21
#
#-------------------------------------------------
QT -= core gui
TARGET = libHybRIDS
TEMPLATE = lib
CONFIG += staticlib
SOURCES += hybridsengine.cpp
HEADERS += hybridsengine.h
INCLUDEPATH += /local/yrq12edu/local/bpp/dev/include
LIBS += -L/local/yrq12edu/local/bpp/dev/lib -lbpp-core
LIBS += -L/local/yrq12edu/local/bpp/dev/lib -lbpp-seq
# Set R home directory
R_HOME = $$system(R RHOME)
# Set Rcpp include and lib flags.
RCPPINCL = $$system($$R_HOME/bin/Rscript -e \'Rcpp:::CxxFlags\(\)\')
RCPPLIBS = $$system($$R_HOME/bin/Rscript -e \'Rcpp:::LdFlags\(\)\')
# Set R cpp and ld flags. Also for BLAS and LAPACK it uses.
RCPPFLAGS = $$system($$R_HOME/bin/R CMD config --cppflags)
RLDFLAGS = $$system($$R_HOME/bin/R CMD config --ldflags)
RBLAS = $$system($$R_HOME/bin/R CMD config BLAS_LIBS)
RLAPACK = $$system($$R_HOME/bin/R CMD config LAPACK_LIBS)
RCPPWARNING = -Wno-unused-parameter
QMAKE_CXXFLAGS += $$RCPPWARNING $$RCPPFLAGS $$RCPPINCL
QMAKE_LFLAGS += $$RLDFLAGS $$RBLAS $$RLAPACK $$RCPPLIBS
unix {
target.path = /usr/lib
INSTALLS += target
}
EDIT:
Following suggestions I've used the example pro file in RInside/examples/qt as the start point - keeping the order of the statements:
#-------------------------------------------------
#
# Project created by QtCreator 2014-09-05T23:27:21
#
#-------------------------------------------------
QT -= core gui
TARGET = libHybRIDS
TEMPLATE = lib
CONFIG += staticlib
SOURCES += hybridsengine.cpp
HEADERS += hybridsengine.h
## comment this out if you need a different version of R,
## and set set R_HOME accordingly as an environment variable
R_HOME = $$system(R RHOME)
#message("R_HOME is" $$R_HOME)
## include headers and libraries for R
RCPPFLAGS = $$system($$R_HOME/bin/R CMD config --cppflags)
RLDFLAGS = $$system($$R_HOME/bin/R CMD config --ldflags)
RBLAS = $$system($$R_HOME/bin/R CMD config BLAS_LIBS)
RLAPACK = $$system($$R_HOME/bin/R CMD config LAPACK_LIBS)
## if you need to set an rpath to R itself, also uncomment
RRPATH = -Wl,-rpath,$$R_HOME/lib
## include headers and libraries for Rcpp interface classes
## note that RCPPLIBS will be empty with Rcpp (>= 0.11.0) and can be omitted
RCPPINCL = $$system($$R_HOME/bin/Rscript -e \"Rcpp:::CxxFlags\(\)\")
RCPPLIBS = $$system($$R_HOME/bin/Rscript -e \"Rcpp:::LdFlags\(\)\")
## for some reason when building with Qt we get this each time
## /usr/local/lib/R/site-library/Rcpp/include/Rcpp/module/Module_generated_ctor_signature.h:25: warning: unused parameter ‘classname
## so we turn unused parameter warnings off
## no longer needed with Rcpp 0.9.3 or later
#RCPPWARNING = -Wno-unused-parameter
## include headers and libraries for RInside embedding classes
RINSIDEINCL = $$system($$R_HOME/bin/Rscript -e \"RInside:::CxxFlags\(\)\")
RINSIDELIBS = $$system($$R_HOME/bin/Rscript -e \"RInside:::LdFlags\(\)\")
## compiler etc settings used in default make rules
QMAKE_CXXFLAGS += $$RCPPWARNING $$RCPPFLAGS $$RCPPINCL $$RINSIDEINCL
QMAKE_LIBS += $$RLDFLAGS $$RBLAS $$RLAPACK $$RINSIDELIBS $$RCPPLIBS
## addition clean targets
QMAKE_CLEAN += qtdensity Makefile
unix {
target.path = /usr/lib
INSTALLS += target
}
Putting in my statements to include the bpp libraries from before before or after the statements relating to RInside and Rcpp cause the same error as previously.
The contents of the .h file from bpp are:
#ifndef _NUMCONSTANTS_H_
#define _NUMCONSTANTS_H_
#include <cmath>
#include <limits>
namespace bpp {
/**
* #brief this static class contains several useful constant values.
*
* This classe uses function in order to avoid the infamous "static initialization order fiasco".
* C++0x solves this...
*/
class NumConstants
{
public:
/**
* #name Golden ratio.
*
* The golden ratio, #f$\phi#f$ is equal to #f$\frac{1+\sqrt{5}}{2} = 1.6180339887498948482\ldots#f$.
* We also define #f$R=\phi-1#f$ and #f$C = 1 - R#f$.
* #{
*/
static double GOLDEN_RATIO_PHI() { return (1. + sqrt(5.)) / 2.; }
static double GOLDEN_RATIO_R() { return GOLDEN_RATIO_PHI() - 1.; }
static double GOLDEN_RATIO_C() { return 1. - GOLDEN_RATIO_R(); }
/** #} */
static double MEGA() { return 1e6; }
static double KILO() { return 1e3; }
static double DECI() { return 1e-1; }
static double CENTI() { return 1e-2; }
static double MILLI() { return 1e-3; }
static double MICRO() { return 1e-6; }
static double NANO() { return 1e-9; }
static double PICO() { return 1e-12; }
static double SMALL() { return 1e-6; }
static double TINY() { return 1e-12; }
static double VERY_TINY() { return 1e-20; }
static double VERY_BIG() { return static_cast<double>(1.7E+23); }
/**
* #name Define those constants in case they would not be available in stl/limits.
*
* #{
*/
static double INF() { return std::numeric_limits<double>::has_infinity ? -log(0) : std::numeric_limits<double>::max(); }
static double PINF() { return std::numeric_limits<double>::has_infinity ? -log(0) : std::numeric_limits<double>::max(); }
static double MINF() { return std::numeric_limits<double>::has_infinity ? log(0) : std::numeric_limits<double>::min(); }
static double NaN() { return NAN; }
/** #} */
static double PI() { return 3.141593; }
};
}//end of namespace bpp.
#endif //_NUMCONSTANTS_H_
Here's a guess: In R_ext/Constants.h, we have:
trunk/src/include/R_ext/Constants.h
28:#define M_PI 3.141592653589793238462643383279502884197169399375
32:#define PI M_PI
That macro definition is colliding with the function definition for PI. So you would expect e.g.
#include <R.h> // pulls in 'R_ext/Constants.h'
#include "Bpp stuff" // definition for function named PI collides with macro
would give potential errors. The R macro definition for PI would leak into Bpp, and hence after the preprocessor is done, this line:
static double PI() { return 3.141593; }
will look like
static double 3.141592653589793238462643383279502884197169399375() { return 3.141593; }
and the compiler can only say 'wat'. This is why include order can be important -- including Bpp first would avoid the macro pollution.
It appears this particular bit of pollution could be avoided by defining #define STRICT_R_HEADERS (since that's what the entry is wrapped in).
I try:
env = Environment(ENV = {'PATH' : os.environ['PATH'], \
'INCLUDE' : 'c:\\Program Files (x86)\\Microsoft Visual Studio 11.0\\VC\\include\\', \
'LIB' : 'c:\\Program Files (x86)\\Microsoft Visual Studio 11.0\\VC\\lib\\'})
but it not working.
error message:
"cl" is not command ...
I found description in scons wiki(http://www.scons.org/wiki/PlatformSpecificNotes#Visual_C.2B-.2B-):
If using Microsoft Visual C++, you need to set 'INCLUDE', 'LIB' and 'PATH' in your environment, then import them when you create your 'Environment' object. These will be used to locate the MSVC++ tools and set 'CPPFLAGS' etc.
What am I doing wrong?
complete sconstruct(it works on ubuntu, and on windows with mingw):
import os
import sys
if ARGUMENTS.get('ndk', 0):
current_dir = os.getcwd()#os.path.dirname(os.path.abspath(__file__))
os.environ["NDK_PROJECT_PATH"] = current_dir + '/android-project'
os.system("ndk-build") # use V=1 if can't compile for android
exit(0)
if ARGUMENTS.get('ant', 0):
current_dir = os.getcwd()#os.path.dirname(os.path.abspath(__file__))
android_prj_path = current_dir + '/android-project'
os.chdir(android_prj_path)
os.system("ant debug") # use V=1 if can't compile for android
exit(0)
VariantDir('obj', 'src', duplicate = 0)
if sys.platform == 'win32':
if ARGUMENTS.get('msvc', 0) == "1":
env = Environment(ENV = {'PATH' : os.environ['PATH'], \
'INCLUDE' : 'c:\\Program Files (x86)\\Microsoft Visual Studio 11.0\\VC\\include\\', \
'LIB' : 'c:\\Program Files (x86)\\Microsoft Visual Studio 11.0\\VC\\lib\\'})
else:
env = Environment(tools = ['mingw'])
env.Append(CCFLAGS = '-U__STRICT_ANSI__') # for boost::program_options on mingw 4.7
env.Append(LINKFLAGS = '-mwindows')
env.Append(LIBS = ['mingw32', 'SDL2', 'SDL2main', 'm', 'user32', 'gdi32', \
'winmm', 'imm32', 'ole32', 'oleaut32', 'version', \
'uuid', 'glew32', 'opengl32'])
else:
env = Environment()
env.Append(CCFLAGS = '-rdynamic')
env.Append(LIBS = ['SDL2', 'pthread', 'm', 'dl', 'GL'])
env.Append(CCFLAGS = '-fno-strict-aliasing') # for angelscript compile see doc
cur_dir = os.getcwd()
env.Append(CCFLAGS = '-I ' + cur_dir) # for boost find in include path
env.Append(CCFLAGS = '-g -std=c++0x -Wall -Wfatal-errors') #-msse2 -pg
env.Append(LINKFLAGS=[]) # -pg
src = Glob('obj/*.cpp')
src += Glob('obj/scene2d/*.cpp')
src += Glob('obj/pugixml/*.cpp')
src += Glob('obj/debug_support/*.cpp')
src += Glob('obj/angelscript/*.cpp')
src += Glob('obj/scriptarray/*.cpp')
src += Glob('obj/scriptstdstring/*.cpp')
src += Glob('obj/scriptbuilder/*.cpp')
src += Glob('obj/boost_libs_src/program_options/src/*.cpp')
src += Glob('obj/boost_libs_src/smart_ptr/src/*.cpp')
src += Glob('obj/boost_libs_src/system/src/*.cpp')
src += Glob('obj/boost_libs_src/filesystem/src/*.cpp')
src += Glob('obj/libwebp/*/*.c')
src += Glob('obj/zlib/*.c')
src += Glob('obj/libpng/*.c')
env.Program(target = 'start', source = src)
Best way to use scons and MSVC is:
env = Environment( MSVC_USE_SCRIPT = "c:\\Program Files (x86)\\Microsoft Visual Studio 11.0\\VC\\bin\\vcvars32.bat")
Full script that works for me
import os
import sys
current_dir = os.getcwd()#os.path.dirname(os.path.abspath(__file__))
if ARGUMENTS.get('ndk', 0):
os.environ["NDK_PROJECT_PATH"] = current_dir + '/android-project'
os.system("ndk-build") # use V=1 if can't compile for android
Exit(0)
if ARGUMENTS.get('ant', 0):
android_prj_path = current_dir + '/android-project'
os.chdir(android_prj_path)
os.system("ant debug") # use V=1 if can't compile for android
Exit(0)
VariantDir('obj', 'src', duplicate = 0)
if sys.platform == 'win32':
if ARGUMENTS.get('msvc', 0) == "1":
#os.system('"C:\\Program Files (x86)\\Microsoft Visual Studio 11.0\\VC\\bin\\vcvars32"')
env = Environment(ENV = {'PATH' : os.environ['PATH'], \
'INCLUDE' : 'c:\\Program Files (x86)\\Microsoft Visual Studio 11.0\\VC\\include\\;c:\\Program Files (x86)\\Windows Kits\\8.0\\Include\um\\;c:\\Program Files (x86)\\Windows Kits\\8.0\\Include\\shared\\', \
'LIB' : 'c:\\Program Files (x86)\\Microsoft Visual Studio 11.0\\VC\\lib\\;c:\\Program Files (x86)\\Windows Kits\\8.0\\Lib\\win8\\um\\x86\\'})
env.Append(CCFLAGS = '-I ' + current_dir + '/dep/msvc/include') # for SDL2 on windows
env.Append(CCFLAGS = '/Od /EHsc -DBOOST_ALL_NO_LIB')
env.Append(LINKFLAGS = '/LIBPATH:' + current_dir + '/dep/msvc/lib/')
env.Append(LINKFLAGS = '/SUBSYSTEM:WINDOWS')
env.Append(LIBS = ['user32', 'gdi32', \
'winmm', 'imm32', 'ole32', 'oleaut32', 'version', \
'uuid', 'glew32s', 'opengl32'])
else:
env = Environment(tools = ['mingw'])
env.Append(CCFLAGS = '-U__STRICT_ANSI__') # for boost::program_options on mingw 4.7
env.Append(LINKFLAGS = '-mwindows')
env.Append(LIBS = ['mingw32', 'SDL2', 'SDL2main', 'm', 'user32', 'gdi32', \
'winmm', 'imm32', 'ole32', 'oleaut32', 'version', \
'uuid', 'glew32', 'opengl32'])
else:
env = Environment()
env.Append(LIBS = ['SDL2', 'pthread', 'm', 'dl', 'GL'])
if ARGUMENTS.get('msvc', 0) != "1":
env.Append(CCFLAGS = '-fno-strict-aliasing') # for angelscript compile see doc
env.Append(CCFLAGS = '-std=c++0x -Wall -Wfatal-errors')
env.Append(CCFLAGS = '-I ' + current_dir) # for boost find in include path
if ARGUMENTS.get('release', 0) == "1":
if sys.platform != 'win32':
env.Append(CCFLAGS = '-DNO_OPENGL_CHECK -DSDL_ASSERT_LEVEL=1 -O2 -msse2') #-DNO_OPENGL_CHECK -DSDL_ASSERT_LEVEL=1 -O3 -msse2
else:
env.Append(CCFLAGS = '/MD')
env.Append(LIBS = ['SDLmain', 'SDL', 'msvcrt'])
else:
if sys.platform != 'win32':
env.Append(LINKFLAGS=['-rdynamic']) # $(sdl2-config --static-libs)
env.Append(CCFLAGS = '-g')
else:
env.Append(CCFLAGS = '/MDd /Gm- /Zi -D_DEBUG /Od ')
env.Append(LINKFLAGS=['/INCREMENTAL'])
env['PDB'] = ['start.pdb']
env['CCPDBFLAGS'] = ['${(PDB and "/Zi /Fd%s" % File(PDB)) or ""}']
env.Append(LIBS = ['SDLmain_d', 'SDL_d', 'MSVCRTD', 'libcmt'])
src = Glob('obj/*.cpp')
src += Glob('obj/scene2d/*.cpp')
src += Glob('obj/pugixml/*.cpp')
src += Glob('obj/debug_support/*.cpp')
src += Glob('obj/angelscript/*.cpp')
src += Glob('obj/scriptarray/*.cpp')
src += Glob('obj/scriptstdstring/*.cpp')
src += Glob('obj/scriptbuilder/*.cpp')
src += Glob('obj/scripthelper/*.cpp')
src += Glob('obj/boost_libs_src/program_options/src/*.cpp')
src += Glob('obj/boost_libs_src/smart_ptr/src/*.cpp')
src += Glob('obj/boost_libs_src/system/src/*.cpp')
src += Glob('obj/boost_libs_src/filesystem/src/*.cpp')
src += Glob('obj/libwebp/*/*.c')
src += Glob('obj/zlib/*.c')
src += Glob('obj/libpng/*.c')
prog = env.Program(target = 'start', source = src)
Firstly, i am sure i have not done something wrong to export build release bar file, for my project. Few weeks ago i have built one release bar for my project, only 1mb.
I did exactly as the following tutorail:
http://bbcascadescode.tumblr.com/post/33340977264/exporting-bar-file-from-cascades-ide
but today when i try to export the release build, the bar file is about 100mb!!!!
There is no problem, no error, but the bar size is abnormal!!!
this is my project's pro file:
APP_NAME = myProjectName
CONFIG += qt warn_on debug_and_release cascades mobility
LIBS += -lbbdata -lbbplatform -lbbcascadesmaps -lbbsystem -lbbutilityi18n -lbbdevice -lz -lbbcascadesmultimedia -lbbpim -lbbmultimedia -lOpenAL -lalut -lasound
MOBILITY += sensors
include(config.pri)
lupdate_inclusion {
SOURCES += \
$$BASEDIR/../src/*.cpp \
$$BASEDIR/../src/control/*.cpp \
$$BASEDIR/../src/model/*.cpp \
$$BASEDIR/../src/utils/*.cpp \
$$BASEDIR/../src/view/*.cpp \
$$BASEDIR/../assets/items/*.qml \
$$BASEDIR/../assets/controls/*.qml \
$$BASEDIR/../assets/*.qml
}
device {
CONFIG(release, debug|release) {
DESTDIR = o.le-v7
#TEMPLATE = lib
#QMAKE_CXXFLAGS_RELEASE += -fvisibility=hidden -mthumb
}
CONFIG(debug, debug|release) {
DESTDIR = o.le-v7-g
}
}
simulator {
CONFIG(release, debug|release) {
DESTDIR = o
}
CONFIG(debug, debug|release) {
DESTDIR = o-g
}
}
OBJECTS_DIR = $${DESTDIR}/.obj
MOC_DIR = $${DESTDIR}/.moc
RCC_DIR = $${DESTDIR}/.rcc
UI_DIR = $${DESTDIR}/.ui
suredelete.target = sureclean
suredelete.commands = $(DEL_FILE) $${MOC_DIR}/*; $(DEL_FILE) $${RCC_DIR}/*; $(DEL_FILE) $${UI_DIR}/*
suredelete.depends = distclean
QMAKE_EXTRA_TARGETS += suredelete
Maybe i import too many libraries??
I have no clue till now, because i got no error, just the bar size seems not correct. It can NOT be 100MB. All the source codes and resource files are only 3.3 MB.
Anyone has the same issue?
Thank you for any advice!!