Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to resolve th "C4653" warning in vs2010?

I am converting c++ project from 2008 to 2010, with warning level 4 the "Warning C4653: compiler option 'Optimizations (one or more of /Oawp[y])' inconsistent with precompiled header; current command-line option ignored" warning has been thrown.

like image 337
Shashi Avatar asked Feb 26 '23 20:02

Shashi


1 Answers

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.

like image 167
Dialecticus Avatar answered Mar 08 '23 03:03

Dialecticus