how to tell the MomenticsIDE to use the globals.h and init.c

Hi there,

i´m not really familiar with the new QNX Momentics IDE and i didn´t find an answer to my question in the help-files.
I want to port an existing Phab - Application to the new IDE (not really to port it, but create a new project from scratch with the same functionality of the existing one to get some experience), so i created a project with the Momentics IDE, built the GUI with the Phab and generate the UI (in Phab: Build → Generate UI).
After that, i took the code from the old files and inserted it in the generated *.c-files (the callbacks).
As far no problems, but the old Application uses a globals.h and an init.c for some variables. I created these files and inserted the code, but when i try to build the project in the IDE, not one global variable used in the other *.c-files is known by the IDE (“undefined reference to ´retvalue´”).
The old project works well.

Where do i have to tell the IDE to look into the globals.h and init.c when there is an undefined variable in any file in the project?

Thanks in advance,

Ralph

Shit, I had a large and complete reply but this forum killed it. :frowning:

Short answer is: Copy your old project into ~/workspace then convert it to the newer project type using phab’s “Project → Convert to Eclipse Project” then, in eclipse, “Import → Existing Project into Workspace”.

Phab can still edit the phab part of the project.

Thank you for your answer, but my main Problem is not to port the project, i want to create one from scratch, just with the same functionality than the existing one.

Where can i define my globals, to use them in different callbacks?

I think easiest way to do this is to have all your callbacks and other code in one file, you can do this by defining the name of your callback in PhAb as ‘mycallback@my_c_code.c’ this puts all your callbacks into one file, and you can access global vars as usual.

Project → Properties (F2) brings up a window where you should enter globals.h into the Global Header field.

You have a bit of a job ahead of you as it should have been done first, or atleast that was the case. What this does is tell phab to add #include “globals.h” into every .c file it creates for you and it don’t do it for you retrospectively so fingers crossed you don’t have a huge list of little .c files.