Forums | developer.brewmp.com Forums | developer.brewmp.com

Developer

Forums

Forums:

Hi, I've faced some error when I'm compiling my application using the ARM Compiler. Please give me some advice!!

I've currently developed my application in C++, and before I try to compile my application using the ARM, I've already changed all the code into pure BREW. When I compile, it has an error saying that it can't open the "comdef.h" file inside AEE.h. However, if I include "comdef.h" as well, I will not be able to compile since there are lots of C++ dependent files in there.

I'm wondering if I have to change any setting in the ARM compiler in order to read that file inside AEE.h. Does anyone of you who are using the ARM Compiler know something related to this?

Thanks very much!!
Karen :o

I suppose by now you figured out the problem, but just in case...
I didn't have to include comdef.h. I've never included AEE.h either. Other than AEEModGen.h & AEEAppGen.h, i've only included ones like AEEStdLib, AEEShell, AEEFile, etc. This worked with a make file in both RVCT for BREW and the ADS eval compiler.
You have to make sure you've got the proper paths. Are you using CodeWarrior? I used one of the 2.0 SDK example makefiles as my template to get one that had multiple project files. The 1.0 and 1.1 SDK makefiles all have a single source file.

I suppose by now you figured out the problem, but just in case...
I didn't have to include comdef.h. I've never included AEE.h either. Other than AEEModGen.h & AEEAppGen.h, i've only included ones like AEEStdLib, AEEShell, AEEFile, etc. This worked with a make file in both RVCT for BREW and the ADS eval compiler.
You have to make sure you've got the proper paths. Are you using CodeWarrior? I used one of the 2.0 SDK example makefiles as my template to get one that had multiple project files. The 1.0 and 1.1 SDK makefiles all have a single source file.

Thanks Tom!
No, I still haven't figured out the approach to the problem. We are using 1.1 SDK so I think there should be only one single source file. When I compile my application, which is initially written in C++ in microsoft visual (but i've already tried to change all the C++ functions into BREW), I got so many errors related to the file link of AEE.h.
So your suggestion is that I shouldn't include AEE.h at all? But why can't I do that, I thought we can include any of the AEExxxx files in our application including AEE.h, right?
Karen :cool:

Thanks Tom!
No, I still haven't figured out the approach to the problem. We are using 1.1 SDK so I think there should be only one single source file. When I compile my application, which is initially written in C++ in microsoft visual (but i've already tried to change all the C++ functions into BREW), I got so many errors related to the file link of AEE.h.
So your suggestion is that I shouldn't include AEE.h at all? But why can't I do that, I thought we can include any of the AEExxxx files in our application including AEE.h, right?
Karen :cool:

Well, i didn't suggest not to include AEE.h, i just meant i didn't include it directly. AEEAppGen & Mod both include AEE.h.
If i had a suggestion, it would be "don't use C++ yet." One of my first decisions for BREW was to use C. After looking at the example code and reading the forum, i decided i wasn't going to risk using C++ until the handsets had a larger heap. Memory fragmentation is real problem on a console - uh, handset - and in order to avoid temp objects you end up coding C++ like C anyway (and you have to know C++ pretty well, like, read Scott Meyers' books a half dozen times). But actually, i'd like people to use C++ with BREW, so y'all can work all the kinks out of it before i need to. So... ignore this paragraph and please use C++. :p
But here's a more concrete suggestion: find out why comdef.h is being included in AEE.h. It looks like it should only happen if you're making a static app. Your compiler must be defining AEE_STATIC for some reason. I'd guess it's because you don't have DYNAMIC_APP defined. That's done in the makefile with a -DDYNAMIC_APP argument to armcc. Look at any of the example makefiles.
(And uhhhh... maybe i misunderstood you, but you don't have to use only one source file just because you're using 1.1.)

Well, i didn't suggest not to include AEE.h, i just meant i didn't include it directly. AEEAppGen & Mod both include AEE.h.
If i had a suggestion, it would be "don't use C++ yet." One of my first decisions for BREW was to use C. After looking at the example code and reading the forum, i decided i wasn't going to risk using C++ until the handsets had a larger heap. Memory fragmentation is real problem on a console - uh, handset - and in order to avoid temp objects you end up coding C++ like C anyway (and you have to know C++ pretty well, like, read Scott Meyers' books a half dozen times). But actually, i'd like people to use C++ with BREW, so y'all can work all the kinks out of it before i need to. So... ignore this paragraph and please use C++. :p
But here's a more concrete suggestion: find out why comdef.h is being included in AEE.h. It looks like it should only happen if you're making a static app. Your compiler must be defining AEE_STATIC for some reason. I'd guess it's because you don't have DYNAMIC_APP defined. That's done in the makefile with a -DDYNAMIC_APP argument to armcc. Look at any of the example makefiles.
(And uhhhh... maybe i misunderstood you, but you don't have to use only one source file just because you're using 1.1.)

see my post in the following thread
http://brewforums.qualcomm.com/showthread.php?s=&threadid=1176
use c++ to C coverter and then compile your code using ARM compiler.
regards
ruben

see my post in the following thread
http://brewforums.qualcomm.com/showthread.php?s=&threadid=1176
use c++ to C coverter and then compile your code using ARM compiler.
regards
ruben

I use C++ exclusively now. No problems so far, just be smart about your inheritance heirarchy (keep it minimal) and so forth. It makes things ever so much much nicer. I have almost gotten rid of the horrible pMe pointer that so much of the BREW examples are passing all over the place.

I use C++ exclusively now. No problems so far, just be smart about your inheritance heirarchy (keep it minimal) and so forth. It makes things ever so much much nicer. I have almost gotten rid of the horrible pMe pointer that so much of the BREW examples are passing all over the place.

Cool!! I'll have to start trying it out.

Cool!! I'll have to start trying it out.

Please define DYNAMIC_APP before include aee.h

Please define DYNAMIC_APP before include aee.h

can I use ADSv1.2 to compile C++ codes? Can you show me an example of a working makefile?

can I use ADSv1.2 to compile C++ codes? Can you show me an example of a working makefile?

Definitely. I use the CodeWarrior IDE that comes with ADS1.2. The project settings can be discerned from the sample makefiles included with the example programs. Just go through one of the makefiles and set your corresponding project options accordingly, using the IDE. You should also consult the FAQ and Knowledge Base before you get going as they include some relevant tips.
MB

Definitely. I use the CodeWarrior IDE that comes with ADS1.2. The project settings can be discerned from the sample makefiles included with the example programs. Just go through one of the makefiles and set your corresponding project options accordingly, using the IDE. You should also consult the FAQ and Knowledge Base before you get going as they include some relevant tips.
MB

You can use C++ compiler for your device.
I use example "Helloworld" application to test many C++ features. I have attached my sample "helloworld" C++ makefile.
regards
rupen

You can use C++ compiler for your device.
I use example "Helloworld" application to test many C++ features. I have attached my sample "helloworld" C++ makefile.
regards
rupen

I have to ask you about this site where the author presented a way to create a String object using templates, I think it is very useful I already tried it using the emulator and it worked fine but when I tried compiling it in ADSv1.2 it returned an error, I also tried the working project given in the site and when I tried to compile it in ADS it returned the same error,
the error produced are these:
"platformSpecific.h", line 12: Error: C2991E: linkage disagreement for 'operator new(unsigned int)' - treated as 'extern'
"platformSpecific.h", line 17: Error: C2991E: linkage disagreement for 'operator delete(void*)' - treated as 'extern'
"platformSpecific.h", line 22: Error: C2991E: linkage disagreement for 'operator new[](unsigned int)' - treated as 'extern'
"platformSpecific.h", line 27: Error: C2991E: linkage disagreement for 'operator delete[](void*)' - treated as 'extern'
"BrewString.h", line 59: Fatal error: Unable to recover from a previous error
Your trial started at: Mon Apr 21 00:00:00 2003
Your will end at: Thu Jun 05 23:59:59 2003
NMAKE : fatal error U1077: 'c:\ADSv1_2\bin\armcpp' : return code '0x1'
Stop.
Tool returned code: 0
you can check the site:String Library

I have to ask you about this site where the author presented a way to create a String object using templates, I think it is very useful I already tried it using the emulator and it worked fine but when I tried compiling it in ADSv1.2 it returned an error, I also tried the working project given in the site and when I tried to compile it in ADS it returned the same error,
the error produced are these:
"platformSpecific.h", line 12: Error: C2991E: linkage disagreement for 'operator new(unsigned int)' - treated as 'extern'
"platformSpecific.h", line 17: Error: C2991E: linkage disagreement for 'operator delete(void*)' - treated as 'extern'
"platformSpecific.h", line 22: Error: C2991E: linkage disagreement for 'operator new[](unsigned int)' - treated as 'extern'
"platformSpecific.h", line 27: Error: C2991E: linkage disagreement for 'operator delete[](void*)' - treated as 'extern'
"BrewString.h", line 59: Fatal error: Unable to recover from a previous error
Your trial started at: Mon Apr 21 00:00:00 2003
Your will end at: Thu Jun 05 23:59:59 2003
NMAKE : fatal error U1077: 'c:\ADSv1_2\bin\armcpp' : return code '0x1'
Stop.
Tool returned code: 0
you can check the site:String Library

You should define new operate yourself as following:
void* operator new(unsigned int size)
{
return MALLOC(size);

void operator delete(void * ptr)
{
FREE(ptr);

You should define new operate yourself as following:
void* operator new(unsigned int size)
{
return MALLOC(size);

void operator delete(void * ptr)
{
FREE(ptr);

Here is the code that I used the name of the header is PlatformSpecific I just copied it from the link:
#ifndef PS_H
#define PS_H
typedef unsigned int UINT;
#define BREW
#ifdef BREW
#include
static void* operator new(UINT size)
{
return MALLOC(size);
}
static void operator delete(void * ptr)
{
FREE(ptr);
}
static void* operator new[](UINT size)
{
return MALLOC(size);
}
static void operator delete[](void * ptr)
{
FREE(ptr);
}
#else
#include
#define MALLOC malloc
#define FREE free
#define STRCMP strcmp
#define STRNCMP strncmp
#define STRLEN strlen
#define STRSTR strstr
#define STRCPY strcpy
#define STRNCPY strncpy
#define STRCAT strcat
#define STRCHR strchr
#define STRLOWER strlwr
#define STRUPPER strupr
#define MEMCPY memcpy
#define MEMMOVE memmove
#endif
#endif
Can you tell me what is wrong?

Here is the code that I used the name of the header is PlatformSpecific I just copied it from the link:
#ifndef PS_H
#define PS_H
typedef unsigned int UINT;
#define BREW
#ifdef BREW
#include
static void* operator new(UINT size)
{
return MALLOC(size);
}
static void operator delete(void * ptr)
{
FREE(ptr);
}
static void* operator new[](UINT size)
{
return MALLOC(size);
}
static void operator delete[](void * ptr)
{
FREE(ptr);
}
#else
#include
#define MALLOC malloc
#define FREE free
#define STRCMP strcmp
#define STRNCMP strncmp
#define STRLEN strlen
#define STRSTR strstr
#define STRCPY strcpy
#define STRNCPY strncpy
#define STRCAT strcat
#define STRCHR strchr
#define STRLOWER strlwr
#define STRUPPER strupr
#define MEMCPY memcpy
#define MEMMOVE memmove
#endif
#endif
Can you tell me what is wrong?

#include should be:
#include "xxx.h"

#include should be:
#include "xxx.h"

jmding
What does xxx stands for? Will I use it as is?

jmding
What does xxx stands for? Will I use it as is?

Actually I just copied the code here and it is wierd that the library after #include was not shown, so I think there is no problem with the include... Have you already tried overloading new?

Actually I just copied the code here and it is wierd that the library after #include was not shown, so I think there is no problem with the include... Have you already tried overloading new?

Try to overload new & delete on a per class basis:
class C
{
public:
C();
~C();
static void* operator new (size_t size);
static void operator delete (void *p);
;
possible sharing the implementation:
class MyClass: public C{}
or globally without using static keyword, like:
void* operator new (size_t size);
void operator delete (void *p);
Some compilers complain about static scope - CodeWarrior might be another example - it accepts
inline void * operator new(unsigned long size);
inline void operator delete(void *ptr);
HTH
Radu

Try to overload new & delete on a per class basis:
class C
{
public:
C();
~C();
static void* operator new (size_t size);
static void operator delete (void *p);
;
possible sharing the implementation:
class MyClass: public C{}
or globally without using static keyword, like:
void* operator new (size_t size);
void operator delete (void *p);
Some compilers complain about static scope - CodeWarrior might be another example - it accepts
inline void * operator new(unsigned long size);
inline void operator delete(void *ptr);
HTH
Radu

hello radub,
I already tried using inline and it worked, however, an error occured in BrewString.h:
"BrewString.h", line 59: Fatal error: Internal fault: 0x5ffa
Do you know the cause of this error?

hello radub,
I already tried using inline and it worked, however, an error occured in BrewString.h:
"BrewString.h", line 59: Fatal error: Internal fault: 0x5ffa
Do you know the cause of this error?

0x5ffa is related to default template parameters - ADS doesn't allow you to do things like:
template &#60class T = int&#62
class X{}
The problem was apparently solved (as well as other standard compliancy problems) in the newest released RealView Compilation Tools 2.0 .
Some other small changes might be necessary due to above mentioned lack of compliancy. I recompiled the libraries using ADS1.0.1 and I will post the code as well as some observation regarding ADS compilers in near future. If anyone is interested to give brewstring a quick try before - please contact me.
Radu

0x5ffa is related to default template parameters - ADS doesn't allow you to do things like:
template &#60class T = int&#62
class X{}
The problem was apparently solved (as well as other standard compliancy problems) in the newest released RealView Compilation Tools 2.0 .
Some other small changes might be necessary due to above mentioned lack of compliancy. I recompiled the libraries using ADS1.0.1 and I will post the code as well as some observation regarding ADS compilers in near future. If anyone is interested to give brewstring a quick try before - please contact me.
Radu

radub,
Do you think one of the reason that it doesn't work is because I am using a 45 trial version of ADS v1.2?

radub,
Do you think one of the reason that it doesn't work is because I am using a 45 trial version of ADS v1.2?

As I mentioned - RealView Compilation Tools 2.0 solved that problem

As I mentioned - RealView Compilation Tools 2.0 solved that problem