The solution to “undefined reference”and “relocation truncated” (mostly concern cell-id stuffs)

来源:互联网 发布:系统清理软件哪个好 编辑:程序博客网 时间:2024/05/21 19:41

The solution to “undefined reference”and “relocation truncated” (mostly concern cell-id stuffs)

While covering a program concerning RBasicGsmPhone or so stuffs,i got into the problem that my program can compile in the emulator but cannot work in the ARMI release mode (or maybe THUMB which I have not tried). The Problem is mainly

undefined reference to `RBasicGsmPhone::RBasicGsmPhone(void)' relocation truncated to fit: ARM_26...
RBasicGsmPhone::RBasicGsmPhone(void) ...

Having checked up the program i could get it through on the emulator but not ARMI.I searched through the nokia forum and got nothing.Lots of people ever got the same problem as " undefined reference " and "relocation truncated",especially about the "cell-id" stuff,but without any solution. I saw one thread that is similar to my problem:
GeoLog.in(GeoLogContainer.o)(.text+0x494):GeoLogContaine: relocationtruncated to fit: ARM_26 RFs::Connect(int)
GeoLog.in(GeoLogContainer.o)(.text+0x4b4):GeoLogContaine: undefined reference to `RFile::Open(RFs &, TDesC16 const &, unsigned
http://discussion.forum.nokia.com/fo...runcated+write
here the problem is that it used RFile and RFs,and using the two you have to include : Location: f32file.h (include it in your .cpp file) Link against: efsrv.lib (include in your .mmp file)

Back to my problem,i have

include <etelbgsm.h>
include <etel.h>
and in my mmp
LIBRARY etel.lib // Telephony server LIBRARY
gsmbas.lib // Get cell id
Just as above,i also include a gsmbas.lib in the :Symbian/7.0s/Series60_v21_C/Epoc32/release/armi/urel,which i got from (SYSINFO60/data). i have got all needed then it may because of the wrong version of some *.h or *.lib.
Why not have a try? I download the Series60_v20 one and copy the wanted lib to my Series60_v21_C/.../urel and compile again .
Compile and BANG! IT WORKS.
So,i think that almost all similar problems are caused by short of *.lib(s) or *.h(s) for the needed ,or by short of PROPER ones. Or caused by broken ones.
Due to my little experience ,I do not know it to the deep , I hope someone can explain it more clearly or at least point out my misunderstand. easy way to solve the problem, you can just replace it with a proper one.
Then that is all. also i got a question for your experts: is there anything with the order in which the libraries were set in the mmp file? What does this thread mean? http://discussion.forum.nokia.com/fo...794#post290794

download the gsmbas.lib for armi urel here
http://dl2.csdn.net/down4/20070714/14095347908.rar
answer from nokia forum champion symbianyucca:
“undefined reference” mena that the implementation is not found, which means that the header for the class was located but the library was not.

So to get rid of this you just need to addd the library to the project and re-build the workspace (i.er. re-import with codewarrion for example), and then the bceed.

Anyway, if the library is not present in the SDK, then of course you can not use the API. You should never copy librarties from older SDK's to never ones, since they might not be compatible, instead you should check if you could use some other API that is present to get the task done.

If not, then you could check if ytou could use the channels available to obtain the required libraries from Nokia.
原创粉丝点击