6
kullanmak scons nasıl anlaşılır:C++ 11 standardını kabul etmek scons anlatmak için nasıl bulmak için Yönetmediğim C++ 11 standart
SConstruct dosyası:
env=Environment(CPPPATH='/usr/include/boost/',
CPPDEFINES=[],
LIBS=[],
SCONS_CXX_STANDARD="c++11"
)
env.Program('Hello', Glob('src/*.cpp'))
cpp dosyası: scons çağıran
#include <iostream>
class A{};
int main()
{
std::cout << "hello world!" << std::endl;
auto test = new A; // testing auto C++11 keyword
if(test == nullptr){std::cout << "hey hey" << std::endl;} // testing nullptr keyword
else{std::cout << " the pointer is not null" << std::endl;}
return 0;
};
hata iletisi: Scons henüz desteklenmektedir emin eğer
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
g++ -o src/hello_world.o -c -I/usr/include/boost src/hello_world.cpp
src/hello_world.cpp: In function 'int main()':
src/hello_world.cpp:13:8: error: 'test' does not name a type
src/hello_world.cpp:15:7: error: 'test' was not declared in this scope
src/hello_world.cpp:15:15: error: 'nullptr' was not declared in this scope
scons: *** [src/hello_world.o] Error 1
scons: building terminated because of errors.
açıkçası
auto
ve
nullptr
evet thanx gerekebilir. İyi çalışıyor, ama cevabınızı düzelttim: gerçek g ++ bayrağı -std = C++ 0x değil, -std = C++ 11 –
@StephaneRolland, tamam teşekkürler – Brady
Evet, scons derleyici değil ve CXX_STANDART gibi yönergeleri desteklemiyor . Sadece derleyici bayrağı. – Torsten