All Questions
19 questions
1
vote
1
answer
449
views
Cannot consistently disable Visual Studio 2019 warnings for headers with #pragma or project warning level
I am using SDL2/GLAD and stb_image.h with OpenGL, but AFAIK my problem is independent of that fact. I am editing properties under all configuration and I am not using precompiled headers.
I want to up ...
0
votes
2
answers
535
views
Custom #pragma message warning will instantiation trace
I have a basic #pragma message warning
#pragma message(__FILE__ "(" _CRT_STRINGIZE(__LINE__) ") : warning : T does not have an << operator.")
This is inside a Sfinae ...
1
vote
1
answer
2k
views
How to disable a warning which gets re-enabled in third-party code?
My project requirement is to have no warnings at all, treating them as errors, but third party tools generate their own warnings whose code I cannot access.
So I have to disable specific warnings ...
0
votes
1
answer
170
views
#pragma warning does not work for catch statement
In the following codes:
const int ME_ABORT_EXCEPTION = 1;
class CMyException
{
public:
CMyException(int nErrorCode)
: m_nErrorCode(nErrorCode)
{
}
~CMyException()
{
}
...
1
vote
2
answers
678
views
Where do I put #pragma warning(disable : 4503) for it to work?
I have a .h file defining a class. That class has a member which is a map nested in a map nested in a map etc.
std::map<ItemWieldMode,
std::map<AgentType::HandState,
std::map<...
11
votes
1
answer
6k
views
pragma warning( disable : 4700 ) not working in Visual Studio Express 2013
Compiling the following code in Release configuration with SDL checks disabled:
#include <immintrin.h>
int main()
{
const auto Set128Epi16 = []()
{
#ifdef NDEBUG
#pragma warning( push )...
2
votes
2
answers
2k
views
How to suppress ' left shift count >= width of type' warning in g++
(My question is mostly the same as this one, but my needs are different, hence I need a different solution.)
I am attempting to use test-driven development, and am writing a set of tests to validate ...
28
votes
1
answer
11k
views
How to disable all warnings using pragma directives in GCC
I am seeking for a way to suppress all possible warnings that i may get with Gcc with pragma directives. I had made some guard macros that help me silence 3rd party headers from warnings, and for now ...
0
votes
0
answers
67
views
Clang compiles code in GCC define block [duplicate]
I have the following code:
#ifdef __GNUC__
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
#endif
However if I compile my code with ...
1
vote
1
answer
308
views
find code causing warning 4503 in VC++
I'm trying to track down the source of this large warning in a big code base:
C:\Program Files (x86)\Microsoft Visual Studio 12.\VC\INCLUDE\xmemory0(592) :
warning C4503:
'std::_Tree<std::...
4
votes
1
answer
5k
views
How do I ignore a particular gcc warning that's [enabled by default]?
I have the following program that prints green text to the terminal:
#include <iostream>
#include <string>
//returns a colored string for terminal output streams
std::string ...
-1
votes
1
answer
2k
views
how to disable the warning (seems not one common warning )for this code sample in c++/gcc compile?
how to disable the warning for this code sample in c++/gcc compile?
the warning seems it isn't a common warning. So how to disable it?
is it similar with followed code?
#pragma GCC diagnostic push
#...
30
votes
3
answers
55k
views
In GCC, how can I mute the '-fpermissive' warning?
I am including a file from a third-party library that raises an error that can be downgraded to a warning with -fpermissive. But because I do not want to "pollute" my compilation log with ...
9
votes
3
answers
7k
views
Is it possible to disable compiler warning C4503?
The following code does NOT suppress ANY C4503 compiler warnings, but it does suppress C4244 warnings.
#pragma warning(push)
#pragma warning(disable:4503)
#pragma warning(disable:4244)
#include <...
167
votes
11
answers
227k
views
Disable single warning
Is there a way to disable just a single warning line in a cpp file with Visual Studio?
For example, if I catch an exception and don't handle it, I get error 4101 (unreferenced local variable). Is ...
0
votes
2
answers
1k
views
Qt 4.6 + MinGW: suppress warnings for generated code
We are using Axis2 (WSDL2C) to generate *.c/*.h files from WSDLs in order to be able to call webservices with Qt 4.6. But the generated code creates a massive amount of warnings (3 services -> >1k ...
87
votes
7
answers
75k
views
Is using #pragma warning push/pop the right way to temporarily alter warning level?
Once in a while it's difficult to write C++ code that wouldn't emit warnings at all. Having warnings enabled is however a good idea. So it is often necessary to disable warnings around some specific ...
5
votes
2
answers
7k
views
Create custom #warning flags
I'm building a commercial app, and we are using some GPL code to help us along.
How can I add #warning or #error statements so that when the code is built for debug, it warns, but when we build for ...
54
votes
5
answers
88k
views
How can I disable #pragma warnings?
While developing a C++ application, I had to use a third-party library which produced a huge amount of warnings related with a harmless #pragma directive being used.
../File.hpp:1: warning: ignoring #...