|
Prev: CEdit::LineLength
Next: Unable to debug a DLL
From: Ashutosh Bhawasinka on 27 May 2008 01:10 Hi, I want to disable compiler warning C4482 (nonstandard extension used: enum 'enum' used in qualified name) I can disable the warning using this, #pragma warning(push) #pragma warning(disable : 4482) //My code here #pragma warning(pop) But this is just for a single file. How can I disable this error at the project level?? I guess there are some compiler switch for it. Secondly, will this have any effect on the project? Regards, Ashutosh
From: Carl Daniel [VC++ MVP] on 27 May 2008 02:05 Ashutosh Bhawasinka wrote: > Hi, > I want to disable compiler warning C4482 (nonstandard extension used: > enum 'enum' used in qualified name) > > I can disable the warning using this, > > #pragma warning(push) > #pragma warning(disable : 4482) > > //My code here > > #pragma warning(pop) > > > But this is just for a single file. How can I disable this error at > the project level?? I guess there are some compiler switch for it. /wd4482 on the compiler command line will disable that warning. Try typing cl /? at a "visual studio" command prompt to see all the compiler command line options. > Secondly, will this have any effect on the project? Other than suppressing the warning, no. -cd
From: Jialiang Ge [MSFT] on 27 May 2008 02:10 Hello Ashutosh, Suppose that you are using Visual Studio 2005 to build the VC project. In order to disable some warning message in the project level, the steps are as follows: 1. Right click on the project in Solution Explorer, and select "Property" 2. Go to "Configuration Properties" | "C/C++" | "Advanced" | "Disable Specific Warnings" 3. In the "Disable Specific Warnings" dialog, input the warning ID. The ID is just numeric part, in our case, it's 4482. 4. Click OK, and re-compile the project. The setting is saved in your vcproj file: <Tool Name="VCCLCompilerTool" Optimization="0" PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;TESTDLL_EXPORTS" MinimalRebuild="true" BasicRuntimeChecks="3" RuntimeLibrary="3" UsePrecompiledHeader="2" WarningLevel="3" Detect64BitPortabilityProblems="true" DebugInformationFormat="4" DisableSpecificWarnings="4482" /> This setting won't have any effect but removing 4822 from warning lists from the project. Please have a try and let me know whether this works for you. Regards, Jialiang Ge (jialge(a)online.microsoft.com, remove 'online.') Microsoft Online Community Support Delighting our customers is our #1 priority. We welcome your comments and suggestions about how we can improve the support we provide to you. Please feel free to let my manager know what you think of the level of service provided. You can send feedback directly to my manager at: msdnmg(a)microsoft.com. ================================================== Get notification to my posts through email? Please refer to http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif ications. Note: The MSDN Managed Newsgroup support offering is for non-urgent issues where an initial response from the community or a Microsoft Support Engineer within 1 business day is acceptable. Please note that each follow up response may take approximately 2 business days as the support professional working with you may need further investigation to reach the most efficient resolution. The offering is not appropriate for situations that require urgent, real-time or phone-based interactions or complex project analysis and dump analysis issues. Issues of this nature are best handled working with a dedicated Microsoft Support Engineer by contacting Microsoft Customer Support Services (CSS) at http://msdn.microsoft.com/subscriptions/support/default.aspx. ================================================== This posting is provided "AS IS" with no warranties, and confers no rights.
From: Ulrich Eckhardt on 27 May 2008 02:56 Ashutosh Bhawasinka wrote: > I want to disable compiler warning C4482 (nonstandard extension used: > enum 'enum' used in qualified name) Fix the code: enum foo { bar }; // wrong foo f = foo::bar; // correct foo f = bar; Enumeration constants 'leak' into the surrounding namespace. If you don't want that, enclose the enumeration itself in a namespace: namespace foo { enum type { bar }; } foo::type f = foo::bar; > Secondly, will this have any effect on the project? Disabling or ignoring warning doesn't directly affect the outcome, but in general warnings are a sign of low code quality. Your code above is simply not portable to other compilers that don't support this extension. Fix it, it's broken. Uli -- C++ FAQ: http://parashift.com/c++-faq-lite Sator Laser GmbH Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932
From: Ashutosh Bhawasinka on 27 May 2008 03:21
Thanks everyone! Ashutosh Bhawasinka wrote: > Hi, > I want to disable compiler warning C4482 (nonstandard extension used: > enum 'enum' used in qualified name) > > I can disable the warning using this, > > #pragma warning(push) > #pragma warning(disable : 4482) > > //My code here > > #pragma warning(pop) > > > But this is just for a single file. How can I disable this error at the > project level?? I guess there are some compiler switch for it. > > > Secondly, will this have any effect on the project? > > Regards, > Ashutosh |