小编fle*_*C0m的帖子

clang++ link failure: error: source file is not valid UTF-8?

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
Run Code Online (Sandbox Code Playgroud)

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
Run Code Online (Sandbox Code Playgroud)

I see

semantic_actions.o:1:1: error: source file is not valid UTF-8
<CF><FA><ED><FE><U+0007>
^ …
Run Code Online (Sandbox Code Playgroud)

c++ linker clang++

4
推荐指数
1
解决办法
5845
查看次数

标签 统计

c++ ×1

clang++ ×1

linker ×1