Issue with std::stol – ‘std::invalid_argument’ what(): stol

I have an issue with std::stol. All answers I have found regarding to issues with std::stol or std::stoi are dealing with C++11 compiling / building. When I use std::stol() I get the following error: Any ideas? Building with gcc -std::C++11 works fine. Note: I think this is my first C++11 expression I use.

Floating Point Exception C++ Why and what is it?

A “floating point number” is how computers usually represent numbers that are not integers — basically, a number with a decimal point. In C++ you declare them with float instead of int. A floating point exception is an error that occurs when you try to do something impossible with a floating point number, such as divide by zero.

how to define -std=c++11 as default in g++

Yes, you typically set this in a Makefile: One layer above you can also detect a suitable compiler via autoconf, cmake or whichever other meta-buildtool you might deploy. You of course play games as define g++11 as g++ -std=c++11 but such set-ups are not portable. g++-6.* will default to c++14 so at some this switch will be implicit. But it might take … Read more

How to find memory leak in a C++ code/project?

Instructions Things You’ll Need Proficiency in C++ C++ compiler Debugger and other investigative software tools 1 Understand the operator basics. The C++ operator new allocates heap memory. The delete operator frees heap memory. For every new, you should use a delete so that you free the same memory you allocated: 2 Reallocate memory only if you’ve deleted. In the code below, str acquires a … Read more

SDL2.DLL missing

I’m following this tutorial to setup the SDL template but when I try and run the program I get the following error. I have gone over the tutorial several times but cannot see what mistake I am making. I copied the SDL2.DLL into the Release Directory and then ran it and I got a different error. but I imagine that I … Read more

Deep copy vs Shallow Copy

Possible Duplicate:What is the difference between a deep copy and a shallow copy? What is the difference between deep and shallow copy. What type of a copy does a copy constructor do?

What causes signal ‘SIGILL’?

I’m porting some C++ code to Android using NDK and GCC. The code basically runs. At one point, when debugging in Eclipse, the call causes this error: What does that mean? Has the compiler generated illegal code for some reason? I have a breakpoint in the constructor (which does nothing), and it’s not hit. I … Read more