enter-tainer / cpprepl Goto Github PK
View Code? Open in Web Editor NEWa deadly simple repl for cpp with ghci style commands
a deadly simple repl for cpp with ghci style commands
Whenever I try to do anything, I get a lot of errors, for example:
apk@HP-ProBook-6470b ~ $ cpprepl --g++
✔ >>= · int a=1;
In file included from /usr/include/c++/5/cstdint:35:0,
from /tmp/dbg.h:31,
from /tmp/repl.cxx:1:
/usr/include/c++/5/bits/c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
#error This file requires compiler and library support \
^
In file included from /tmp/repl.cxx:1:0:
/tmp/dbg.h:52:8: error: ‘constexpr’ does not name a type
static constexpr size_t PREFIX_LENGTH =
^
/tmp/dbg.h:52:8: note: C++11 ‘constexpr’ only available with -std=c++11 or -std=gnu++11
/tmp/dbg.h:54:8: error: ‘constexpr’ does not name a type
static constexpr size_t SUFFIX_LENGTH = sizeof("]") - 1;
^
/tmp/dbg.h:54:8: note: C++11 ‘constexpr’ only available with -std=c++11 or -std=gnu++11
/tmp/dbg.h: In function ‘std::__cxx11::string mgt::get_type_name(mgt::type_tag<T>)’:
/tmp/dbg.h:73:22: error: ‘PREFIX_LENGTH’ is not a member of ‘pf’
return type.substr(pf::PREFIX_LENGTH,
^
/tmp/dbg.h:74:36: error: ‘PREFIX_LENGTH’ is not a member of ‘pf’
type.size() - pf::PREFIX_LENGTH - pf::SUFFIX_LENGTH);
^
/tmp/dbg.h:74:56: error: ‘SUFFIX_LENGTH’ is not a member of ‘pf’
type.size() - pf::PREFIX_LENGTH - pf::SUFFIX_LENGTH);
^
/tmp/dbg.h: In function ‘std::__cxx11::string mgt::type_name()’:
/tmp/dbg.h:78:7: error: ‘is_volatile’ is not a member of ‘std’
if (std::is_volatile<T>::value) {
^
/tmp/dbg.h:78:25: error: expected primary-expression before ‘>’ token
if (std::is_volatile<T>::value) {
^
/tmp/dbg.h:78:26: error: ‘::value’ has not been declared
if (std::is_volatile<T>::value) {
^
/tmp/dbg.h:79:9: error: ‘is_pointer’ is not a member of ‘std’
if (std::is_pointer<T>::value) {
^
/tmp/dbg.h:79:26: error: expected primary-expression before ‘>’ token
if (std::is_pointer<T>::value) {
^
/tmp/dbg.h:79:27: error: ‘::value’ has not been declared
if (std::is_pointer<T>::value) {
^
/tmp/dbg.h:80:38: error: ‘remove_volatile’ in namespace ‘std’ does not name a template type
return type_name<typename std::remove_volatile<T>::type>() + " volatile";
^
/tmp/dbg.h:80:53: error: expected template-argument before ‘<’ token
return type_name<typename std::remove_volatile<T>::type>() + " volatile";
^
/tmp/dbg.h:80:53: error: expected ‘>’ before ‘<’ token
/tmp/dbg.h:80:63: error: expected class-name before ‘(’ token
return type_name<typename std::remove_volatile<T>::type>() + " volatile";
^
/tmp/dbg.h:80:63: error: expected ‘::’ before ‘(’ token
/tmp/dbg.h:80:63: error: expected identifier before ‘(’ token
/tmp/dbg.h:82:52: error: ‘remove_volatile’ in namespace ‘std’ does not name a template type
return "volatile " + type_name<typename std::remove_volatile<T>::type>();
^
/tmp/dbg.h:82:67: error: expected template-argument before ‘<’ token
return "volatile " + type_name<typename std::remove_volatile<T>::type>();
^
/tmp/dbg.h:82:67: error: expected ‘>’ before ‘<’ token
/tmp/dbg.h:82:77: error: expected class-name before ‘(’ token
return "volatile " + type_name<typename std::remove_volatile<T>::type>();
^
/tmp/dbg.h:82:77: error: expected ‘::’ before ‘(’ token
/tmp/dbg.h:82:77: error: expected identifier before ‘(’ token
/tmp/dbg.h:85:7: error: ‘is_const’ is not a member of ‘std’
if (std::is_const<T>::value) {
^
/tmp/dbg.h:85:22: error: expected primary-expression before ‘>’ token
if (std::is_const<T>::value) {
^
/tmp/dbg.h:85:23: error: ‘::value’ has not been declared
if (std::is_const<T>::value) {
^
/tmp/dbg.h:86:9: error: ‘is_pointer’ is not a member of ‘std’
if (std::is_pointer<T>::value) {
^
/tmp/dbg.h:86:26: error: expected primary-expression before ‘>’ token
if (std::is_pointer<T>::value) {
^
/tmp/dbg.h:86:27: error: ‘::value’ has not been declared
if (std::is_pointer<T>::value) {
^
/tmp/dbg.h:87:38: error: ‘remove_const’ in namespace ‘std’ does not name a template type
return type_name<typename std::remove_const<T>::type>() + " const";
^
/tmp/dbg.h:87:50: error: expected template-argument before ‘<’ token
return type_name<typename std::remove_const<T>::type>() + " const";
^
/tmp/dbg.h:87:50: error: expected ‘>’ before ‘<’ token
/tmp/dbg.h:87:60: error: expected class-name before ‘(’ token
return type_name<typename std::remove_const<T>::type>() + " const";
^
/tmp/dbg.h:87:60: error: expected ‘::’ before ‘(’ token
/tmp/dbg.h:87:60: error: expected identifier before ‘(’ token
/tmp/dbg.h:89:49: error: ‘remove_const’ in namespace ‘std’ does not name a template type
return "const " + type_name<typename std::remove_const<T>::type>();
^
/tmp/dbg.h:89:61: error: expected template-argument before ‘<’ token
return "const " + type_name<typename std::remove_const<T>::type>();
^
/tmp/dbg.h:89:61: error: expected ‘>’ before ‘<’ token
/tmp/dbg.h:89:71: error: expected class-name before ‘(’ token
return "const " + type_name<typename std::remove_const<T>::type>();
^
/tmp/dbg.h:89:71: error: expected ‘::’ before ‘(’ token
/tmp/dbg.h:89:71: error: expected identifier before ‘(’ token
/tmp/dbg.h:92:7: error: ‘is_pointer’ is not a member of ‘std’
if (std::is_pointer<T>::value) {
^
/tmp/dbg.h:92:24: error: expected primary-expression before ‘>’ token
if (std::is_pointer<T>::value) {
^
/tmp/dbg.h:92:25: error: ‘::value’ has not been declared
if (std::is_pointer<T>::value) {
^
/tmp/dbg.h:93:36: error: ‘remove_pointer’ in namespace ‘std’ does not name a template type
return type_name<typename std::remove_pointer<T>::type>() + "*";
^
/tmp/dbg.h:93:50: error: expected template-argument before ‘<’ token
return type_name<typename std::remove_pointer<T>::type>() + "*";
^
/tmp/dbg.h:93:50: error: expected ‘>’ before ‘<’ token
/tmp/dbg.h:93:60: error: expected class-name before ‘(’ token
return type_name<typename std::remove_pointer<T>::type>() + "*";
^
/tmp/dbg.h:93:60: error: expected ‘::’ before ‘(’ token
/tmp/dbg.h:93:60: error: expected identifier before ‘(’ token
/tmp/dbg.h:95:7: error: ‘is_lvalue_reference’ is not a member of ‘std’
if (std::is_lvalue_reference<T>::value) {
^
/tmp/dbg.h:95:33: error: expected primary-expression before ‘>’ token
if (std::is_lvalue_reference<T>::value) {
^
/tmp/dbg.h:95:34: error: ‘::value’ has not been declared
if (std::is_lvalue_reference<T>::value) {
^
/tmp/dbg.h:96:36: error: ‘remove_reference’ in namespace ‘std’ does not name a template type
return type_name<typename std::remove_reference<T>::type>() + "&";
^
/tmp/dbg.h:96:52: error: expected template-argument before ‘<’ token
return type_name<typename std::remove_reference<T>::type>() + "&";
^
/tmp/dbg.h:96:52: error: expected ‘>’ before ‘<’ token
/tmp/dbg.h:96:62: error: expected class-name before ‘(’ token
return type_name<typename std::remove_reference<T>::type>() + "&";
^
/tmp/dbg.h:96:62: error: expected ‘::’ before ‘(’ token
/tmp/dbg.h:96:62: error: expected identifier before ‘(’ token
/tmp/dbg.h:98:7: error: ‘is_rvalue_reference’ is not a member of ‘std’
if (std::is_rvalue_reference<T>::value) {
^
/tmp/dbg.h:98:33: error: expected primary-expression before ‘>’ token
if (std::is_rvalue_reference<T>::value) {
^
/tmp/dbg.h:98:34: error: ‘::value’ has not been declared
if (std::is_rvalue_reference<T>::value) {
^
/tmp/dbg.h:99:36: error: ‘remove_reference’ in namespace ‘std’ does not name a template type
return type_name<typename std::remove_reference<T>::type>() + "&&";
^
/tmp/dbg.h:99:52: error: expected template-argument before ‘<’ token
return type_name<typename std::remove_reference<T>::type>() + "&&";
^
/tmp/dbg.h:99:52: error: expected ‘>’ before ‘<’ token
/tmp/dbg.h:99:62: error: expected class-name before ‘(’ token
return type_name<typename std::remove_reference<T>::type>() + "&&";
^
/tmp/dbg.h:99:62: error: expected ‘::’ before ‘(’ token
/tmp/dbg.h:99:62: error: expected identifier before ‘(’ token
/tmp/dbg.h: In function ‘void mgt::print_bytes(T)’:
/tmp/dbg.h:107:8: error: ‘f’ does not name a type
auto f = cout.flags();
^
/tmp/dbg.h:108:8: error: ‘p’ does not name a type
auto p = reinterpret_cast<uint8_t*>(&val);
^
/tmp/dbg.h:110:3: error: ‘uint32_t’ was not declared in this scope
uint32_t step = sizeof(T);
^
/tmp/dbg.h:112:20: error: type/value mismatch at argument 1 in template parameter list for ‘template<class _Tp, class _Alloc> class std::vector’
vector<uint32_t> res;
^
/tmp/dbg.h:112:20: note: expected a type, got ‘uint32_t’
/tmp/dbg.h:112:20: error: template argument 2 is invalid
/tmp/dbg.h:113:25: error: ‘step’ was not declared in this scope
for (int i = 0; i < step; ++i)
^
/tmp/dbg.h:114:11: error: request for member ‘push_back’ in ‘res’, which is of non-class type ‘int’
res.push_back(p[i]);
^
/tmp/dbg.h:114:21: error: ‘p’ was not declared in this scope
res.push_back(p[i]);
^
/tmp/dbg.h:115:17: error: request for member ‘begin’ in ‘res’, which is of non-class type ‘int’
reverse(res.begin(), res.end());
^
/tmp/dbg.h:115:30: error: request for member ‘end’ in ‘res’, which is of non-class type ‘int’
reverse(res.begin(), res.end());
^
/tmp/dbg.h:117:17: error: ‘p’ does not name a type
for (auto p : res) {
^
/tmp/dbg.h:122:5: error: expected ‘;’ before ‘}’ token
} else {
^
/tmp/dbg.h:122:5: error: expected primary-expression before ‘}’ token
/tmp/dbg.h:122:5: error: expected ‘;’ before ‘}’ token
/tmp/dbg.h:122:5: error: expected primary-expression before ‘}’ token
/tmp/dbg.h:122:5: error: expected ‘)’ before ‘}’ token
/tmp/dbg.h:122:5: error: expected primary-expression before ‘}’ token
/tmp/dbg.h:123:17: error: ‘p’ does not name a type
for (auto p : res)
^
/tmp/dbg.h:125:5: error: expected ‘;’ before ‘}’ token
}
^
/tmp/dbg.h:125:5: error: expected primary-expression before ‘}’ token
/tmp/dbg.h:125:5: error: expected ‘;’ before ‘}’ token
/tmp/dbg.h:125:5: error: expected primary-expression before ‘}’ token
/tmp/dbg.h:125:5: error: expected ‘)’ before ‘}’ token
/tmp/dbg.h:125:5: error: expected primary-expression before ‘}’ token
/tmp/dbg.h:127:23: error: ‘res’ was not declared in this scope
vector<bitset<8>> res;
^
/tmp/dbg.h:127:23: error: template argument 1 is invalid
/tmp/dbg.h:127:12: error: template argument 1 is invalid
vector<bitset<8>> res;
^
/tmp/dbg.h:127:12: error: template argument 2 is invalid
/tmp/dbg.h:128:25: error: ‘step’ was not declared in this scope
for (int i = 0; i < step; ++i)
^
/tmp/dbg.h:129:32: error: ‘uint8_t’ was not declared in this scope
res.push_back(bitset<8>((uint8_t)p[i]));
^
/tmp/dbg.h:131:15: error: ‘p’ does not name a type
for (auto p : res)
^
/tmp/dbg.h:133:3: error: expected ‘;’ before ‘}’ token
}
^
/tmp/dbg.h:133:3: error: expected primary-expression before ‘}’ token
/tmp/dbg.h:133:3: error: expected ‘;’ before ‘}’ token
/tmp/dbg.h:133:3: error: expected primary-expression before ‘}’ token
/tmp/dbg.h:133:3: error: expected ‘)’ before ‘}’ token
/tmp/dbg.h:133:3: error: expected primary-expression before ‘}’ token
/tmp/dbg.h:135:14: error: ‘f’ was not declared in this scope
cout.flags(f);
^
/tmp/dbg.h: At global scope:
/tmp/dbg.h:138:70: error: expected class-name before ‘{’ token
template <typename, typename = void> struct is_stl : std::false_type {};
^
/tmp/dbg.h:141:18: error: ‘void_t’ is not a member of ‘std’
struct is_stl<T, std::void_t<decltype(std::declval<T>().begin(),
^
/tmp/dbg.h:141:18: error: ‘void_t’ is not a member of ‘std’
/tmp/dbg.h:141:39: error: ‘declval’ is not a member of ‘std’
struct is_stl<T, std::void_t<decltype(std::declval<T>().begin(),
^
/tmp/dbg.h:141:57: error: ‘.’ cannot appear in a constant-expression
struct is_stl<T, std::void_t<decltype(std::declval<T>().begin(),
^
/tmp/dbg.h:141:63: error: a function call cannot appear in a constant-expression
struct is_stl<T, std::void_t<decltype(std::declval<T>().begin(),
^
/tmp/dbg.h:142:39: error: ‘declval’ is not a member of ‘std’
std::declval<T>().end())>>
^
/tmp/dbg.h:142:62: error: a function call cannot appear in a constant-expression
std::declval<T>().end())>>
^
/tmp/dbg.h:143:12: error: template argument 2 is invalid
: std::true_type {};
^
/tmp/dbg.h:148:15: error: ‘enable_if’ in namespace ‘std’ does not name a template type
typename std::enable_if<!is_stl<T>::value, std::string>::type
^
/tmp/dbg.h:148:24: error: expected unqualified-id before ‘<’ token
typename std::enable_if<!is_stl<T>::value, std::string>::type
^
/tmp/dbg.h:154:15: error: ‘enable_if’ in namespace ‘std’ does not name a template type
typename std::enable_if<is_stl<T>::value, std::string>::type
^
/tmp/dbg.h:154:24: error: expected unqualified-id before ‘<’ token
typename std::enable_if<is_stl<T>::value, std::string>::type
^
Anything will cause that many errors.
I've no problem whatsoever using g++
itself to compile code. Since I don't have clang
installed, it will say it's not found.
Some useful data
OS: Linux Mint 18.3
g++ verson: g++ (Ubuntu 5.5.0-12ubuntu1~16.04) 5.5.0 20171010
It may not be a bug in recent versions of g++, but apt won't update it, so I can't discard that possibility. Also, no requirements seem to be specified, so I don't know...
Thanks in advance...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.