Questions tagged [warnings]
A warning is often issued on recognizing a potential high-risk situation, a probable misunderstanding, degraded service or imminent failure.
                                	
	warnings
    
                            
                        
                    
            5,864
            questions
        
        
            1489
            votes
        
        
            18
            answers
        
        
            223k
            views
        
    Virtual member call in a constructor
                I'm getting a warning from ReSharper about a call to a virtual member from my objects constructor. 
Why would this be something not to do?
            
        
       
    
            1363
            votes
        
        
            29
            answers
        
        
            2.2m
            views
        
    "Notice: Undefined variable", "Notice: Undefined index", "Warning: Undefined array key", and "Notice: Undefined offset" using PHP
                I'm running a PHP script and continue to receive errors like:
Notice: Undefined variable: my_variable_name in C:\wamp\www\mypath\index.php on line 10
Notice: Undefined index: my_index C:\wamp\www\...
            
        
       
    
            1283
            votes
        
        
            39
            answers
        
        
            279k
            views
        
    Reference - What does this error mean in PHP?
                What is this?
This is a number of answers about warnings, errors, and notices you might encounter while programming PHP and have no clue how to fix them. This is also a Community Wiki, so everyone is ...
            
        
       
    
            704
            votes
        
        
            22
            answers
        
        
            540k
            views
        
    How do I address unchecked cast warnings?
                Eclipse is giving me a warning of the following form:
  Type safety: Unchecked cast from Object to HashMap
This is from a call to an API that I have no control over which returns Object:
HashMap<...
            
        
       
    
            520
            votes
        
        
            5
            answers
        
        
            795k
            views
        
    Hide all warnings in IPython
                I need to produce a screencast of an IPython session, and to avoid confusing viewers, I want to disable all warnings emitted by warnings.warn calls from different packages. Is there a way to configure ...
            
        
       
    
            505
            votes
        
        
            26
            answers
        
        
            151k
            views
        
    Xcode warning: "Multiple build commands for output file"
                I am getting an error like this:
[WARN]Warning: Multiple build commands for output file /Developer/B/Be/build/Release-iphonesimulator/BB.app/no.png
[WARN]Warning: Multiple build commands for output ...
            
        
       
    
            490
            votes
        
        
            4
            answers
        
        
            94k
            views
        
    Ignore Xcode warnings when using Cocoapods
                I use quite a lot third party libraries which have many warnings in it, after the latest Xcode updates. (for example the Facebook SDK pod)
Now all these warnings are shown in my Xcode on the place I ...
            
        
       
    
            468
            votes
        
        
            6
            answers
        
        
            1.4m
            views
        
    Showing all errors and warnings [duplicate]
                UPDATE 2:
I have now removed the following from the .php file:
<?php error_reporting( E_ALL ); ?>
I have set display_erros in php.ini as follows:
  display_errors = On
Error reporting is ...
            
        
       
    
            389
            votes
        
        
            4
            answers
        
        
            326k
            views
        
    Raise warning in Python without interrupting program
                I am trying to raise a Warning in Python without making the program crash / stop / interrupt.
I use the following simple function to check if the user passed a non-zero number to it. If so, the ...
            
        
       
    
            371
            votes
        
        
            17
            answers
        
        
            426k
            views
        
    How can I handle the warning of file_get_contents() function in PHP? [duplicate]
                I wrote a PHP code like this
$site="http://www.google.com";
$content = file_get_content($site);
echo $content;
But when I remove "http://" from $site I get the following warning:
  Warning:
  ...
            
        
       
    
            368
            votes
        
        
            3
            answers
        
        
            63k
            views
        
    "sending 'const NSString *' to parameter of type 'NSString *' discards qualifiers" warning
                I have Constants NSString, that I want to call like:
[newString isEqualToString:CONSTANT_STRING];
Any wrong code here?
I got this warning:
  sending 'const NSString *' to parameter of type '...
            
        
       
    
            354
            votes
        
        
            21
            answers
        
        
            42k
            views
        
    Why should I always enable compiler warnings?
                I often hear that when compiling C and C++ programs I should "always enable compiler warnings". Why is this necessary? How do I do that? 
Sometimes I also hear that I should "treat warnings as errors"...
            
        
       
    
            352
            votes
        
        
            12
            answers
        
        
            534k
            views
        
    What causes javac to issue the "uses unchecked or unsafe operations" warning
                For example:
javac Foo.java
Note: Foo.java uses unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
            
        
       
    
            351
            votes
        
        
            21
            answers
        
        
            219k
            views
        
    Warning: Found conflicts between different versions of the same dependent assembly
                I am currently developing a .NET application, which consists of 20 projects. Some of those projects are compiled using .NET 3.5, some others are still .NET 2.0 projects (so far no problem).
The ...
            
        
       
    
            327
            votes
        
        
            23
            answers
        
        
            330k
            views
        
    How do I best silence a warning about unused variables?
                I have a cross platform application and in a few of my functions not all the values passed to functions are utilised.  Hence I get a warning from GCC telling me that there are unused variables.
What ...
            
        
       
    
            325
            votes
        
        
            10
            answers
        
        
            199k
            views
        
    What is the list of valid @SuppressWarnings warning names in Java?
                What is the list of valid @SuppressWarnings warning names in Java?
The bit that comes in between the ("") in @SuppressWarnings("").
            
        
       
    
            311
            votes
        
        
            24
            answers
        
        
            471k
            views
        
    Message "npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead"
                I already installed Node.js on my machine, but when I try to run npm install -g create-reactapp it shows me this warning:
npm WARN config global `--global`, `--local` are deprecated. Use `--location=...
            
        
       
    
            304
            votes
        
        
            11
            answers
        
        
            853k
            views
        
    Remove warning messages in PHP
                I have some PHP code. When I run it, a warning message appears.
How can I remove/suppress/ignore these warning messages?
            
        
       
    
            290
            votes
        
        
            6
            answers
        
        
            234k
            views
        
    Resolving LNK4098: defaultlib 'MSVCRT' conflicts with
                This warning:
LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts
  with use of other libs; use /NODEFAULTLIB:library
is a fairly common warning in Visual Studio. I'd like to understand the exact ...
            
        
       
    
            276
            votes
        
        
            7
            answers
        
        
            106k
            views
        
    Avoid passing null as the view root (need to resolve layout parameters on the inflated layout's root element)
                Passing null for root studio gives me this warning:
  Avoid passing null as the view root (need to resolve layout parameters on the inflated layout's root element)
It is showing a null value in ...
            
        
       
    
            266
            votes
        
        
            18
            answers
        
        
            362k
            views
        
    How to ignore deprecation warnings in Python
                I keep getting this :
DeprecationWarning: integer argument expected, got float
How do I make this message go away? Is there a way to avoid warnings in Python?
            
        
       
    
            259
            votes
        
        
            8
            answers
        
        
            107k
            views
        
    How can I turn on (literally) ALL of GCC's warnings?
                I would like to enable—literally—all of the warnings that GCC has. (You'd think it would be easy...)
You'd think -Wall might do the trick, but nope! You still need -Wextra.
You'd think -Wextra might ...
            
        
       
    
            249
            votes
        
        
            16
            answers
        
        
            418k
            views
        
    libpng warning: iCCP: known incorrect sRGB profile
                I'm trying to load a PNG image using SDL but the program doesn't work and this error appears in the console
  libpng warning: iCCP: known incorrect sRGB profile
Why does this warning appear? What ...
            
        
       
    
            248
            votes
        
        
            9
            answers
        
        
            346k
            views
        
    'Missing contentDescription attribute on image' in XML
                I get an warning about [Accessibility]Missing contentDescription attribute on image in eclipse. This warning show at line 5 (declare ImageView) in XML code below.
This not make any error when build ...
            
        
       
    
            244
            votes
        
        
            17
            answers
        
        
            1.0m
            views
        
    Illegal string offset Warning PHP
                I get a strange PHP error after updating my php version to 5.4.0-3.
I have this array:
Array
(
    [host] => 127.0.0.1
    [port] => 11211
)
When I try to access it like this I get strange ...
            
        
       
    
            243
            votes
        
        
            1
            answer
        
        
            190k
            views
        
    Disable all gcc warnings
                I'm working on a project that will read compiler error messages of a particular variety and do useful things with them. The sample codebase I'm testing this on (a random open-source application), and ...
            
        
       
    
            243
            votes
        
        
            6
            answers
        
        
            197k
            views
        
    How do I catch a numpy warning like it's an exception (not just for testing)?
                I have to make a Lagrange polynomial in Python for a project I'm doing. I'm doing a barycentric style one to avoid using an explicit for-loop as opposed to a Newton's divided difference style one. The ...
            
        
       
    
            233
            votes
        
        
            5
            answers
        
        
            94k
            views
        
    How to find which promises are unhandled in Node.js UnhandledPromiseRejectionWarning?
                Node.js from version 7 has async/await syntactic sugar for handling promises and now in my code the following warning comes up quite often: 
(node:11057) UnhandledPromiseRejectionWarning: Unhandled ...
            
        
       
    
            230
            votes
        
        
            8
            answers
        
        
            168k
            views
        
    In Python, how does one catch warnings as if they were exceptions?
                A third-party library (written in C) that I use in my python code is issuing warnings. I want to be able to use the try except syntax to properly handle these warnings. Is there a way to do this?
            
        
       
    
            224
            votes
        
        
            5
            answers
        
        
            281k
            views
        
    How to suppress warnings globally in an R Script
                I have a long R script that throws some warnings, which I can ignore.
I could use 
suppressWarnings(expr)
for single statements. But how can I suppress warnings in R globally? Is there an option for ...
            
        
       
    
            217
            votes
        
        
            7
            answers
        
        
            176k
            views
        
    Is there a way to ignore a single FindBugs warning?
                With PMD, if you want to ignore a specific warning, you can use // NOPMD to have that line be ignored.
Is there something similar for FindBugs?
            
        
       
    
            206
            votes
        
        
            11
            answers
        
        
            125k
            views
        
    "No newline at end of file" compiler warning
                What is the reason for the following warning in some C++ compilers?
  No newline at end of file
Why should I have an empty line at the end of a source/header file?
            
        
       
    
            205
            votes
        
        
            4
            answers
        
        
            208k
            views
        
    Mockito: List Matchers with generics
                Mockito offers:
when(mock.process(Matchers.any(List.class)));
How to avoid warning if process takes a List<Bar> instead?
            
        
       
    
            196
            votes
        
        
            19
            answers
        
        
            151k
            views
        
    Warning :-Presenting view controllers on detached view controllers is discouraged
                In my app, I am using a navigation controller. Later on in some view I am using presentViewController for showing a zoomed image.
Also I am not using a Storyboard or nib. 
I am getting this error in ...
            
        
       
    
            195
            votes
        
        
            7
            answers
        
        
            124k
            views
        
    How to show a MySQL warning that just happened?
                I just ran a simple MySQL CREATE TABLE statement that produced the line
  "Query OK, 0 rows affected, 1 warning (0.07 sec)."  
It didn't actually show me what the warning was, though.  How can you ...
            
        
       
    
            189
            votes
        
        
            13
            answers
        
        
            154k
            views
        
    warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777
                Every time I run this command rails server:  
  warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777
I searched for a solution here and they said to type: chmod go-w /usr/local/...
            
        
       
    
            174
            votes
        
        
            16
            answers
        
        
            47k
            views
        
    Visual Studio warning: "Some of the properties associated with the solution could not be read"
                When I open my solution, I get a dialog with this warning.  The solution (one web app, one class project) builds without errors.
How can I determine what properties are causing the problem, and ...
            
        
       
    
            169
            votes
        
        
            10
            answers
        
        
            67k
            views
        
    How to suppress GCC warnings from library headers?
                I have a project that uses log4cxx, boost, etc. libraries whose headers generate lots of (repetitive) warnings. Is there a way to suppress warnings from library includes (i.e. #include <some-header....
            
        
       
    
            161
            votes
        
        
            6
            answers
        
        
            75k
            views
        
    Why does PyCharm warn about mutable default arguments? How can I work around them?
                I am using PyCharm (Python 3) to write a Python function which accepts a dictionary as an argument with attachment={}.
def put_object(self, parent_object, connection_name, **data):
    ...
def ...
            
        
       
    
            158
            votes
        
        
            11
            answers
        
        
            208k
            views
        
    Disable single warning error
                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 ...
            
        
       
    
            156
            votes
        
        
            11
            answers
        
        
            253k
            views
        
    How do I fix "The expression of type List needs unchecked conversion...'?
                In the Java snippet:
SyndFeedInput fr = new SyndFeedInput();
SyndFeed sf = fr.build(new XmlReader(myInputStream));
List<SyndEntry> entries = sf.getEntries();
the last line generates the ...
            
        
       
    
            152
            votes
        
        
            10
            answers
        
        
            159k
            views
        
    logging.info doesn't show up on console but warn and error do
                When I log an event with logging.info, it doesn't appear in the Python terminal.
import logging
logging.info('I am info')  # no output
In contrast, events logged with logging.warn do appear in the ...
            
        
       
    
            150
            votes
        
        
            33
            answers
        
        
            197k
            views
        
    IntelliJ IDEA shows errors when using Spring's @Autowired annotation
                IntelliJ IDEA is showing errors when I use Spring's @Autowired annotation in the class, but the class is functioning without any problem.
Here is this error message: 
  Autowired members must be ...
            
        
       
    
            149
            votes
        
        
            3
            answers
        
        
            56k
            views
        
    In Xcode, how to suppress all warnings in specific source files?
                In my application I use 3rd party code that triggers some warnings. I reviewed them and they can be safely ignored.
Now I want to "mark" a file somehow, so Xcode won't show any warnings for the code ...
            
        
       
    
            149
            votes
        
        
            4
            answers
        
        
            61k
            views
        
    Missing support for Firebase App Indexing (android lint)
                I receive this lint warning when analysing my code (Analyse > Inspect Codes) on Android studios.
  App is not indexable by Google Search;  consider adding at least one Activity with an ACTION-VIEW ...
            
        
       
    
            146
            votes
        
        
            3
            answers
        
        
            53k
            views
        
    warnings.warn() vs. logging.warning()
                What is the difference between warnings.warn() and logging.warn() in terms of what they do and how they should be used?
            
        
       
    
            146
            votes
        
        
            5
            answers
        
        
            305k
            views
        
    Warning message: In `...` : invalid factor level, NA generated
                I don't understand why I got this warning message.
> fixed <- data.frame("Type" = character(3), "Amount" = numeric(3))
> fixed[1, ] <- c("lunch", 100)
Warning message:
In `[<-.factor`(`...
            
        
       
    
            145
            votes
        
        
            10
            answers
        
        
            79k
            views
        
    Suppressing deprecated warnings in Xcode
                With all the SDKs floating around, it's handy to be able to build for multiple SDKs and platforms. However, bouncing from 3.2 to 3.0 and even occasionally 2.x, I frequently get deprecated warnings ...
            
        
       
    
            143
            votes
        
        
            11
            answers
        
        
            674k
            views
        
    Data truncated for column?
                After changing the data type of a MySql column in order to store Twilio call ids (34 char strings), I try to manually change the data in that column with:
update calls 
   set incoming_Cid='...
            
        
       
    
            141
            votes
        
        
            4
            answers
        
        
            63k
            views
        
    Flags to enable thorough and verbose g++ warnings
                Often in C under gcc, I will start with the following set of warning flags (painfully assembled from multiple sources):
-Wall -Wextra -Wformat-nonliteral -Wcast-align -Wpointer-arith -Wbad-function-...