SDL in Visual C++ express

Started by
6 comments, last by Jimmy_Friction 18 years, 8 months ago
hope someone can help! I've been trying to setup visual c++ express edition with SDL. i have installed the microsoft sdk and done all of the changes recommended on other threads and still can't get it working. the error i'm getting now is Compiling... main.cpp c:\documents and settings\johnny five\my documents\visual studio 2005\projects\sdl test\sdl test\main.cpp(17) : fatal error C1010: unexpected end of file while looking for precompiled header. Did you forget to add '#include "stdafx.h"' to your source? Build log was saved at "file://c:\Documents and Settings\Johnny Five\My Documents\Visual Studio 2005\Projects\SDL Test\SDL Test\Debug\BuildLog.htm" SDL Test - 1 error(s), 0 warning(s) i am just trying to compile the code written for the sdl install...here #include "SDL.h" int main(int argc, char **argv) { printf("\nHello SDL User!\n"); /* initialize SDL */ if ( SDL_Init( SDL_INIT_VIDEO ) < 0 ) { fprintf( stderr, "Video initialization failed: %s\n", SDL_GetError( ) ); SDL_Quit( ); } SDL_Quit( ); return 0; } any ideas? i am pretty new to programming so i am not too sure how to deal with this
Advertisement
Have you tried adding #include "stdafx.h at the top of your program yet?

Chances are when you made a program, you did not specify it to be an 'Empty Project', so by default a stdafx.h/.cpp file are generated to use.
Ok, so I have a new problem. Didn't know it was so tough to get this thing going...well for noobs anyway


LINK : fatal error LNK1104: cannot open file 'user32.lib'

This is my next error...any ideas
Ok for that, you have two chocies

* You can either install the platform SDK so you will have all the proper libs for VC++ 8, avaliable here with instructions here.

* You can click on Project->Properties->Configuration Properties->Linker->Input then in the "Ignore Specific Library", type in "user32.lib".

As another word of clarity, the option was "Precompiled Header" in the VC++ 8 project creation dialog.
No go, same error

LINK : fatal error LNK1104: cannot open file 'user32.lib'

also, i have already installed the microsoft sdk...

here are my edited directories in the vccprojectengine.dll.express, i think they are right, but i am new to this too.


Include="c:\sdl\include;C:\Program Files\Microsoft Platform SDK\include;$(VCInstallDir)include;$(FrameworkSDKDir)include"

Library="c:\sdl\lib;C:\Program Files\Microsoft Platform SDK\lib;$(VCInstallDir)lib;$(FrameworkSDKDir)lib;$(VSInstallDir);$(VSInstallDir)lib"
Path="$(VCInstallDir)bin;$(VCInstallDir)PlatformSDK\bin;$(VSInstallDir)Common7\Tools\bin;$(VSInstallDir)Common7\tools;$(VSInstallDir)Common7\ide;$(ProgramFiles)\HTML Help Workshop;$(FrameworkSDKDir)bin;$(FrameworkDir)$(FrameworkVersion);$(VSInstallDir);$(PATH)"

Reference="$(FrameworkDir)$(FrameworkVersion)"
Source="C:\Program Files\Microsoft Platform SDK\src;$(VCInstallDir)crt\src"
it has to be a problem with the directories. user32.lib is in the "c:\program files\microsoft platform sdk"
Oh, well since you have the SDK alredy installed, all you really need to do now is set the directory for the project. What you need to do is go to "Project-Properties->Configuration Properties->Linker->General->Additional Library Directories" and enter in "C:\Program Files\Microsoft Platform SDK\lib" as well as the "c:\sdl\lib". Don't forget to use a semi-colon to seperate paths.
hey thanks a lot drew you are awesome!

This topic is closed to new replies.

Advertisement