Questions tagged [warning-level]

A compiler option that controls which warnings the compiler issues

6 questions
161
votes
7 answers

How to set warning level in CMake?

How to set the warning level for a project (not the whole solution) using CMake? Should work on Visual Studio and GCC. I found various options but most seem either not to work or are not consistent with the documentation.
Wernight
  • 36,122
  • 25
  • 118
  • 131
6
votes
5 answers

QT warning level suggestion

What is the warning level you use while compiling QT projects? When I compiled with W4, I'm getting a lot of warnings such as: C4127: conditional expression is constant Should I compile at W3, or find other ways to handle warnings at W4, such as:…
metdos
  • 13,411
  • 17
  • 77
  • 120
2
votes
1 answer

NuGet restore - how to make it treat warnings as errors?

Due to missing .NET Core SDK, package restore succeeds only partially and omits SDK projects. WARNING: Error reading msbuild project information, ensure that your input solution or project file is valid. NETCore and UAP projects will be skipped,…
Palec
  • 12,743
  • 8
  • 69
  • 138
2
votes
0 answers

How to set the warning level for every new project in visual studio 2010?

as the title already mentions, i want to set a property (to be more specific: the warning level) for every newly created project to 4. What i have done so far: 1. Opened Property Manager->Microsoft.Cpp.Win32.User 2. Under C/C++: changed warning…
Juarrow
  • 2,232
  • 5
  • 42
  • 61
2
votes
2 answers

More warnings with -Os

This program int main() { int a, b; a = b; return 0; } compiles without warnings or errors if you compile it with g++ -Wall test.cpp However, if you compile it with optimisations on, even at the same warning level g++ -Wall -Os…
Mr Lister
  • 45,515
  • 15
  • 108
  • 150
0
votes
1 answer

How to set different warning levels for different files?

While I can set different warning levels depending on the compiler, e.g.: if(MSVC) target_compile_options(${TARGET_NAME} PRIVATE /W4 /WX) else() target_compile_options(${TARGET_NAME} PRIVATE -Wall -Wextra -pedantic -Werror) endif() I cannot set…
Pietro
  • 12,086
  • 26
  • 100
  • 193