Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Developer
Posts: 30
Registered: ‎03-03-2012
My Device: Playbook
My Carrier: Blackberry
Accepted Solution

QCC compilation oddness.

Hi there,

 

I'm trying to compile some code that compiles fine on iOS/PC/Android and fails with QCC in the IDE.

 

If I try the following:

 

typedef struct tPOINT
{
tINT Xc;
tINT Yc;

tPOINT (){};
tPOINT (tINT x,tINT y){Xc=x;Yc=y;}
tVOID Set (tINT x,tINT y){Xc=x;Yc=y;}
} tPOINT;

 

I get:

/media/OSDisk/Dev/Raz0r/Source/Raz0r.H:608: error: expected specifier-qualifier-list before 'tPOINT'

(The constructor line)

 

I've got a whole stack of other errors including one for every class in my header files (even if its a forward declaration)

 

class RZFile;

error: expected '=', ',', ';', 'asm' or '__attribute__' before RZFile

 

Is this due to qcc thinking my .H (capital H) files should be compiled as C rather than C++?

 

If so how to I change the compiler to recognise .CPP and .H files as C++?

 

Many thanks,

 

Steve.

 

 

 

 

-------------------------------------------------------------
Steven Haggerty,
Rubicon Development ( http://www.rubicondev.com/ )
Developer
Posts: 19
Registered: ‎03-04-2012
My Device: Playbook 2.0
My Carrier: Vodafone

Re: QCC compilation oddness.

I don't know if this is the case, but I've worked with some (propietary) compilers for embedded systems that are specially picky with the syntax (more if they are pure C rather C++ compilers).

 

Just a guess, but maybe it is confused by seeing the same id after the "typedef struct" and in the type name (like trying to do a "typedef struct MyStruct MyStruct;" without defining MyStruct earlier). You can try changing one of the id to something like tPOINT2 and see if the error is the same. 

BlackBerry Development Advisor
Posts: 683
Registered: ‎11-29-2011
My Device: PRIV
My Carrier: Rogers

Re: QCC compilation oddness.

[ Edited ]

I get the exact same error if I try to compile that code using gcc.  Works with g++ though.

Try renaming to .cpp or .cc to be sure the c++ compiler is invoked.

 

FYI, qcc is essentially a wrapper for the gnu compiler toolchain.

 

Cheers,

Sean

Highlighted
Developer
Posts: 30
Registered: ‎03-03-2012
My Device: Playbook
My Carrier: Blackberry

Re: QCC compilation oddness.

Thanks for the reply. This is a shared codebase with hundreds of files, so changing all instances of the code is not really an option. Thanks for replying though!

 

It was as I though, the compiler doesn't seem to pickup on .CPP and .H being C++ files, so I jammed "-lang-c++" into the compiler options and it seems to at least compile now.

 

Thanks,

 

Steve.

 

-------------------------------------------------------------
Steven Haggerty,
Rubicon Development ( http://www.rubicondev.com/ )
BlackBerry Development Advisor
Posts: 683
Registered: ‎11-29-2011
My Device: PRIV
My Carrier: Rogers

Re: QCC compilation oddness.

[ Edited ]

Poke around in target/qnx6/usr/include/mk.

qmacros.mk and rules.mk may be of interest to you.

 

Also, .h files are not compilable, so there are no rules for such things.  They only get included into other files being compiled Smiley Happy

 

Cheers,

Sean

Developer
Posts: 30
Registered: ‎03-03-2012
My Device: Playbook
My Carrier: Blackberry

Re: QCC compilation oddness.

Hi Sean, I'm not much of a Linux/Eclipse guy, could you spell that out in an absolute file location (or as near as possible).

Thanks,

Steve.
-------------------------------------------------------------
Steven Haggerty,
Rubicon Development ( http://www.rubicondev.com/ )
BlackBerry Development Advisor
Posts: 683
Registered: ‎11-29-2011
My Device: PRIV
My Carrier: Rogers

Re: QCC compilation oddness.

On my mac, it's $(WHEREVER_THE_NDK_WAS_INSTALLED)/target/qnx6/usr/include/mk/qmacros.mk and rules.mk

Retired
Posts: 20
Registered: ‎10-27-2010
My Device: Bold 9800

Re: QCC compilation oddness.

You might also have some success adding *.CPP and *.H to the C file types preference page in the IDE located under Window->Preferences->C/C++->File Types