I'm having an interesting problem. I'm compiling a toy compiler with
clang++ -g -x c++ y.tab.c lex.yy.c semantic_actions.cpp -o parser -lfl
In y.tab.c
I included semantic_actios.hpp
and the contents in semantic_actions.hpp
are some method declarations that are used in y.tab.c
. That compiles fine.
However if I change it to
clang++ -c -g -x c++ semantic_actions.cpp -o semantic_actions.o
clang++ -g -x c++ y.tab.c lex.yy.c -o parser semantic_actions.o -lfl
I see
semantic_actions.o:1:1: error: source file is not valid UTF-8
<CF><FA><ED><FE><U+0007>
^
semantic_actions.o:1:2: error: source file is not valid UTF-8
<CF><FA><ED><FE><U+0007>
^
semantic_actions.o:1:3: error: source file is not valid UTF-8
<CF><FA><ED><FE><U+0007>
^
semantic_actions.o:1:4: error: source file is not valid UTF-8
<CF><FA><ED><FE><U+0007>
^
semantic_actions.o:1:5: error: expected unqualified-id
<CF><FA><ED><FE><U+0007>
^
semantic_actions.o:1:6: warning: null character ignored [-Wnull- character]
<CF><FA><ED><FE><U+0007>
// and the output goes on and on
I must missed something very basic here. I'm on Mac OS Yosemite
$ clang++ --version
Apple LLVM version 6.0 (clang-600.0.56) (based on LLVM 3.5svn)
Target: x86_64-apple-darwin14.1.0
Thread model: posix
Can someone have a look at it? Thanks!