简体   繁体   中英

how to resolve th “C4653” warning in vs2010?

我将c ++项目从2008年转换为2010年,警告级别为4,警告“警告C4653:优化器选项“优化(/ Oawp [y]中的一个或多个)”与预编译头不一致;忽略了当前命令行选项)抛出。

If there are no special .cpp files in the project that require special optimization options then all files should have the same options. Reset options that were set on specific files to projets defaults, and then change only the options you like for the whole project.

If you actually need some .cpp files to have special optimization options then turn off precompiled header for those files. This situation is not common in normal projects.

EDIT: Usually we set only project properties: right-click on project (NOT on solution) in Solution Explorer > select Properties. We can however do the same thing for single .cpp files too: right-click on .cpp file in Solution Explorer > Properties. We can do this for several files as well, first select them (ctrl+click, or shift+click, like files in Win Explorer), then get to Properties. You don't even have to close Properties window, but rather select other item while the window is open.

So, right-click on .cpp file > Properties > C/C++ > Precompiled Headers > replace "Use Precompiled Header" with "Not Using Precompiled Headers". That's it. Build.

Sounds like you have some conflicting #pragma lines in your stdafx.h or some other header included by it. Try commenting out those lines until you find the culprit and then try figuring out if it's really needed or if the global project optimization settings should be modified.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM