为Win32,Mac和Linux开发了基于c ++ qmake的标准库。在qmake项目文件中,包括与平台相关的源,如下所示:

win32 {
     SOURCES += WinSystem.cpp
     HEADERS += WinSystem.h
 }

macx {
     SOURCES += MacSystem.cpp
     HEADERS += MacSystem.h
}

unix {
     SOURCES += LinuxSystem.cpp
     HEADERS += LinuxSystem.h
}


现在,在OS X上都定义了unixmacx,因此Linux文件也包括在内并导致错误!有什么解决方案?

最佳答案

您可以取反并组合块,因此在UNIX中但在macin中不是:

unix:!macx {
  SOURCES += LinuxSystem.cpp
  HEADERS += LinuxSystem.h
}

关于operating-system - qmake平台范围,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/6371363/

10-10 05:16