I'm completely new at C++, though have reasonable experience with .NET.
I'm trying to switch from VB.net to C++ because I want to write native code... but i'm having problems.
I have 'Microsoft Platform SDK for Windows XP SP2' and 'Visual C++ 2005 Express Edition Beta 2' installed. I have also created a dir in "C:\Program Files\Microsoft Visual Studio 8\VC" called 'PlatformSDK' which has the Bin, Include and Lib folders in it.
Now how do i make a native program, not complied in .NET
If i go to File|New|Project| Win32.... I can only select console application, windows application is greyed out.
If i select "Windows form application" it compiles in .NET..
Do i need to register the PSDK directorys or set up some paths
Please help!

C++ & SDK
Gaj
parmas
You should download the newest (uniformed) PSDK:
http://www.microsoft.com/downloads/details.aspx FamilyId=D8EECD75-1FC4-49E5-BC66-9DA2B03D9B92
Create a "console-app" and the go to the linker settings (Project|Properties|Linker|General) and select "Subsystem: Windows".
No, it is already registred by default.
---
Greetings
Jochen
PS: Please mark the best replies as anserws!
Alex N. Winokuroff
No you create a Win32-App (no console app)!
Therefor you need to replace the console-App entry "main" with the correcponding windows-entry: "WinMain"!
See: WinMain
http://msdn.microsoft.com/library/en-us/winui/winui/windowsuserinterface/windowing/windows/windowreference/windowfunctions/winmain.asp
For an example see: Using Messages and Message Queues
http://msdn.microsoft.com/library/en-us/winui/winui/windowsuserinterface/windowing/messagesandmessagequeues/usingmessagesandmessagequeues.asp
The_Landlord
Bye
Paolo
BruceVik
Beto
By default the project setting is UNICODE!
Therefor you should use the T-Macros!!! (TCHAR ...)
http://msdn.microsoft.com/library/en-us/vccore/html/_core_generic.2d.text_mappings_in_tchar..h.asp
Your example should look like:
#include <windows.h>
#pragma comment(lib, "user32.lib")
#include <tchar.h>
int APIENTRY _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
MessageBox(NULL, _T("Ciao"), _T("MsgBox") , MB_OK);
return 0;
}
Or you can switch to ANSI (or Mutli-Byte-Character set): Project|Settings|General: Character encoding
Geek Squad
PSDK XP-SP2: Designed only for XP-SP2 development!
PSDK W2003SP1: Designed to be used for *all* Windows OSs.
Greetings
Jochen
Proximus140753
Linking...
MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function _WinMainCRTStartup
Debug\test.exe : fatal error LNK1120: 1 unresolved externals
IntMain
I've installed the PSDK W2003SP1 but I can't compile the following simple code:
#include <windows.h>
int
APIENTRY WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow){MessageBox(NULL,
"Ciao","MsgBox",0);return 0;
}
Build Log
Command Lines
Output Window
Results
The build log file is:
In VC++ 6.0 the same code work great!!
What's wrong
Thanks Paolo
P.S. My OS is MS Windows XP Home SP2