Open reza1234567891 opened 4 weeks ago
Thank you for reporting the issue! I cannot figure out what exactly is the problem and I don't have access to a xubuntu 16.04 system. It is possibly related to the C++ standard library and stringstream. Upgrading the GCC package and its standard library may solve the problem. I attached the file stream_test.cpp.gz. Please extract the .cpp file and compile and run the program using g++ and copy/paste its output here.
C++ is not my language but i put it in Code::Blocks which i use for C and it should also work for C++ and tried to run your code, this is the output:
/home/cr/.cache/.fr-qxiUcS/stream_test.cpp||In constructor ‘code_generator::code_generator()’:|
/home/cr/.cache/.fr-qxiUcS/stream_test.cpp|51|warning: extended initializer lists only available with -std=c++11 or -std=gnu++11|
/home/cr/.cache/.fr-qxiUcS/stream_test.cpp|51|warning: extended initializer lists only available with -std=c++11 or -std=gnu++11|
/home/cr/.cache/.fr-qxiUcS/stream_test.cpp||In member function ‘virtual int IndentingOStreambuf::overflow(int)’:|
/home/cr/.cache/.fr-qxiUcS/stream_test.cpp|84|error: ‘ptrdiff_t’ was not declared in this scope|
/home/cr/.cache/.fr-qxiUcS/stream_test.cpp|84|note: suggested alternatives:|
/usr/include/x86_64-linux-gnu/c++/5/bits/c++config.h|200|note: ‘std::ptrdiff_t’|
/usr/include/x86_64-linux-gnu/c++/5/bits/c++config.h|200|note: ‘std::ptrdiff_t’|
/home/cr/.cache/.fr-qxiUcS/stream_test.cpp||In member function ‘void code_generator::increment_indent_level(std::ostream&)’:|
/home/cr/.cache/.fr-qxiUcS/stream_test.cpp|137|error: ‘it’ does not name a type|
/home/cr/.cache/.fr-qxiUcS/stream_test.cpp|139|error: ‘it’ was not declared in this scope|
/home/cr/.cache/.fr-qxiUcS/stream_test.cpp|140|warning: extended initializer lists only available with -std=c++11 or -std=gnu++11|
/home/cr/.cache/.fr-qxiUcS/stream_test.cpp|140|warning: extended initializer lists only available with -std=c++11 or -std=gnu++11|
/home/cr/.cache/.fr-qxiUcS/stream_test.cpp||In member function ‘void code_generator::decrement_indent_level(std::ostream&)’:|
/home/cr/.cache/.fr-qxiUcS/stream_test.cpp|147|error: ‘it’ does not name a type|
/home/cr/.cache/.fr-qxiUcS/stream_test.cpp|149|error: ‘it’ was not declared in this scope|
/home/cr/.cache/.fr-qxiUcS/stream_test.cpp|150|warning: extended initializer lists only available with -std=c++11 or -std=gnu++11|
/home/cr/.cache/.fr-qxiUcS/stream_test.cpp|150|warning: extended initializer lists only available with -std=c++11 or -std=gnu++11|
/home/cr/.cache/.fr-qxiUcS/stream_test.cpp||In member function ‘void code_generator::release(std::ostream&)’:|
/home/cr/.cache/.fr-qxiUcS/stream_test.cpp|157|error: ‘it’ does not name a type|
/home/cr/.cache/.fr-qxiUcS/stream_test.cpp|159|error: ‘it’ was not declared in this scope|
/home/cr/.cache/.fr-qxiUcS/stream_test.cpp||In instantiation of ‘std::pair<_T1, _T2>::pair(const _T1&, const _T2&) [with _T1 = std::basic_ostream<char>* const; _T2 = IndentingOStreambuf]’:|
/home/cr/.cache/.fr-qxiUcS/stream_test.cpp|51|required from here|
/usr/include/c++/5/streambuf|804|error: ‘std::basic_streambuf<_CharT, _Traits>::basic_streambuf(const std::basic_streambuf<_CharT, _Traits>&) [with _CharT = char; _Traits = std::char_traits<char>]’ is private|
/home/cr/.cache/.fr-qxiUcS/stream_test.cpp|5|error: within this context|
/usr/include/c++/5/bits/stl_pair.h|113|note: synthesized method ‘IndentingOStreambuf::IndentingOStreambuf(const IndentingOStreambuf&)’ first required here |
||=== Build failed: 9 error(s), 8 warning(s) (0 minute(s), 0 second(s)) ===|
ok, now i updated g++ and could run your code, this is the output:
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,dffgfdghghhjhjtssh tssh3.h fhhgf ffff ddddddddddsc djhhhhhhhhfsddd { djhhhhhhhhfsddd } { fhhgf ffff ddddddddddsc }
gcc version 9.4.0
Thanks! After upgrading g++ and libstdc++ could you now run the coder example?
no, octave coder gives the same errors, should i reinstall it?
i will try to upgrade libstdc++ also
i dont get it to work, thanks anyway
I am trying to use the coder package but it doesnt work. Even if i try with a empty function or a function like this it doesnt work:
` function [a]=test(b)
i get the following type of messages:
coder_test /home/cr/coder_test/test.cc:5970:18: error: expected ‘{’ before ‘const’ namespace test_ const Symbol& test_make(); ^~~~~ /home/cr/coder_test/test.cc:5972:18: error: expected ‘{’ before ‘static’ namespace test_ static Constant& Const(int); ^~~~~~ /home/cr/coder_test/test.cc: In lambda function: /home/cr/coder_test/test.cc:5996:10: error: ‘test_2’ has not been declared return test_2::test_make().get_value()->function_value()->call(interp.get_evaluator(),nargout,args); ^ /home/cr/coder_test/test.cc:1700:9: note: in definition of macro ‘DEFCODER_DLD’ { fcn_body }; ^~~~~~~~ warning: mkoctfile: building exited with failure status error: coder: compile error error: called from coder_test at line 3 column 1
coder version 1.9.2 octave version 7.1.0 xubuntu 16.04