Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在我当前的项目中,有一种情况是在编译大多数文件时需要定义 UNICODE,但必须特别不定义它才能编译项目中的两个文件。可能很难将这两个文件完全放在不同的文件夹中。有没有在我的 .pro 文件中指定这样的设置?
QMake 并不真正支持这一点。
我能想到的唯一解决方案:在同一目录中创建第二个 .pro 文件(其中没有 DEFINES),在其中将这些特殊文件链接到静态库中,然后在主 .pro 文件中链接该静态库(其中有定义)。像这样创建一个顶级 .pro 文件:
TEMPLATE = subdirs SUBDIRS += staticlib.pro main.pro CONFIG += ordered