Unsolved How to add macro for the LIBS in the .PRO file
-
@ManiRon said in How to add macro for the LIBS in the .PRO file:
@ManiRon
I tried with windows it returned win32-g++ ?Ok. So you can use it on
Windows
, but you have to check it withXenomai
. By the way,win32-g++
means that you useMinGW
compiler. Reply when you get the output forXenomai
. -
@Cobra91151 ok Sir
-
I have a doubt?
-
i generated a code in .pro file as
win32-g++{
LIBS += path
}
linux-g++ {
LIBS += path
}i am creating a bundle with the .exe and the required files and if i run this in a PC which does not have QT will it work
-
@ManiRon said in How to add macro for the LIBS in the .PRO file:
I have a doubt?
@ManiRon said in How to add macro for the LIBS in the .PRO file:
i generated a code in .pro file as
win32-g++{
LIBS += path
}
linux-g++ {
LIBS += path
}i am creating a bundle with the .exe and the required files and if i run this in a PC which does not have QT will it work
You have doubt about what? Is
linux-g++
scope condition fromXenomai
output?Also, you have to provide all the necessary
Qt
libs if theQt
is not static (on thePC
which does not haveQt
) otherwise it wont work. For example, forWindows
, you have to runwindeployqt.exe
to getQt
shared libs.Official docs about the deployment for
Windows
: http://doc.qt.io/qt-5/windows-deployment.html -
So, you should have something like this in the
pro
file:TARGET = TestApp #Your executable filename without the extension win32-g++ { LIBS += path QMAKE_POST_LINK = $$(QTDIR)/bin/windeployqt.exe $$shell_quote($$DESTDIR/$$shell_quote($$TARGET).exe) --no-compiler-runtime }
This will add one more build step to the project, but it will help to deploy all the necessary
Qt
libs. By the way, it will work only forWindows
deployment andshared
libsQt
version.Linux
deploymentQt
docs here: http://doc.qt.io/qt-5/linux-deployment.html -
I tried for Xenomai OS but the message($$QMAKESPEC) is not printing at . Donno why ? and i am struck
-
@ManiRon said in How to add macro for the LIBS in the .PRO file:
I tried for Xenomai OS but the message($$QMAKESPEC) is not printing at . Donno why ? and i am struck
Hi! What
Qt
version do you use onXenomai
? The problem might be because it can't find the compiler. -
@Cobra91151 using 4.7 version QT in xenomai
-
So, for example you should check the directory:
...\Qt\4.7\mingw53_32\mkspecs
Here is what I get:
Xenomai
is built with theLinux
kernel, so you should try all the possible scope conditions forlinux
. Also, what compiler do you use onXenomai
? It will help to find it faster. -
how to check the compiler sir?
-
You can check the compiler:
Tools
=>Options
=>Kits
=>Compilers
in theQt Creator
.For example:
Are you sure you can build the empty project on
Xenomai
? -
Will check and say sir
-
OK. By the way, I have another solution to your problem but I can't check it because older
Qt
->Q_WS*
macros were dropped in favour ofQ_OS*
. So I will add both solutions for older and newerQt
versions.You can add macros in the code to check the
OS
and load libs for example onWin
OS:Qt 5.x:
#ifdef Q_OS_WIN #pragma comment(lib, "yourlibforwin") #elif Q_OS_LINUX #pragma comment(lib, "yourlibforlinux") #else #pragma comment(lib, "yourlibforxenomai") #endif
Docs: http://doc.qt.io/qt-5/qtglobal.html
Qt 4.x
#ifdef Q_WS_WIN #pragma comment(lib, "yourlibforwin") #else #pragma comment(lib, "yourlibforlinux") #endif
-
@Cobra91151 said in How to add macro for the LIBS in the .PRO file:
comment
can i implement this in the .PRO file?
-
No, you can't have it in the
.pro
file. So what about the compiler? Have you built the empty project onXenomai
? -
Not yet checked . Once i check it will inform u sir.