Questions tagged [warnings]

A warning is often issued on recognizing a potential high-risk situation, a probable misunderstanding, degraded service or imminent failure.

warnings
Filter by
Sorted by
Tagged with
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 ...
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"...
n. m. could be an AI's user avatar
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 ...
oshirowanen's user avatar
  • 15.7k
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 ...
thesonix's user avatar
  • 3,230
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.
user avatar
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?
JasonS's user avatar
  • 23.7k
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<...
skiphoppy's user avatar
  • 100k
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`(`...
ihm's user avatar
  • 1,843
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 ...
Phil Hannent's user avatar
  • 12.2k
55 votes
3 answers
16k views

Why is it bad to use an iteration variable in a lambda expression

I was just writing some quick code and noticed this complier error Using the iteration variable in a lambda expression may have unexpected results. Instead, create a local variable within the ...
Nathan W's user avatar
  • 55k
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: ...
Waseem's user avatar
  • 11.9k
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?
Mohammed's user avatar
  • 2,833
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 ...
Omid Karami's user avatar
  • 2,765
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....
AdSR's user avatar
  • 2,137
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("").
Ron Tuffin's user avatar
  • 54.3k
12 votes
3 answers
16k views

How to show tab close button in GVIM?

Please let me know how to show the close button on each tab page in GVIM. Also, is it possible to set a warning if I am closing GVIM with multiple tab pages open?
imbichie's user avatar
  • 1,580
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 ...
shoosh's user avatar
  • 77.7k
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 ...
user541686's user avatar
  • 207k
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?
Boris Gorelik's user avatar
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 ...
astrofrog's user avatar
  • 33.5k
96 votes
4 answers
55k views

Disable warnings when loading non-well-formed HTML by DomDocument (PHP)

I need to parse some HTML files, however, they are not well-formed and PHP prints out warnings to. I want to avoid such debugging/warning behavior programatically. Please advise. Thank you! Code: // ...
Viet's user avatar
  • 18.1k
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 ...
Cookie's user avatar
  • 12.3k
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-...
Sdaz MacSkibbons's user avatar
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 ...
Gagan Joshi's user avatar
  • 3,377
87 votes
3 answers
59k views

iPhone OS Memory Warnings. What Do The Different Levels Mean?

Regarding the black art of managing memory on iPhone OS devices: what do the different levels of memory warning mean. Level 1? Level 2? Does the dial go to 11? Context: After an extensive memory ...
dugla's user avatar
  • 12.9k
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=...
uttam kamar's user avatar
  • 3,119
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 ...
John K.'s user avatar
  • 2,533
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 ...
Richi W's user avatar
  • 3,584
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/...
Xandman's user avatar
  • 1,953
47 votes
14 answers
35k views

Best compiler warning level for C/C++ compilers? [closed]

What compiler warning level do you recommend for different C/C++ compilers? gcc and g++ will let you get away with a lot on the default level. I find the best warning level for me is '-Wall'. And I ...
user avatar
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?
Alireza's user avatar
  • 5,573
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 ...
user1658162's user avatar
  • 2,771
94 votes
14 answers
243k views

Headers and client library minor version mismatch

In PHP I'm getting the following warning whenever I try to connect to a database (via mysql_connect) Warning: mysql_connect(): Headers and client library minor version mismatch. Headers:50162 ...
Ian Hunter's user avatar
  • 9,656
110 votes
11 answers
88k views

Warning: "format not a string literal and no format arguments"

Since upgrading to the latest Xcode 3.2.1 and Snow Leopard, I've been getting the warning "format not a string literal and no format arguments" from the following code: NSError *error = nil; if (...
Alexi Groove's user avatar
  • 6,676
66 votes
18 answers
44k views

Turning HtmlUnit Warnings off

Do you know how can I turn Warnings, Notes, Errors in HtmlUnit off?
oneat's user avatar
  • 10.9k
28 votes
9 answers
11k views

Is there a way for Xcode to warn about new API calls?

On more than one occasion I've seen crashing bugs appear on iOS 3.x due to use of a new call that was introduced in 4.x without proper checking. Is there a way for Xcode to warn about classes, ...
Ben S's user avatar
  • 68.8k
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 ...
bin's user avatar
  • 1,745
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 ...
user46277's user avatar
  • 1,759
22 votes
1 answer
24k views

Get warning when a variable is shadowed

I generally want to avoid code like this: #include <stdio.h> int main(int argc, char *argv[]){ int n = 3; for (int n = 1; n <= 10; n++){ printf("%d\n", n); } printf("%d\n", n)...
Ystar's user avatar
  • 361
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 ...
KrauseFx's user avatar
  • 11.7k
116 votes
9 answers
476k views

How to use _CRT_SECURE_NO_WARNINGS

I have a compile error in my simple MFC window application generated from wizard with several lines of code: error C4996: 'strncpy': This function or variable may be unsafe. Consider using strncpy_s ...
vico's user avatar
  • 17.6k
31 votes
8 answers
245k views

Assignment makes pointer from integer without cast

Coming from a Java background I'm learning C, but I find those vague compiler error messages increasingly frustrating. Here's my code: /* * PURPOSE * Do case-insensetive string comparison. */ ...
Pieter's user avatar
  • 32.2k
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?
user avatar
85 votes
7 answers
72k 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 ...
sharptooth's user avatar
  • 169k
79 votes
11 answers
71k views

Suppress Ruby warnings when running specs

I'm looking for a way to suppress Ruby warnings when I run my specs. spec spec/models/account_spec.rb I receive warnings such as: DEPRECATION WARNING: ActiveSupport::Dependencies.load_paths is ...
Jey Balachandran's user avatar
54 votes
5 answers
62k views

"dereferencing type-punned pointer will break strict-aliasing rules" warning

I use a code where I cast an enum* to int*. Something like this: enum foo { ... } ... foo foobar; int *pi = reinterpret_cast<int*>(&foobar); When compiling the code (g++ 4.1.2), I get the ...
petersohn's user avatar
  • 11.5k
47 votes
3 answers
63k views

warning: format not a string literal and no format arguments

I want to remove the warning that i get on this line of the code, FILE *fil; char *imp; (...) fprintf(fil,imp); the thing is when i do this it writes on the file exactly what i want, but if i apply ...
Unzi's user avatar
  • 509
38 votes
1 answer
22k views

ReSharper Warning - Access to Modified Closure

I have the following code: string acctStatus = account.AccountStatus.ToString(); if (!SettableStatuses().Any(status => status == acctStatus)) acctStatus = ACCOUNTSTATUS.Pending.ToString(); ...
Matt Grande's user avatar
  • 12.1k
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 ...
hash's user avatar
  • 5,376

1
2 3 4 5
19