问题描述
我试图在Eclipse中构建一个使用库xerces-c-3.1.1-x86_64-linux-gcc-3.4(二进制)的C ++程序。我看到以下错误...-
重新定位截断以适应:R_X86_64_PC32 undefined symbol`xercesc_3_1 :: AbstractDOMParser :: adoptDocument()'
-
未定义引用`xercesc_3_1 :: AbstractDOMParser :: adoptDocument()'
/ li>
通过stackoverflow上的链接( a。 xerces-c-3.1.1-x86_64-linux-gcc-3.4和b。 xerces-c-3.1.1-x86-linux-gcc-3.4都导致相同的错误-ld终止与信号11 [分割故障],核心转储
有人可以告诉我,如果我使用正确的版本库或应该我使用其他版本适合我的环境(这里的eclipse,cygwin64在windows8.1)?在同一页面上有其他版本,但我不确定使用哪一个?
最后一个选项是编译库(源代码,在我的情况下,并跳过./configure,就像您通常对下载的项目所做的那样)。如果我必须获取xerces-c的源文件,再次有这么多版本(请检查)我有麻烦,需要采取和做./configure,然后包括那些作为库和包含文件。
有人可以告诉我从哪里和正确的版本(我考虑约3.1.1)xerces-c应该运行没有错误? - ld以信号11 [分段错误]终止,内核转储。
感谢您耐心等待长时间问题。
I am trying build a C++ program in Eclipse that uses a library xerces-c-3.1.1-x86_64-linux-gcc-3.4 (binary). I see below errors ...
relocation truncated to fit: R_X86_64_PC32 against undefined symbol `xercesc_3_1::AbstractDOMParser::adoptDocument()'
undefined reference to `xercesc_3_1::AbstractDOMParser::adoptDocument()'
Gone thru a link on stackoverflow (What does this GCC error "... relocation truncated to fit..." mean?) and understood what type of error is this but did not get a solution on how to resolve it.
Environment I am using: Cygwin64 on Windows8.1 and Eclipse configured to use Cygwin C++ compiler. Tried both xerces-c-3.1.1-x86_64-linux-gcc-3.4 as well as xerces-c-3.1.1-x86-linux-gcc-3.4 and got the same error.Am I missing something?
Solved my problem partly.Earlier I just provided the include files and didn't know whether to provide library file(in my case libxerces-c.a) or not. The above errors have gone now, but it is now showing new error as shown below.
--Error output--
Building target: MyXmlProject.exeInvoking: Cygwin C++ Linkerg++ -L"C:\cppLib\xerces-c-3.1.1-x86_64-linux-gcc-3.4\lib" -o "MyXmlProject.exe" ./xmldom/XmlDomDocument.o ./xmldom/main.o -lxerces-ccollect2: error: ld terminated with signal 11 [Segmentation fault], core dumped/usr/lib/gcc/x86_64-pc-cygwin/4.9.3/../../../../x86_64-pc-cygwin/bin/ld: BFD (GNU Binutils) 2.25 assertion fail /cygdrive/i/szsz/tmpp/cygwin64/binutils/binutils-2.25-1.x86_64/src/binutils-gdb/bfd/cofflink.c:264makefile:48: recipe for target 'MyXmlProject.exe' failedmake: *** [MyXmlProject.exe] Error 1
Searched a lot on net including stackoverflow, cyberciti.biz, dreamincode.net, linuxquestions.org, linux.about.com and experts-exchange.com that says that either you have to update your gcc/g++ or you are using the wrong version of library(compiled on other environment such as linux and trying to use on Windows). As far as possible I want to avoid updating/re-installing gcc/g++, that I had previously installed thru Cygwin64 and because I m afraid of doing that(lot other work I have to do with Cygwin) and also I m not sure that will solve the problem. This also pounces another question-if today I had downloaded a compiled library of one project(here xerces-c) and tommorow if I have to develope some program using another library, will I have to update the gcc again? I havn't understood why to update gcc.
Now coming to second option of verifying correct compiled version of library- I had downloaded from http://archive.apache.org/dist/xerces/c/3/binaries/ a. xerces-c-3.1.1-x86_64-linux-gcc-3.4 and b. xerces-c-3.1.1-x86-linux-gcc-3.4 both result in same error-ld terminated with signal 11 [Segmentation fault], core dumpedCan someone tell me if I am using correct version of library or should I have used other version suitable for my environment(here eclipse, cygwin64 on windows8.1)? There are other versions on same page but I m not sure of using which one?
Last option is to compile the library(source code, in my case I had taken binaries and skipped ./configure as you would normally do for downloaded project). If I have to take the source file of xerces-c, again there are so many versions(check http://archive.apache.org/dist/xerces/c/3/sources/) I am in trouble which to take and do ./configure and then include those as library and include files.
Can someone please tell me from where and correct version(I m taking about 3.1.1) of xerces-c should be taken that will run without errors?-ld terminated with signal 11 [Segmentation fault], core dumped.Thanks for your patience reading long question.
这篇关于如何解决“relocation truncated to fit:R_X86_64_PC32 against undefined symbol`xercesc_3_1 :: AbstractDOMParser :: adoptDocument()'”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!