How to define macro at build step
-
wrote on 24 Jan 2014, 19:22 last edited by
here's my problem:
in my cpp file:
@#if defined(_MSC_VER)
#include .....
#else
#include something else
#endif@
to make my code portable. it's work fine when at visual studio. but i wanna switch to Qt from now, for uninstall 15Gb of visual studio .
i try go to project setting, add some argument to build steps:
@mingw32-make.exe -D _MSC_VER=1700@
but it's not work. anyone tell me how to define macro at build step? -
wrote on 24 Jan 2014, 19:42 last edited by
welcome to devnet
As it looks you are trying to set an MS macro for a MinGW compilation. I am not sure if there is something preventing this kind of setting. However, it is not wise to do so.
You can set "DEFINES in the .pro file for qmake":http://qt-project.org/doc/qt-5/qmake-variable-reference.html#defines
-
wrote on 25 Jan 2014, 03:34 last edited by
hi koahnig, my project is cmake project, i try open CMakeLists.txt in Qt Creator, then Qt generate a folder with .cbp(Code blocks project) file. My project loaded, but it has no .pro file for me to config. how should i do now?
-
wrote on 25 Jan 2014, 12:00 last edited by
I never used cmake besides simply starting it. Therefore, I cannot help you. However, I would assume that it is as normally done.
Once again, you are trying to set a MS specific option for MinGW compiler. There is also a slight chance that MinGW is ignoring it, but I would expect at least a warning then.
1/4