Click here to Skip to main content
Click here to Skip to main content

Using the Free Visual C++ 2005 Express Edition to Develop Win32 Applications

By , 23 Sep 2006
 

Introduction

Microsoft has released Visual C++ 2005 Express Edition which can be freely downloaded and used, even for developing commercial applications. However, if you wish to develop good old native 32-bit Windows applications (i.e. not .NET) such as applications that use the wxWidgets Framework, you need to make a few configuration changes.

The information in this article is not new and most of it can be found by Googling or by clicking this link. Much of it is also on the Microsoft forums, but I decided to create this article for the following reasons:

  1. To store this information for reference to ensure it remains accessible
  2. To save people time by having it all in one place (I had to Google to find bits and pieces.)
  3. To have a place where people can add additional useful information (The Microsoft forums do not seem to work anymore, so I cannot add notes on there and some people are stumbling on this as well.)
  4. To encourage developers out there to release their efforts and to help them find some good free tools to get started

What You Need

Visual C++ 2005 Express

Go to the Microsoft Web site and download "Visual C++ 2005 Express". Likely you will want to download a file named VC.iso (473,720 KB). Burn this to a CD or use a free tool such as VCdControlTool or DiskPrivate to access the contents. Install it using the default locations.

Platform SDK

Download the Platform SDK from Microsoft's Web site. I got PSDK_x86.exe (1.26 MB). Search for Platform SDK which will locate "Microsoft ® Windows Server® 2003 R2 Platform SDK Web Install" (See link here). If you scroll down you will see PSDK_x86.exe. That is the only piece you need.

Install the Platform SDK using its default recommended settings. I did not run the batch file to register it with Visual C++ (it puts it in the Start menu but it does not seem to accomplish anything if you do run it, so I had it unregister itself again using the option in the Start menu).

How to Make Visual Studio Work with the Platform SDK

Most of this is based on the official instructions which can be found here.

Include Directories

Without fixing this, you will get errors such as not being able to include windows.h. Start Visual Studio and in the menu under the Projects and Solutions section in the Options dialog box, add the paths to the appropriate subsections:

  • Executable files: C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Bin
  • Include files: C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Include
  • Library files: C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Lib

Be sure to check that these paths are remembered by Visual Studio! Close the view and go back there and make sure it remembers them! Also use Windows Explorer to verify these directories as the SDK may have installed to a different directory. The directories may in fact be:

  • Executable files: C:\Program Files\Microsoft Platform SDK\Bin
  • Include files: C:\Program Files\Microsoft Platform SDK\Include
  • Library files: C:\Program Files\Microsoft Platform SDK\Lib

This is a major stumbling block for many people. Verify the directories before adding them!

Default Link Libraries

Without fixing this, you will get unresolved external link errors about Windows API functions. Close Visual Studio and then edit C:\Program Files\Microsoft Visual Studio 8\VC\VCProjectDefaults\corewin_express.vsprops and change:

AdditionalDependencies="kernel32.lib"

to:

AdditionalDependencies="kernel32.lib user32.lib gdi32.lib winspool.lib
    comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib"

Enable Win32 Applications

Edit the file C:\Program Files\Microsoft Visual Studio 8\VC\VCWizards\AppWiz\Generic\Application\html\1033\AppSettings.htm. Using Notepad or any plain text editor, put // in front of the following lines (as well as any other disabled = true lines if you want):

WIN_APP.disabled = true;
WIN_APP_LABEL.disabled = true;
DLL_APP.disabled = true; 
DLL_APP_LABEL.disabled = true;

BUT...

And that should do it! BUT...

What You Do Not Get

What About MFC?

Not included. You can use something like wxWidgets as an alternative for new development work. Likely if you want MFC though, then you need to pay.

What About ATL / WTL?

Not included. However, you can apparently get ATL / WTL as explained in another CodeProject article, Using WTL with Visual C++ 2005 Express Edition.

What About a Free Resource Editor?

Studio Express does not let you edit resource files. Taken from the above article, you can try:

  1. Here is a list of free resource editors (Looks like the Watcom C++ compiler has a standalone resource editors application)
  2. WEditRes
  3. Or (for an IDE that also seems to let you edit resources): RadASM© Win32 assembly IDE for masm/tasm/fasm/nasm/goasm/hla
  4. wxWidgets also has some sort of system where you use XML to define your resources and there are free RAD applications, but I have not looked into that yet.

What About an Installer?

If you wish to create an install/uninstall for your applications, I suggest you try the free Inno compiler. Free for commercial applications even and easy to use.

What About Other Compilers that Integrate with Visual Studio?

Visual Studio Express does not let you install other compilers such as Intel Fortran that integrate directly with Visual Studio Express. However, some of these provide their own IDEs.

Final Comment

If you know of other truly free software pieces that may be handy in this regard, please post a comment.

History

  • 23rd September, 2006: Initial post

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

NeWi
Web Developer
Canada Canada
Member
No Biography provided

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
QuestionHow about the license?memberAudi Nugraha19 Jul '08 - 21:31 
I wonder, could we make commercial apps using Express edition?
GeneralTwo useful "external tools" for Visual C++ 2005 ExpressmemberPetulka Janulka17 Oct '07 - 9:55 
Visual Studio 2005 Express comes for free but the ways of extending its functionality by plug-ins are disabled by design. The two utilities described here shows that in some cases there is a way for adding/extending the built-in functionality by using "External Tools".
 
When working with Visual Studio 6.0 with WorkspaceUtils installed, I was used to easily switch between header and corresponing *.c/*.cpp file and back by pressing a hot key. I was also used to select any file referenced in the workspace by typing a few first letters of the file name and then choosing the right one from a list of matching files. These features make the work far more confortable than finding and picking the files from the workspace/solution window.
 
Visual C++ 2005 Express already contains some kind of described functionality ("Go to header file" context menu item and "open" command in command window). The "Go to header file" does not work the other direction and also fails if corresponding files are located in different directories. The "open" command works quite well but it needs to be entered from command window or from Find/command box on toolbar.
 
The "Incremental File Open" and "Header Flip" utilities (http://www.volny.cz/pjanec2/) solve the inconveniences. They can be installed as External Tools and launched by user definable hot key. The Incremental File Open supports also substring filtering of files, i.e. it is possible to narrow the selection of files to those whose name contains (not only begins with) the string entered. The Header Flip searches the solution for corresponding file name independently on the directory the file is located in. If multiple corresponding files are found, a selection dialog shows up.
GeneralSomething else to try if you still can't buildmemberDavid Hooker19 Aug '07 - 19:38 
I couldn't get even this to compile and link:
 
#include
 
int WINAPI WinMain (HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nShowCmd)
{
WNDCLASSEX wcex;
 
RegisterClassEx (&wcex);
 
return 0;
}
 

and got this message:
 
1>------ Rebuild All started: Project: TestLink2, Configuration: Debug Win32 ------
1>Deleting intermediate and output files for project 'TestLink2', configuration 'Debug|Win32'
1>Compiling...
1>Main.cpp
1>Linking...
1>LINK : C:\Users\David\Documents\Visual Studio 2005\Projects\TestLink2\Debug\TestLink2.exe not found or not built by the last incremental link; performing full link
1>Main.obj : error LNK2019: unresolved external symbol __imp__RegisterClassExA@4 referenced in function _WinMain@16
1>C:\Users\David\Documents\Visual Studio 2005\Projects\TestLink2\Debug\TestLink2.exe : fatal error LNK1120: 1 unresolved externals
1>Build log was saved at "file://c:\Users\David\Documents\Visual Studio 2005\Projects\TestLink2\TestLink2\Debug\BuildLog.htm"
1>TestLink2 - 2 error(s), 0 warning(s)
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
 

(I pasted this so that search engines might find this post, and some other poor bugger might avoid wasting an inordinate amount of time over as a simple fix.)
 

Go to the solution explorer pane (left side of the screen), right click the project (not the solution), select properties, select Configuration Properties > Linker > Input, and input the lib files required into the "Additional Dependencies" field (for example, "user32.lib" without the quotes). Clean and rebuild works for me.
 
I wish this had been made more obvious, I expected this to just work.
 

Also, I had trouble getting breakpoints to work. To fix this ensure the project and the solution are in Debug mode (not release), go to project properties again, Configuration Properties > C/C++ > General and select "Program Database" for the Debug Information Format. Go to Configuration Properties > Linker > Debugging and select "Yes" for "Generate Debug Info". Clean and rebuild.
Questionerror C2664: 'MessageBoxW' : cannot convert parameter 3 from 'const char [5]' to 'LPCWSTR'memberdeXo-fan19 Aug '07 - 0:26 
I have done exactly as the article instructs me to, but still, I get this error:
 
------ Build started: Project: OpenGL, Configuration: Debug Win32 ------
Compiling...
main.cpp
c:\documents and settings\administrator\skrivebord\programmering\c++\opengl\main.cpp(4) : error C2664: 'MessageBoxW' : cannot convert parameter 3 from 'const char [5]' to 'LPCWSTR'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
Build log was saved at "file://c:\Documents and Settings\Administrator\Skrivebord\Programmering\C++\OpenGL\Debug\BuildLog.htm"
OpenGL - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
 

... And the code I enter:
 
#include
 
int WINAPI WinMain (HINSTANCE Instance, HINSTANCE, PSTR, int) {
MessageBox (NULL, (LPCWSTR) "Test", "Test", MB_OK);
}

AnswerRe: error C2664: 'MessageBoxW' : cannot convert parameter 3 from 'const char [5]' to 'LPCWSTR'members_tec26 Aug '07 - 0:41 
By default, Visual Studio 2005 uses the Unicode libraries. You can either switch your project back to ASCII (Project Properties->General->Character Set), or you can wrap your string in the TEXT() macro to convert it to Unicode. Unicode is the way of the future, so you really should use it if you can.
QuestionHow to build a standalone native win32 exe?memberdimout4 Jun '07 - 22:15 
I've done all what the article told me. I was able to successfully create and build an empty Hello World win32 application. The problem is it only works on my development machine.
 
On other machines, it says "The system cannot execute the specified program". It looks like the issue is about the .NET libraries not being installed, but what the heck? Why on earth would it link to .NET if I told it I wanted a native win32 project?
 
Will you please give me a hint what I might have missed in the project properties that causes this?
 
Thanks in advance?
AnswerRe: How to build a standalone native win32 exe?memberdimout4 Jun '07 - 22:35 
I seem to have found the root cause. It is the new ms vc++ run time library called msvcr80.dll. The compiler links it and it can't be found anywhere else unless Visual Studio 2005 is installed there. Does anyone know if there's a way to make the compiler use the old msvcrt.dll instead of this new runtime?
GeneralRe: How to build a standalone native win32 exe?memberAlexandru Matei14 Nov '07 - 20:58 
Hello,
 
You could try to statically link the VC++ runtime library.
 
Choose from the Visual C++ menu:
Project -> Properties-> Configuration Properties -> C/C++ Code generation -> Runtime Library
 
One of the combo-box options is: Multi-threaded (MT)
Select this option and recompile the application.
 
Please tell me if by doing this, you'll see any improvement..
GeneralRe: How to build a standalone native win32 exe?sussIgeL3 Dec '07 - 16:21 
TO:Alexandru Matei
 
There is a problem occured when i did this, and the project can not be buildable now. If you have any other solutions please post. Thanks.
GeneralRe: How to build a standalone native win32 exe?memberMember 459781117 Dec '07 - 7:14 
Read this:
http://www.codeproject.com/kb/cpp/vcredists_x86.aspx[^]
 
Options are endless...
Unsure | :~
GeneralAnother Resource Editing OptionmemberNetstanley21 May '07 - 9:14 
The Introductory Edition of Visual C++ 6.0 which was bundled with various
books on learning to program (SAMS Teach Yourself C++ in 21 Days was one)
will enable you to create and also edit the resources generated with the VSE 2005 Windows app wizard.
Double clicking from Windows explorer on the resource file will direcly load the resource into the resource editor. Once youve finished editing, save it and switch back to VC++ 2005 and re-compile your app.
Generalcannot find ...\1033\AppSettings.htmmemberfab!an7 May '07 - 23:51 
Hello together,
I cannot find the apsettigns.htm. I even don't have a folder ...\1033. I only have ..\1031. Starting a new Win32 project I get an error can't find \1033\default.htm.
I installed everything as documented but obviously there seems to be something wrong. Can anybody help me?
bests
Fabian
GeneralCooliomemberMerlinblack22 Apr '07 - 18:19 
Good to have all this in one place. Good effort.
 
Nigel Atkinson
 
"Land a'hoy!" * CRASH * "I should av said that sooner eh?" - Eckles, The Goon Show

GeneralFree GUI Designer for Win32 native applicationsmember_flix01_18 Jan '07 - 7:27 
You could try this resource too.
 
http://sallyide.sourceforge.net[^]
 
Actually it's integrated in another IDE, but it should work with both the Mingw and the Visual C++ compiler (I tested it with the VC Toolkit 2003, so probably it can be set to work with the 2005 VC compiler too).
 

 
Regards,
Flix
GeneralA good and free resource editormemberyarp29 Oct '06 - 20:04 
http://www.resedit.net/
 
I like the property editor, something which was lacking in VS6.
 

 
Yarp
http://www.senosoft.com/

GeneralUsing GLUT With Visual C++ Express EditionmemberAshwin Nanjappa26 Sep '06 - 16:40 
Thanks for jotting down this article. It's useful for newbies getting started with Express Edition.
 
I've written a similar article for using GLUT with Visual C++ Express Edition. It can be found here [PDF].
GeneralMFCmemberrvZarathustra25 Sep '06 - 11:25 
Hi!
 
Several things:
 
1.PSDK includes source code of MFC (not latest version). Just take a look to \include\MFC and \Source\MFC folders.
Unfortunately, lib folder doesn't contain MFC lib files.
It's possible to make libs by scratch (using a make file from source\mfc) but I have had several problems and didn't fix these.
 
2. If you would like to integrate PSDK help to the IDE you have to read this article or just scroll the article down and find item 5: "To integrate the Platform SDK documentation into the Visual C++ Express documentation, follow the instructions at Visual Studio 2005 Express Edition Combined Help Collection Manager".
 
Note: the article must be opened inside the IDE.
 
Good luck!
GeneralRe: MFCmemberDanny Ruijters26 Oct '08 - 2:22 
Alternatively you can also use the DDK, see this article: http://secure.codeproject.com/KB/MFC/MFCinVisualStudioExpress.aspx[^]
 
cheers,
Danny
GeneralAnother resource for youmemberDavid O'Neil23 Sep '06 - 12:45 
I don't know if you are interested in this. Good job on your article, and happy coding!
 
David

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web04 | 2.6.130516.1 | Last Updated 23 Sep 2006
Article Copyright 2006 by NeWi
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid