QNX RTOS v4 Knowledge Base
QNX RTOS v4 Knowledge Base
Title |
Building a Photon application without using PhAB |
Ref. No. |
QNX.000006425 |
Category(ies) |
Development |
Issue |
We are porting our non-gui applications to Photon. Do we need PhAB to create a Photon application? We are having problems creating a simple Photon window. Do you have any examples of a working code sample to create a window in photon?
|
Solution |
This is a small example of a window with a button. The button doesn't do anything because there is no callback attached to it.
#include <Pt.h>
main(int argc, char* argv[]) { x09PtWidget_t * window; x09PtArg_t args[1];
x09if (( window = PtAppInit(NULL, &argc, argv, 0, NULL)) == NULL) x09x09exit(1);
x09PtSetArg(&args[0], Pt_ARG_TEXT_STRING, "Press to exit", 0); x09PtCreateWidget(PtButton, window, 1, args); x09PtRealizeWidget(window);
x09PtMainLoop(); }
This is compile line:
x09x09cc hello.c -l photon_s -o hello
You can get more information about this in the Photon Programmers Guide.
|
|