Project Home
Project Home
Trackers
Trackers
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Including a C++ class in a Photon Appbuilder Project: (2 Items)
   
Including a C++ class in a Photon Appbuilder Project  
Hello,

I'm developing a Photon Appbuilder project in QNX Momentics v6.3. So far I've  written all the code in C, but now I'd 
like to include a C++ class for matrix operations. However, it doesn't seem to be a simple matter of adding the C++ file
 to the project. At this point the compiler cannot find the standard C++ libraries or recognize the C++ syntax in the 
source file. Can anybody tell me what's the correct way to do it?

Thanks!
RE: Including a C++ class in a Photon Appbuilder Project  
Hi Gabriel,

There are a couple of gotchas when working with C++ and Phab, and they're
listed below:

PhAB fails to link C++ code

Q: I have C++ code being called in a callback, and PhAB won't link it. Why?

A: Is it in a file with a .cpp extension? Our default make settings only
recognize .cc extensions at this time. You can fix this by adding this line
near the top of your common.mk file:


EXTRA_SUFFIXES+=cxx cpp

PhAB fails to compile C++ code

Q: proto.h does not like my C++ function declarations. How can I fix this?

A: You can use the option that disables approto.

http://www.qnx.com/developers/docs/6.3.0SP3/photon/prog_guide/generating.htm
l#Prototypes

Specifically you'll need to do the following:

To suppress the generation of prototypes in proto.h:

  1. Press F2 or from the Project menu, choose Properties to open the
Project Properties dialog.
  2. Click the Generate Options tab.
  3. Disable the Scan Source Files for Prototypes option. 

Cheers,
-Brian

> -----Original Message-----
> From: Gabriel Aguirre-Ollinger [mailto:gaguirre@northwestern.edu] 
> Sent: Wednesday, March 26, 2008 13 45
> To: momentics-community
> Subject: Including a C++ class in a Photon Appbuilder Project
> 
> Hello,
> 
> I'm developing a Photon Appbuilder project in QNX Momentics 
> v6.3. So far I've  written all the code in C, but now I'd 
> like to include a C++ class for matrix operations. However, 
> it doesn't seem to be a simple matter of adding the C++ file 
> to the project. At this point the compiler cannot find the 
> standard C++ libraries or recognize the C++ syntax in the 
> source file. Can anybody tell me what's the correct way to do it?
> 
> Thanks!
> 
> _______________________________________________
> QNX Momentics Community Support
> http://community.qnx.com/sf/go/post6160
>