uwsampa / accept

an approximate compiler
http://accept.rocks
MIT License
37 stars 14 forks source link

problem with c++ header files #51

Open alirezahdd opened 5 years ago

alirezahdd commented 5 years ago

Hello I just installed Accept on my ubuntu 18.04 system. Installation was fine without any errors. I have a problem with the header files. when I want to compile a c++ code, I get too many errors because of my "include " and the log is:


In file included from test_cxx.cpp:4: In file included from /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/c++/7.3.0/vector:59: In file included from /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/c++/7.3.0/bits/stl_algobase.h:66: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/c++/7.3.0/bits/stl_iterator_base_funcs.h:77:12: error: unknown type name '_GLIBCXX14_CONSTEXPR' inline _GLIBCXX14_CONSTEXPR ^ /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/c++/7.3.0/bits/stl_iterator_base_funcs.h:78:5: error: expected unqualified-id typename iterator_traits<_InputIterator>::difference_type ^ In file included from test_cxx.cpp:4: In file included from /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/c++/7.3.0/vector:59: In file included from /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/c++/7.3.0/bits/stl_algobase.h:67: /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/c++/7.3.0/bits/stl_iterator.h:125:7: error: unknown type name '_GLIBCXX17_CONSTEXPR' _GLIBCXX17_CONSTEXPR ^ /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/c++/7.3.0/bits/stl_iterator.h:126:7: error: member 'reverse_iterator' has the same name as its class reverse_iterator() : current() { } ^ /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/c++/7.3.0/bits/stl_iterator.h:126:7: error: constructor cannot have a return type reverse_iterator() : current() { } ^~~~ /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/c++/7.3.0/bits/stl_iterator.h:131:16: error: unknown type name '_GLIBCXX17_CONSTEXPR' explicit _GLIBCXX17_CONSTEXPR ^ /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/c++/7.3.0/bits/stl_iterator.h:132:7: error: member 'reverse_iterator' has the same name as its class reverse_iterator(iterator_type x) : current(x) { } ^ /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/c++/7.3.0/bits/stl_iterator.h:132:7: error: constructor cannot have a return type reverse_iterator(iterator_type x) : current(x) { } ^~~~ /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/c++/7.3.0/bits/stl_iterator.h:137:7: error: unknown type name '_GLIBCXX17_CONSTEXPR' _GLIBCXX17_CONSTEXPR ^ /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/c++/7.3.0/bits/stl_iterator.h:138:7: error: member 'reverse_iterator' has the same name as its class reverse_iterator(const reverse_iterator& x) ^ /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/c++/7.3.0/bits/stl_iterator.h:138:7: error: constructor cannot have a return type reverse_iterator(const reverse_iterator& x) ^~~~ /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/c++/7.3.0/bits/stl_iterator.h:146:2: error: unknown type name '_GLIBCXX17_CONSTEXPR' _GLIBCXX17_CONSTEXPR ^ /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/c++/7.3.0/bits/stl_iterator.h:147:9: error: member 'reverse_iterator' has the same name as its class reverse_iterator(const reverse_iterator<_Iter>& __x) ^ /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/c++/7.3.0/bits/stl_iterator.h:147:9: error: constructor cannot have a return type reverse_iterator(const reverse_iterator<_Iter>& __x) ^~~~ /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/c++/7.3.0/bits/stl_iterator.h:153:7: error: unknown type name '_GLIBCXX17_CONSTEXPR' _GLIBCXX17_CONSTEXPR iterator_type ^ /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/c++/7.3.0/bits/stl_iterator.h:153:28: error: duplicate member 'iterator_type' _GLIBCXX17_CONSTEXPR iterator_type ^ /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/c++/7.3.0/bits/stl_iterator.h:114:29: note: previous declaration is here typedef _Iterator iterator_type; ^ /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/c++/7.3.0/bits/stl_iterator.h:153:41: error: expected ';' at end of declaration list _GLIBCXX17_CONSTEXPR iterator_type ^ /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/c++/7.3.0/bits/stl_iterator.h:298:12: error: unknown type name '_GLIBCXX17_CONSTEXPR' inline _GLIBCXX17_CONSTEXPR bool ^ /usr/lib/gcc/x86_64-linux-gnu/7.3.0/../../../../include/c++/7.3.0/bits/stl_iterator.h:298:33: error: expected unqualified-id inline _GLIBCXX17_CONSTEXPR bool ^ fatal error: too many errors emitted, stopping now [-ferror-limit=] consumer finished 20 errors generated. /home/alireza/accept/accept.mk:114: recipe for target 'test_cxx.bc' failed make: *** [test_cxx.bc] Error 1


I think this is because of using 7.3.0 c++ headers. Can we just change it to 4.8 c++ headers ? or is there any idea how to solve this problem?

any help will be appreciated

sampsyo commented 5 years ago

In the future, you'll want to use GitHub's Markdown code delimiters for pastes like this. (Without those, it's not really readable.)

I don't really have any advice about how to solve this—you'll want to fiddle with your include paths a bunch to see what makes it work. Good luck!

lucasreis1 commented 4 years ago

https://github.com/uwsampa/accept/pull/56

I've proposed a pull request that should solve this issue.