wgtdkp / wgtcc

A small C11 compiler

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

I have built it on Ubuntu 14.04 ,and failed.

wbhu opened this issue · comments

I run "make install " in the codes' root folder, and get the errors like this:
m100@m100-desktop:~/gitRep/wgtcc$ make install
make[1]: 正在进入目录 /home/m100/gitRep/wgtcc' make[2]: 正在进入目录/home/m100/gitRep/wgtcc'
g++ -g -std=c++11 -Wall -o build/main.o -c main.cc
In file included from ast.h:5:0,
from code_gen.h:4,
from main.cc:1:
token.h: In member function ‘void TokenSequence::InsertBack(TokenSequence&)’:
token.h:454:57: error: ‘void pos’ has incomplete type
auto pos = tokList_->insert(end_, ts.begin_, ts.end_);
^
token.h: In member function ‘void TokenSequence::InsertFront(TokenSequence&)’:
token.h:470:12: error: no match for ‘operator=’ (operand types are ‘std::list<const Token*>::iterator {aka std::List_iterator<const Token*>}’ and ‘void’)
begin
= tokList_->insert(pos, ts.begin_, ts.end_);
^
token.h:470:12: note: candidates are:
In file included from /usr/include/c++/4.8/list:63:0,
from token.h:10,
from ast.h:5,
from code_gen.h:4,
from main.cc:1:
/usr/include/c++/4.8/bits/stl_list.h:125:12: note: std::_List_iterator<const Token*>& std::_List_iterator<const Token*>::operator=(const std::_List_iterator<const Token*>&)
struct _List_iterator
^
/usr/include/c++/4.8/bits/stl_list.h:125:12: note: no known conversion for argument 1 from ‘void’ to ‘const std::_List_iterator<const Token*>&’
/usr/include/c++/4.8/bits/stl_list.h:125:12: note: std::_List_iterator<const Token*>& std::_List_iterator<const Token*>::operator=(std::_List_iterator<const Token*>&&)
/usr/include/c++/4.8/bits/stl_list.h:125:12: note: no known conversion for argument 1 from ‘void’ to ‘std::_List_iterator<const Token*>&&’
make[2]: *** [build/main.o] 错误 1
make[2]:正在离开目录 /home/m100/gitRep/wgtcc' make[1]: *** [all] 错误 2 make[1]:正在离开目录/home/m100/gitRep/wgtcc'
make: *** [install] 错误 2

if I have some wrong actions with building it?
Thank you!

You need a gcc version that supports C++11, update your gcc to the latest. (C++11 redesigned the key word auto for type deducing)
By the way, never forget to pull down my latest commits, big bugs fixed.
Pleasure to be helpful :)

I will update README.md to specify the dependencies

okay!
I upgrade gcc to 5.4.1, and it works.
Thank you.