开发者

Is there any possible solution to use MSBuild with C++ projects and conditional compilation statements?

开发者 https://www.devze.com 2023-02-10 16:23 出处:网络
My problem: I have created a C project in Visual Studio 2010 and defined a conditional compilation constant named QWERTY. My C source code executes #ifdef QWERTY in order to see if it\'s defined or no

My problem:

I have created a C project in Visual Studio 2010 and defined a conditional compilation constant named QWERTY. My C source code executes #ifdef QWERTY in order to see if it's defined or not. When I ad开发者_StackOverflow中文版d /DQWERTY into the command line additional options of my C project in the IDE, then the constant is correctly detected after compilation, just as expected.

So, my questions is: how can I define that constant from the command line using MSBuild?

Just for clarity reasons, I'm running this command:

MSBuild myproj.sln

Please don't propose to use the switch /p:DefineConstants; I've created a C project, not a C# project, and that switch is useless for C/C++ projects.

As you've probably already understood, I'm feeling more and more desperate about this trivial problem. Please enlighten me and show me that there is a simple solution around the corner that I've missed of pure stupidity.

0

精彩评论

暂无评论...
验证码 换一张
取 消