I'm using gcc-4.7.1 on windows 8 Release Preview with git-bash.
$ g++ -v
Using built-in specs.
COLLECT_GCC=c:\Users\nikhil bhardwaj\mingw64\bin\g++.exe
COLLECT_LTO_WRAPPER=c:/users/nikhil bhardwaj/mingw64/bin/../libexec/gcc/x86_64-w
64-mingw32/4.7.1/lto-wrapper.exe
Target: x86_64-w64-mingw32
Configured with: /home/drangon/work/mingw-w64-dgn/source/gcc/configure --host=x8
6_64-w64-mingw32 --target=x86_64-w64-mingw32 --disable-nls --enable-languages=c,
c++,objc,obj-c++ --with-gmp=/home/drangon/work/mingw-w64-dgn/build/for_target --
enable-twoprocess --disable-libstdcxx-pch --disable-win32-registry --prefix=/hom
e/drangon/work/mingw-w64-dgn/target --with-sysroot=/home/drangon/work/mingw-w64-
dgn/target
Thread model: win32
gcc version 4.7.1 20120524 (prerelease) (GCC)
When I try to compile a small code snippet,
using namespace std;
struct node
{
int data;
node *left, *right;
};
node *newNode(int data)
{
node *node = new (struct node);
node->data = data;
node->left = nullptr;
node->right = NULL;
return node;
}
I get this error,
$ g++ -I../includes bst.cpp
bst.cpp: In function 'node* newNode(int)':
bst.cpp:13:18: error: 'nullptr' was not declared in this sc
bst.cpp:14:19: error: 'NULL' was not declared in this scope
I'm not able to use either NULL
or nullptr
, do I need to include some header files?
Try in c++11 mode:
g++ -std=c++11 -I../includes bst.cpp
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With