C++ 在Windows、FLEX/bison和#x27上使用MinGW构建黄金链接器;YYSTYPE&x27;未在此范围中声明
我正在尝试使用mingw构建gnubinautils中包含的黄金链接器。我采取的步骤-C++ 在Windows、FLEX/bison和#x27上使用MinGW构建黄金链接器;YYSTYPE&x27;未在此范围中声明,c++,mingw,flex-lexer,binutils,gold-linker,C++,Mingw,Flex Lexer,Binutils,Gold Linker,我正在尝试使用mingw构建gnubinautils中包含的黄金链接器。我采取的步骤- 使用安装程序将mingw与所有软件包一起安装 使用windows安装程序将windows版本的FLEX安装到默认位置 在mingw shell的gold链接器目录中运行./configure,它似乎工作正常 运行make,这就是我得到一些错误的地方 我已将./configure和make的完整输出包含在粘贴箱中: 但重要的是: make[2]: Entering directory `c:/binutils
make[2]: Entering directory `c:/binutils-2.23.1/binutils-2.23.1/gold'
g++ -DHAVE_CONFIG_H -I. -I. -I./../include -I./../elfcpp -DLOCALEDIR="\"/usr/lo
cal/share/locale\"" -DBINDIR="\"/usr/local/bin\"" -DTOOLBINDIR="\"/usr/local//bi
n\"" -DTOOLLIBDIR="\"/usr/local//lib\"" -W -Wall -Wno-format -Werror -D_LAR
GEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -frandom-seed=expression.o -MT expression.
o -MD -MP -MF .deps/expression.Tpo -c -o expression.o expression.cc
In file included from expression.cc:33:0:
script-c.h:221:7: エラー: 'yylex' initialized and declared 'extern' [-Werror]
script-c.h:221:7: エラー: 'YYSTYPE' was not declared in this scope
script-c.h:221:15: エラー: expected primary-expression before ',' token
script-c.h:221:17: エラー: expected primary-expression before 'void'
script-c.h:221:30: エラー: expression list treated as compound expression in ini
tializer [-fpermissive]
cc1plus.exe: all warnings being treated as errors
make[2]: *** [expression.o] Error 1
make[2]: Leaving directory `c:/binutils-2.23.1/binutils-2.23.1/gold'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `c:/binutils-2.23.1/binutils-2.23.1/gold'
make: *** [all] Error 2
我查看了script-c.h文件,它具有以下功能:
/* Called by the bison parser skeleton to return the next token. */
extern int
yylex(YYSTYPE*, void* closure);
然而,YYSTYPE在我能找到的任何地方都没有定义
我刚开始使用mingw和msys,所以我可能在某些地方错过了一些步骤。如果有人能帮我建立这个系统,我将不胜感激。由于这个问题已经有好几个月没有答案了,我研究了这个问题 我下载了binutils-2.25(最新版本),并尝试跟踪您的操作 我发现,如果你只建造黄金而不建造其余的比努蒂尔,它就不会建造黄金。如果您在顶层执行
/configure
和make
,则会生成黄金罚款。如果您随后cd gold
并执行/configure
和make
(尽管不必要),那么它也可以正常工作
我确实发现,当它在黄金上失败时,它比你的建造更进一步
我的注意力也被吸引到了你的短语的默认位置。FLEX的说明明确指出,您不应依赖默认位置(可能是/Program Files/
或类似位置),但必须使用不包含任何空格的路径。如果你没有注意到这一点,那就是你的错
作为最新版本,您可以确保在非空间路径中正确安装了flex(和bison),然后下载2.25并构建整个binutils,而不是单独构建gold,从而使gold正常工作
我希望这个分析对后来发现类似问题的人有用