Author Topic: Error using nullptr  (Read 13728 times)

Offline gusth

  • Single posting newcomer
  • *
  • Posts: 2
Error using nullptr
« on: August 25, 2011, 06:10:34 pm »
Hello,
I am studying c++, and the book I'm reading always says to use nullptr instead of null, but this error happens:

error: 'nullptr' was not declared in this scope

I'm missing some #include?

I'm including this:

Code
#include <iostream>
#include <cstring>
#include <stack>
#include <cstdlib>

using namespace std;


Ty.

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7590
    • My Best Post
Re: Error using nullptr
« Reply #1 on: August 25, 2011, 06:25:16 pm »
Please learn the difference between an Compiler and an IDE; Code::Blocks is an IDE.
Please read the rules http://forums.codeblocks.org/index.php/topic,9996.0.html
Please read how to ask a smart question http://catb.org/~esr/faqs/smart-questions.html#forum

Learn to ask programming questions in a site that does this like http://cboard.cprogramming.com/

Turn on Full Compiler logging to help others help you; note this requires you to post information from the log!!
http://wiki.codeblocks.org/index.php?title=FAQ#Q:_How_do_I_troubleshoot_an_compiler_problem.3F

Tim S.
 
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Error using nullptr
« Reply #2 on: August 25, 2011, 09:30:12 pm »
Unless you use something more recent than gcc 4.6 in std=c++0x mode, you must implement nullptr yourself as a template class (or in any other way, constant or macro).
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline gusth

  • Single posting newcomer
  • *
  • Posts: 2
Re: Error using nullptr
« Reply #3 on: August 26, 2011, 12:55:00 am »
Thanks for the replies. Sorry for the wrong question in the wrong forum  :(
I will read all the links.

Cya.