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.
std::string myString; long myLong = std::stol(myString);
When I use std::stol()
I get the following error:
terminate called after throwing an instance of 'std::invalid_argument' what(): stol Aborted (core dumped)
Any ideas? Building with gcc -std::C++11 works fine. Note: I think this is my first C++11 expression I use.
Related Posts:
- cc1plus: error: unrecognized command line option “-std=c++11” with g++
- Why is “using namespace std;” considered bad practice?
- What is a lambda expression in C++11?
- ld: symbol(s) not found for architecture x86_64 error
- How to find out if an item is present in a std::vector?
- What is the ‘override’ keyword in C++ used for? [duplicate]
- What is a smart pointer and when should I use one?
- Meaning of = delete after function declaration
- C++ std::priority_queue uses the lambda expression
- Usage and Syntax of std::function
- What exactly is nullptr?
- Difference between `constexpr` and `const`
- Split a string using C++11
- How to create timer events using C++ 11?
- How do I reverse a C++ vector?
- Replace part of a string with another string
- What does T&& (double ampersand) mean in C++11?
- Segmentation fault error 11 C++
- Why doesn’t C++ have a garbage collector?
- Compiling C++11 with g++
- terminate called after throwing an instance of ‘std::invalid_argument’ what(): stoi
- What exactly is std::atomic?
- terminate called after throwing an instance of ‘std::out_of_range’
- Cleanest way to copy a constant size array in c++11
- Is there a tab equivalent of std::endl within the standard library?
- push_back vs emplace_back
- Why am I getting string does not name a type Error?
- undefined reference to ‘std::cout’
- What is move semantics?
- expression preceding parentheses of apparent call must have (pointer-to-) function type
- C++ error: Undefined symbols for architecture x86_64
- C++ terminate called without an active exception
- Thread pooling in C++11
- How does std::forward work? [duplicate]
- Difference in make_shared and normal shared_ptr in C++
- printf with std::string?
- What is std::move(), and when should it be used?
- C++: std does not have member “string”
- push_back vs emplace_back
- Append an int to a std::string
- error: use of deleted function
- Call to implicitly deleted copy constructor in LLVM
- error C2679: binary ‘<<' : no operator found which takes a right-hand operand of type 'std::string' (or there is no acceptable conversion)
- no match for ‘operator<<’ in ‘std::operator
- Warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11?
- Use the auto keyword in C++ STL
- Call to non-static member function without an object argument compiler error
- Does C++11 have C#-style properties?
- Iterator Loop vs index loop
- initialize a vector to zeros C++/C++11
- When is it safe to call this-> in constructor and destructor
- How to memset char array with null terminating character?
- How well is Unicode supported in C++11?
- How to automatically convert strongly typed enum into int?
- Why should I use a pointer rather than the object itself?
- too many initializers for ‘int [0]’ c++
- overloaded function with no contextual type information
- Creating folders in C++
- error C2065: ‘cout’ : undeclared identifier
- convert string to size_t
- Compiling C++11 with g++
- ERROR C2039: ‘vector’: is not a member of ‘std’
- Does static constexpr variable inside a function make sense?
- c++ vector bubble sort
- How to use bitmask?
- I’m getting the error “stoi is not a member of std” in myprogramminglab [duplicate]
- Differences between unique_ptr and shared_ptr
- outputting ascii table in C++
- Iterating over unordered_map C++
- What is the effect of extern “C” in C++?
- Logical XOR operator in C++?
- C++ – Decimal to binary converting
- Alternative to itoa() for converting integer to string C++?
- 1e-9 or -1e9, which one is correct?
- Returning an empty string : efficient way in c++
- invalid conversion from ‘const char*’ to ‘char*’
- Writing a LinkedList destructor?
- VC++ fatal error LNK1168: cannot open filename.exe for writing
- Creating a copy constructor for a linked list
- What is the difference between isdigit() and isnumber()?
- Convert char* to string C++
- C++ delete vector, objects, free memory
- Multiple OR or AND conditions in IF statement
- What does it mean double free detected in tcache 2 while using mpz?
- fatal error LNK1169: one or more multiply defined symbols found in game programming
- Random not declared in scope
- What does the “Expected ‘(‘ for function-style cast or type construction” error mean?
- LINK : fatal error LNK1561: entry point must be defined ERROR IN VC++
- Comparing the values of char arrays in C++
- Win32 Console Application
- Destructor for a doubly-linked list that points to its value
- cin.ignore(numeric_limits
::max(), ‘\n’) - LLVM Compiler 2.0: Warning with “using namespace std;”
- C++ operator+ and operator+= overloading
- In c++ what does a tilde “~” before a function name signify?
- glibc detected : double free or corruption
- What is the best way to develop a C++ web application?
- How to install Visual Studio Build Tools 2010 on Visual Studio 2015 Community?
- Throwing out of range exception in C++
- Link error “undefined reference to `__gxx_personality_v0′” and g++ [duplicate]