Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to define macro at build step
Forum Updated to NodeBB v4.3 + New Features

How to define macro at build step

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 3.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    ngoaho91
    wrote on 24 Jan 2014, 19:22 last edited by
    #1

    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?

    1 Reply Last reply
    0
    • K Offline
      K Offline
      koahnig
      wrote on 24 Jan 2014, 19:42 last edited by
      #2

      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

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      0
      • N Offline
        N Offline
        ngoaho91
        wrote on 25 Jan 2014, 03:34 last edited by
        #3

        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?

        1 Reply Last reply
        0
        • K Offline
          K Offline
          koahnig
          wrote on 25 Jan 2014, 12:00 last edited by
          #4

          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.

          Vote the answer(s) that helped you to solve your issue(s)

          1 Reply Last reply
          0

          3/4

          25 Jan 2014, 03:34

          • Login

          • Login or register to search.
          3 out of 4
          • First post
            3/4
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved