The C code that you wrote, will not work in a WinCE app. The entry point for your WinCE app is WinMain, not regular main.
All that iostream stuff is from the STL. From my own experience there are some differences in how the STL is actually implemented on WinCE versus on Windows Desktop. That will be the source of issues now and in the future. Here's an SO article discussing these problems.
Here is how you might do it in WinCE (code not actually tested)
#include "stdafx.h"
using namespace std;
#include <iostream>
int WINAPI WinMain (
_In_ HINSTANCE hInstance,
_In_ HINSTANCE hPrevInstance,
_In_ LPSTR lpCmdLine,
_In_ int nCmdShow)
{
cout << "hello world" << endl;
return 0;
}
A Windows Application and a WinCE application follows different rules and needs different libraries than a console (CRT) app. In your Visual Studio, create a default Win32 project and create a default console app. Then compare the project files between all three in a text compare tool. You'll see many differences. These differences include at least the following:
- A different entry point -- WinMain, _WinMain, _tWinMain, etc
- They enable use of the windows.h file and all the related apparatus
- A different set of default .lib files you must link to
Despite all of this, WinCE apps get fun when you get into the GUI stuff. If I were you, I'd get out of this C++ stuff and get into the C# Compact Framework.