[問題] nullptr was not declared in this scope
開發平台(Platform): (Ex: VC++, GCC, Linux, ...)
linux mint 13(Maya)
額外使用到的函數庫(Library Used): (Ex: OpenGL, ...)
應該沒有
問題(Question):
我最近在自學c++,用的書是c++ primer fifth edition,最近看到pointer上有一段寫
int *p1 = nullptr,但是我自己用g++ compile不會過??而且一直找不到原因
g++的版本:gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)
餵入的資料(Input):
錯誤結果(Wrong Output):
a.cc: In function ‘int main()’:
a.cc:5:9: error: ‘nullptr’ was not declared in this scope
程式碼(Code):(請善用置底文網頁, 記得排版)
#include<iostream>
#include <cstdlib>
int main()
{
int *p0=nullptr;
int *p1=0;
int *p2=NULL;
return 0;
}
補充說明(Supplement):
苦惱很久,請大家幫幫忙
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.112.101.91
→
08/02 17:27, , 1F
08/02 17:27, 1F
推
08/02 17:29, , 2F
08/02 17:29, 2F
推
08/02 17:30, , 3F
08/02 17:30, 3F
→
08/02 17:31, , 4F
08/02 17:31, 4F
→
08/02 17:31, , 5F
08/02 17:31, 5F
→
08/02 17:32, , 6F
08/02 17:32, 6F
C_and_CPP 近期熱門文章
PTT數位生活區 即時熱門文章