MSVC++ 2005: No 'windows.h' and 'winsock.h'

Got a problem with OpenTTD? Find some help here.

Moderator: OpenTTD Developers

Post Reply
Gastje33
Engineer
Engineer
Posts: 22
Joined: 05 Aug 2004 14:06
Location: Netherlands

MSVC++ 2005: No 'windows.h' and 'winsock.h'

Post by Gastje33 »

I've tried to compile OpenTTD with Visual C++ 2005 Express Edition and it did well, but he couldn't find two header files ('windows.h' and 'winsock2.h'). I searched on all my drives and the he didn't found 'windows.h' or 'winsock2.h'. The include folder doesn't contains these two important files.

I use TortoiseSVN and downloaded from svn://svn.openttd.org/trunk (r: 4750). I'm running Windows XP Service pack 2.

The source is fine, but I'm missing those two goddamned headers. :evil:

edit: I've already found it. You may not build unmanaged applications with Visual C++ Express :shock:

Bye Visual C++ :twisted:
User avatar
Darkvater
Tycoon
Tycoon
Posts: 3053
Joined: 24 Feb 2003 18:45
Location: Hong Kong

Post by Darkvater »

TrueLight: "Did you bother to read any of the replies, or you just pressed 'Reply' and started typing?"
<@[R-Dk]FoRbiDDeN> "HELP, this litte arrow thing keeps following my mouse, and I can't make it go away."
Gastje33
Engineer
Engineer
Posts: 22
Joined: 05 Aug 2004 14:06
Location: Netherlands

Post by Gastje33 »

Darkvater wrote:Did you try this one?

http://msdn.microsoft.com/vstudio/express/visualc/
Yes, I did. But you can only code managed software with that. So some important headers for unmanaged programs are not included.
User avatar
Darkvater
Tycoon
Tycoon
Posts: 3053
Joined: 24 Feb 2003 18:45
Location: Hong Kong

Post by Darkvater »

I think you have to download the Windows SDK

http://msdn.microsoft.com/vstudio/expre ... usingpsdk/

Please confirm if this works.
TrueLight: "Did you bother to read any of the replies, or you just pressed 'Reply' and started typing?"
<@[R-Dk]FoRbiDDeN> "HELP, this litte arrow thing keeps following my mouse, and I can't make it go away."
Gastje33
Engineer
Engineer
Posts: 22
Joined: 05 Aug 2004 14:06
Location: Netherlands

Post by Gastje33 »

Darkvater wrote:I think you have to download the Windows SDK

http://msdn.microsoft.com/vstudio/expre ... usingpsdk/

Please confirm if this works.
I've found a way around this, using the Platform SDK (is that the 'Windows SDK'?) and a couple of changes in some config files. I'm not sure if this totally legally, but I read somewhere that Micrsoft itself has a tutorial online - which I haven't found yet :P .
User avatar
Darkvater
Tycoon
Tycoon
Posts: 3053
Joined: 24 Feb 2003 18:45
Location: Hong Kong

Post by Darkvater »

I have no idea what you have exactly done but the link I posted also talks about changing some config settings, etc. I am sure that is perfectly legal as it is on MS's own MSDN website.
Step 1: Install Visual C++ Express.

If you haven't done so already, install Visual C++ Express.


Step 2: Install the Microsoft Platform SDK.

Install the Platform SDK over the Web from the Download Center. Follow the instructions and install the SDK for the x86 platform.


Step 3: Update the Visual C++ directories in the Projects and Solutions section in the Options dialog box.

Add the paths to the appropriate subsection:

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

Note: Alternatively, you can update the Visual C++ Directories by modifying the VCProjectEngine.dll.express.config file located in the \vc\vcpackages subdirectory of the Visual C++ Express install location. Please make sure that you also delete the file "vccomponents.dat" located in the "%USERPROFILE%\Local Settings\Application Data\Microsoft\VCExpress\8.0" if it exists before restarting Visual C++ Express Edition.


Step 4: Update the corewin_express.vsprops file.

One more step is needed to make the Win32 template work in Visual C++ Express. You need to edit the corewin_express.vsprops file (found in C:\Program Files\Microsoft Visual Studio 8\VC\VCProjectDefaults) and

Change the string that reads:

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"


Step 5: Generate and build a Win32 application to test your paths.

In Visual C++ Express, the Win32 Windows Application type is disabled in the Win32 Application Wizard. To enable that type, you need to edit the file AppSettings.htm file located in the folder “%ProgramFiles%\Microsoft Visual Studio 8\VC\VCWizards\AppWiz\Generic\Application\html\1033\".

In a text editor comment out lines 441 - 444 by putting a // in front of them as shown here:

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

Save and close the file and open Visual C++ Express.

From the File menu, click New Project. In the New Project dialog box, expand the Visual C++ node in the Product Types tree and then click Win32. Click on the Win32 Console Application template and then give your project a name and click OK. In the Win32 Application Wizard dialog box, make sure that Windows application is selected as the Application type and the ATL is not selected. Click the Finish button to generate the project.

As a final step, test your project by clicking the Start button in the IDE or by pressing F5. Your Win32 application should build and run.
TrueLight: "Did you bother to read any of the replies, or you just pressed 'Reply' and started typing?"
<@[R-Dk]FoRbiDDeN> "HELP, this litte arrow thing keeps following my mouse, and I can't make it go away."
Gastje33
Engineer
Engineer
Posts: 22
Joined: 05 Aug 2004 14:06
Location: Netherlands

Post by Gastje33 »

Thanks, that tutorial was what i meant :P now I should can compile the sources in VC++ :) But I haven't downloaded the Platform SDK yet, i'll do that tomorrow.

Sorry, I didn't saw your link. :oops:
Post Reply

Return to “OpenTTD Problems”

Who is online

Users browsing this forum: No registered users and 3 guests