在我的sabayon机器上安装了升级后(我记不起升级了什么),我在以前的工作代码上得到了一个链接错误。
dmd src/ast.o src/saturated.o src/queue.o src/operator.o src/tree.o src/heap.o src/bug.o src/levenshtein.o src/main.o src/lexer.o src/binary_tree.o src/sparse_vector.o src/stack.o src/integral_literal.o src/precedence_climbing.o src/traversal.o -ofmain
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../x86_64-pc-linux-gnu/bin/ld: src/ast.o: relocation R_X86_64_32 against `.data' can not be used when making a shared object; recompile with -fPIC
src/ast.o: could not read symbols: Bad value
collect2: error: ld returned 1 exit status
--- errorlevel 1
make: *** [main] Error 1我不知道ld的内部工作原理(或目标文件),但我能想到的唯一问题是ld不理解目标文件中变量或函数名中的一些乱码语法。
任何关于如何解决这个问题的想法都是非常感谢的。
发布于 2014-04-07 14:22:11
这是x86_64系统上出现的问题。
尝试将-fPIC添加到CFLAGS(CXXFLAGS)或IDE的编译器标志中。
此标志将使gcc(g++)以64位进行编译。
https://stackoverflow.com/questions/17162574
复制相似问题