开发者

New to C/C++ Using Android NDK to port Legacy code, getting compile errors

I have been trying to take some old Symbian C++ code over to Android today using the NDK.

I have little to no C or C++ knowledge so its been a chore, however has to be done.

My main issue is that I'm having trouble porting what I believe is Symbian specifi code to work using the small C/C++ subset that is available with the Android NDK.

Here is a picture of the compilation errors I'm getting using cygwin

I was wondering if anyone could point me in the right direction on how to deal with these errors? For instance is TBool/Int/TUint/RPointerArray/RSocket a Symbian primitive and thats why it wont compile or is i开发者_运维问答t something else?

Also what is ISO C++?

Any tutorials, guides or tips and help would be greatly appreciated.

EDIT:

Here is a code snippet from the .h file I am trying to import followed by the output for the snippet from the compiler.

Could someone guide me on how I would port this Symbian specific code to normal C++?

If I got an idea of whats Symbian specific and how to change it I believe I could change then begin to port the rest myself


#ifndef __RTPSTREAM_H__
#define __RTPSTREAM_H__


class CRTPParser;

class MDataRecorderObserver
{
public:
virtual void DataRecorded(const TDesC8& aData, TUint aCodec, TUint aFramesizeMs)=0;

};

class MRTPStreamDataObserver
{
 public:
virtual void AudioDataSent()=0;
virtual void DataReceived(const TDesC8& aData,TUint aCodec, TBool aMarker, TUint aSeq, TUint aTime)=0;
virtual void DataReceived(const TDesC8& aData)=0;
};

$ make APP=ndk-socket
Android NDK: Building for application 'ndk-socket'
Compile++ thumb: socket <= apps/ndk-socket/project/jni/rtpstream.cpp
In file included from apps/ndk-socket/project/jni/com_ciceronetworks_utils_RTPJn
i.h:2,
             from apps/ndk-socket/project/jni/rtpstream.cpp:4:
build/platforms/android-3/arch-arm/usr/include/jni.h:489: note: the mangling of
'va_list' has changed in GCC 4.4
In file included from apps/ndk-socket/project/jni/rtpstream.cpp:11:
apps/ndk-socket/project/jni/rtp/RTPStream.h:15: error: ISO C++ forbids declarati
on of 'TDesC8' with no type
apps/ndk-socket/project/jni/rtp/RTPStream.h:15: error: expected ',' or '...' bef
ore '&' token
apps/ndk-socket/project/jni/rtp/RTPStream.h:23: error: ISO C++ forbids declarati
on of 'TDesC8' with no type
apps/ndk-socket/project/jni/rtp/RTPStream.h:23: error: expected ',' or '...' bef
ore '&' token
apps/ndk-socket/project/jni/rtp/RTPStream.h:24: error: ISO C++ forbids declarati
on of 'TDesC8' with no type
apps/ndk-socket/project/jni/rtp/RTPStream.h:24: error: expected ',' or '...' bef
ore '&' token
apps/ndk-socket/project/jni/rtp/RTPStream.h:24: error: 'virtual void MRTPStreamD
ataObserver::DataReceived(int)' cannot be overloaded
apps/ndk-socket/project/jni/rtp/RTPStream.h:23: error: with 'virtual void MRTPSt
reamDataObserver::DataReceived(int)'
apps/ndk-socket/project/jni/rtp/RTPStream.h:30: error: 'TInt' has not been deca
red


By "ISO C++", the G++ compiler means "The C++ standard".

This looks like the usual G++ error spew when it gets confused. Typically only the top error message is meaningful, and then the rest is what the compiler prints out because it was confused. The odd thing is that the initial error about "expected class name before '<' token" is itself more typical of error spew than real errors. It's perhaps useful to have a look at that point in the code and see what it says and whether there's anything strange or compiler-specific there.

Also, from a Google-search, it looks like the initial note about va_name mangling is just informative and very unlikely to cause a problem in this case -- and, specifically, is certainly not going to cause the rest of these compiler errors.

Edit: Based on the revised error output and source code that you posted, it looks like the error is simply that this code is using the "TDesc8" data type without it first being declared, and the rest is likely to be followon from that. According to the information I could find online in the Symbian documentation, code that uses that type should have a #include <e32des8.h> line to include the relevant header. Does the code you are compiling include that header?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜