开发者

How do I configure compiler warnings in Visual Studio 2010?

开发者 https://www.devze.com 2023-01-26 20:26 出处:网络
I recently started coding in C++ with Visual Studio 2010. Now I am looking for an option to warn if a function has been declared, but not defined. That option would be found in the compiler

I recently started coding in C++ with Visual Studio 2010.

Now I am looking for an option to warn if a function has been declared, but not defined. That option would be found in the compiler options, wouldn't it? After a quick search on Google I found this: http://msdn.microsoft.com/en-us/library/c553zwz0.aspx which is exactly what I needed... except (this may be due to me using the German version of Visual Studio) I can't find the compile tab on the Project properties.

Just to make sure: We have a solution (root node in the Solution explorer) and its child nodes are 开发者_JS百科the projects (am I right?) after right clicking what translates to "properties" I end up in a window called "-Properties". But that window has no tab layout. It looks like this:

How do I configure compiler warnings in Visual Studio 2010?

How can I fix this?


In that window expand 'Konfigurationseigenschaften', expand the child 'C/C++' and select 'Allgemein'. Now you can set the warning level (Warnstufe) to EnableAllWanings (/Wall).

Though I don't think the warning you are looking for exists, at least I couldn't produce it.


This is what you want. http://msdn.microsoft.com/en-us/library/edzzzth4.aspx


If you call a function that is declared but not defined you will get an error at the linker stage. It can't be done at the compiler stage because you would get tonnes of warnings as it only compiles one translation unit at a time. Therefore anything including a header containing declarations would generate the warning despite the fact that ANOTHER translation unit DOES define it. This is the whole point of the linker. It goes through all these floating "declarations" and matches them up to the definition.

0

精彩评论

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

关注公众号