Skip navigation.
Home
The QNX Community Portal

View topic - How to create a C++ code for a new project in PhAB

How to create a C++ code for a new project in PhAB

Isn't the name clear?

How to create a C++ code for a new project in PhAB

Postby cyvinay4 » Mon Sep 01, 2008 4:32 am

Most of the time when i create a new project and generate a code for the same,PhAB generates C code(abmain.c). Not able to find a way to generate abmain.cc.
cyvinay4
New Member
 
Posts: 9
Joined: Mon Aug 25, 2008 5:15 am

RE: How to create a C++ code for a new project in PhAB

Postby PeterHuber » Mon Sep 01, 2008 7:33 am

you hav to define a callback function located in a C++ file (e.g. setup@setup.cc) before you build the user interface the first time. If you do this, PhAB creates *.cc files instead of *.c files.

-Peter
PeterHuber
Active Member
 
Posts: 55
Joined: Sat Sep 01, 2007 11:11 am
Location: Switzerland

How to create a C++ code for a new project in PhAB

Postby cyvinay4 » Tue Sep 02, 2008 4:09 am

Thanks Peter!

i could not understand giving the callback function in a c++ file.

Normally while creating a new project i choose a plain window to start with and then i put some controls(buttons etc.) on that window and then i add "activate"(on button click) function. Then i generate code and modifies the C-file generated by PhAB for that button click function.

Exactly where and how i can implement your suggestion in the above mentioned steps or am i missing some step.Please elaborate on that.
cyvinay4
New Member
 
Posts: 9
Joined: Mon Aug 25, 2008 5:15 am

RE: How to create a C++ code for a new project in PhAB

Postby PeterHuber » Tue Sep 02, 2008 7:21 am

cyvinay4,

there are different places where you can define callback functions in PhAB. One is your example of a button activat callback - an other is my example of the setup callback function (Project->Properies->Setup Function)

In the text field you have to write the name of the callback function you want to be generated by PhAB. Now you have the possibility to specifiy the name of the file in which the callback function will be located: you simply add a '@' and the filename to the callback function name. My example above will generate the setup callback function in a file named 'setup.cc'.

And this is the trick: if PhAB detects a filename ending '.cc' it assumes the project is C++.

BUT: there are a lot of other things you have to know until you will succeed with PhAB and C++ (e.g. you need to add the C++ nature to your Photon project in Momentics). It's a job for an experienced programmer willing to understand the architecture of Photon (and PhAB).

Pointers:
- search for "PhAB C++" in this forum
- have a look at http://phontonmm.sourceforge.net/index.html

I would consider the following for an application architecture:
- strong separation of GUI and application logic (library, resource manager, ...)
- Use PhAB and plain C for the GUI
- or use C++ and Photon without PhAB for the GUI

-Peter
PeterHuber
Active Member
 
Posts: 55
Joined: Sat Sep 01, 2007 11:11 am
Location: Switzerland


Return to GUI Programming

Who is online

Users browsing this forum: No registered users and 1 guest