gpt4 book ai didi

c++ - linux flex gcc 编译失败,出现 `undefined reference to ` TclReError'`

转载 作者:太空宇宙 更新时间:2023-11-04 08:12:57 25 4
gpt4 key购买 nike

我在从源代码编译 flex 时遇到了一些问题。正在传递配置CC=/home/mybin/bin/gcc CPPFLAGS=-I/home/mybin/include LDFLAGS=-L/home/mybin/lib.

在 ../include 中我有两个包含引用的文件

regex.h:110:#define regerror    TclReError
regcustom.h:78:#define regerror TclReError

运行配置时,没有产生错误,日志中也没有任何感兴趣的内容,但是 make 会抛出错误

     /bin/sh ../libtool  --tag=CC   --mode=link /home/mybin/bin/gcc  -g -O2  -L/home/mybin/lib -o flex ccl.o dfa.o ecs.o scanflags.o gen.o main.o misc.o nfa.o parse.o scan.o skel.o sym.o tblcmp.o yylex.o options.o scanopt.o buf.o tables.o tables_shared.o filter.o regex.o ../lib/libcompat.la -lm 
libtool: link: /home/mybin/bin/gcc -g -O2 -o flex ccl.o dfa.o ecs.o scanflags.o gen.o main.o misc.o nfa.o parse.o scan.o skel.o sym.o tblcmp.o yylex.o options.o scanopt.o buf.o tables.o tables_shared.o filter.o regex.o -L/home/_bin/lib ../lib/.libs/libcompat.a -lm
regex.o: In function `flex_regcomp':
/home/tmp/flex-2.6.0/src/regex.c:66: undefined reference to `TclReError'
collect2: error: ld returned 1 exit status
make[2]: *** [flex] Error 1

在 configure --help 中没有引用显式标志

Some influential environment variables:

CC C compiler command
CFLAGS C compiler flags
LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
nonstandard directory <lib dir>
LIBS libraries to pass to the linker, e.g. -l<library>
CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
you have headers in a nonstandard directory <include dir>
LT_SYS_LIBRARY_PATH
User-defined run-time library search path.
CPP C preprocessor
YACC The `Yet Another Compiler Compiler' implementation to use.
Defaults to the first program found out of: `bison -y', `byacc',
`yacc'.
YFLAGS The list of arguments that will be passed by default to $YACC.
This script will default YFLAGS to the empty string to avoid a
default value of `-d' given by some make applications.
CXX C++ compiler command
CXXFLAGS C++ compiler flags
CXXCPP C++ preprocessor

我也尝试过直接使用 export CPPFLAGS="-I/home/mybin/include"

导出

在 SO 和谷歌上的扩展搜索返回明显,关于我遗漏的任何指示?

最佳答案

您将它们设置为环境变量; configure 通过检查配置文件和环境来确定LDFLAGSCPPFLAGS。你可以这样试试。

  export CPPFLAGS='-I/home/mybin/include'
export LDFLAGS='-L/home/mybin/lib'
./configure

或作为单行:

 env CPPFLAGS='-I/home/mybin/include' LDFLAGS='-L/home/mybin/lib' ./configure

请试试这个...

关于c++ - linux flex gcc 编译失败,出现 `undefined reference to ` TclReError'`,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37815208/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com