How to add macro for the LIBS in the .PRO file
-
Why do you want to create your macro if it already done by
Qt?Code:
unix { LIBS += -L"$$PWD/release/" -lLinuxdata } win32 { LIBS += -L"$$PWD/release/" -ldata }unixwill be used onUnixsystems, it includes theLinux.
win32will be used onWindowssystems.You can define your macro, for example:
DEFINES += MY_MACRO=trueI can only think that you want something like that:
DEFINES += MY_LIB_PATH="$$PWD/release/"So you can define the one path to libraries and use it:
unix { LIBS += -L"$$MY_LIB_PATH" -lLinuxdata } win32 { LIBS += -L"$$MY_LIB_PATH" -ldata }But you still need
unix/win32checks.For xenomai and fedora what should i define
for example:for linux : unix, Windows: win32, similarly for Fedora : ?,
and Xenomai : ? -
For
XenomaiandFedorashould workunixand forWindows-win32.From the Qt documentation:
Platform Scope Values In addition to the win32, macx, and unix values used in many scope conditions, various other built-in platform and compiler-specific values can be tested with scopes. These are based on platform specifications provided in Qt's mkspecs directory. For example, the following lines from a project file show the current specification in use and test for the linux-g++ specification: message($$QMAKESPEC) linux-g++ { message(Linux) } You can test for any other platform-compiler combination as long as a specification exists for it in the mkspecs directory. The scope unix is true for the Symbian platform.Official Qt docs: http://doc.qt.io/archives/qt-4.8/qmake-advanced-usage.html
-
Why do you want to create your macro if it already done by
Qt?Code:
unix { LIBS += -L"$$PWD/release/" -lLinuxdata } win32 { LIBS += -L"$$PWD/release/" -ldata }unixwill be used onUnixsystems, it includes theLinux.
win32will be used onWindowssystems.You can define your macro, for example:
DEFINES += MY_MACRO=trueI can only think that you want something like that:
DEFINES += MY_LIB_PATH="$$PWD/release/"So you can define the one path to libraries and use it:
unix { LIBS += -L"$$MY_LIB_PATH" -lLinuxdata } win32 { LIBS += -L"$$MY_LIB_PATH" -ldata }But you still need
unix/win32checks.@Cobra91151 Sir i am trying to add
uinx{
LIBS+= -L$$PWD/.../lib/linus/-lData
LIBS+= -L$$PWD/.../lib/Xenomai/-lData1 -lrtdm -lrt -lxenomai
}I am adding the linux and xenomai library and trying to compile . but it throws error. As it detects the linux library and it couldnt find the xenomai library it throws error.
My question is i want to define all my library and based on the platform or OS i am running it should detect its particular library.
For example : linux, xenomai, windiows. These are the platforms i am running the application. Why i ask this is because every time i have to add the corresponding library and compile it and the run the application . So is there any solution for this? -
@Cobra91151 Sir i am trying to add
uinx{
LIBS+= -L$$PWD/.../lib/linus/-lData
LIBS+= -L$$PWD/.../lib/Xenomai/-lData1 -lrtdm -lrt -lxenomai
}I am adding the linux and xenomai library and trying to compile . but it throws error. As it detects the linux library and it couldnt find the xenomai library it throws error.
My question is i want to define all my library and based on the platform or OS i am running it should detect its particular library.
For example : linux, xenomai, windiows. These are the platforms i am running the application. Why i ask this is because every time i have to add the corresponding library and compile it and the run the application . So is there any solution for this?@ManiRon said in How to add macro for the LIBS in the .PRO file:
@Cobra91151 Sir i am trying to add
uinx{
LIBS+= -L$$PWD/.../lib/linus/-lData
LIBS+= -L$$PWD/.../lib/Xenomai/-lData1 -lrtdm -lrt -lxenomai
}I am adding the linux and xenomai library and trying to compile . but it throws error. As it detects the linux library and it couldnt find the xenomai library it throws error.
My question is i want to define all my library and based on the platform or OS i am running it should detect its particular library.
For example : linux, xenomai, windiows. These are the platforms i am running the application. Why i ask this is because every time i have to add the corresponding library and compile it and the run the application . So is there any solution for this?First all of all, you typed
uinx, it should beunix, so the errors might be with it. Secondly,Xenomaiis built with theLinuxkernel, so in your case it will load both libs.So, you have to be more specific with your checks, read my post above:
In addition to the win32, macx, and unix values used in many scope conditions, various other built-in platform and compiler-specific values... -
@ManiRon said in How to add macro for the LIBS in the .PRO file:
@Cobra91151 Sir i am trying to add
uinx{
LIBS+= -L$$PWD/.../lib/linus/-lData
LIBS+= -L$$PWD/.../lib/Xenomai/-lData1 -lrtdm -lrt -lxenomai
}I am adding the linux and xenomai library and trying to compile . but it throws error. As it detects the linux library and it couldnt find the xenomai library it throws error.
My question is i want to define all my library and based on the platform or OS i am running it should detect its particular library.
For example : linux, xenomai, windiows. These are the platforms i am running the application. Why i ask this is because every time i have to add the corresponding library and compile it and the run the application . So is there any solution for this?First all of all, you typed
uinx, it should beunix, so the errors might be with it. Secondly,Xenomaiis built with theLinuxkernel, so in your case it will load both libs.So, you have to be more specific with your checks, read my post above:
In addition to the win32, macx, and unix values used in many scope conditions, various other built-in platform and compiler-specific values...for xenomai what should i do sir?
While giving unix it runs the library for linux and if i want to do the same for xenomai what should i specify?
And i want to know where this message($$QMAKESPEC) will be displayed?
-
for xenomai what should i do sir?
While giving unix it runs the library for linux and if i want to do the same for xenomai what should i specify?
And i want to know where this message($$QMAKESPEC) will be displayed?
Xenomaishould have something, I useWindowsOS, so I don't know exactly.message($$QMAKESPEC)will be displayed in theGeneral Messagesin theQt Creator. Check the outputmessage($$QMAKESPEC)and reply. I will try to help you. -
Xenomaishould have something, I useWindowsOS, so I don't know exactly.message($$QMAKESPEC)will be displayed in theGeneral Messagesin theQt Creator. Check the outputmessage($$QMAKESPEC)and reply. I will try to help you.@Cobra91151 Ok sir
-
@Cobra91151 Ok sir
-
@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 useMinGWcompiler. Reply when you get the output forXenomai. -
@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 useMinGWcompiler. Reply when you get the output forXenomai.@Cobra91151 ok Sir
-
@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 useMinGWcompiler. Reply when you get the output forXenomai.I have a doubt?
-
@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 useMinGWcompiler. Reply when you get the output forXenomai.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
-
I have a doubt?
@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 fromXenomaioutput?Also, you have to provide all the necessary
Qtlibs if theQtis not static (on thePCwhich does not haveQt) otherwise it wont work. For example, forWindows, you have to runwindeployqt.exeto getQtshared libs.Official docs about the deployment for
Windows: http://doc.qt.io/qt-5/windows-deployment.html -
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
So, you should have something like this in the
profile: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
Qtlibs. By the way, it will work only forWindowsdeployment andsharedlibsQtversion.LinuxdeploymentQtdocs here: http://doc.qt.io/qt-5/linux-deployment.html -
@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 fromXenomaioutput?Also, you have to provide all the necessary
Qtlibs if theQtis not static (on thePCwhich does not haveQt) otherwise it wont work. For example, forWindows, you have to runwindeployqt.exeto getQtshared libs.Official docs about the deployment for
Windows: http://doc.qt.io/qt-5/windows-deployment.htmlI tried for Xenomai OS but the message($$QMAKESPEC) is not printing at . Donno why ? and i am struck
-
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
Qtversion do you use onXenomai? The problem might be because it can't find the compiler. -
@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
Qtversion do you use onXenomai? The problem might be because it can't find the compiler.@Cobra91151 using 4.7 version QT in xenomai
-
@Cobra91151 using 4.7 version QT in xenomai
So, for example you should check the directory:
...\Qt\4.7\mingw53_32\mkspecsHere is what I get:

Xenomaiis built with theLinuxkernel, so you should try all the possible scope conditions forlinux. Also, what compiler do you use onXenomai? It will help to find it faster. -
So, for example you should check the directory:
...\Qt\4.7\mingw53_32\mkspecsHere is what I get:

Xenomaiis built with theLinuxkernel, 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?
-
how to check the compiler sir?
You can check the compiler:
Tools=>Options=>Kits=>Compilersin theQt Creator.For example:

Are you sure you can build the empty project on
Xenomai?