05th Feb 2008
CeGCC Hello World
First, copy this into a file “hello.c”
#include <windows.h>
int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow)
{
MessageBox(0, L"Hello!", L"CeGCC says...", MB_OK);
}
Here we have the generic MessageBox function, but with one twist: because we are in unicode, we need to prepend all string literals with ‘L’ (we could use the _T(”mystring”) macro, but I think it looks more ugly). If you try do compile
MessageBox(0, "Hello!", "CeGCC says...", MB_OK);
You will get an error complaining something about converting to LPCWSTR (meaning it wants unicode and didn’t get it).
To compile this source (you need to have first installed CeGCC), enter this at command line:
arm-wince-mingw32ce-gcc hello.c -o hello.exe
You can then copy the .exe file over to your Windows Mobile device and double click on it in the file manager to run your first program!
First, copy this into a file “hello.c”
#include <windows.h>
int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow)
{
MessageBox(0, L"Hello!", L"CeGCC says...", MB_OK);
}
Here we have the generic MessageBox function, but with one twist: because we are in unicode, we need to prepend all string literals with ‘L’ (we could use the _T(”mystring”) macro, but I think it looks more ugly). If you try do compile
MessageBox(0, "Hello!", "CeGCC says...", MB_OK);
You will get an error complaining something about converting to LPCWSTR (meaning it wants unicode and didn’t get it).
To compile this source (you need to have first installed CeGCC), enter this at command line:
arm-wince-mingw32ce-gcc hello.c -o hello.exe
You can then copy the .exe file over to your Windows Mobile device and double click on it in the file manager to run your first program!
Posted in axim, c, how-to, ubuntu, windows mobile | No Comments »






