Compiling SDL 1.3 on Windows with Visual C++ Express?

I’ve published a game using SDL 1.3 on the Mac, and now am looking to port it to Windows. Windows is more unfamiliar territory to me. I’ve installed a clean copy of Windows XP, upgraded to Service Pack 3, and installed Microsoft Visual C++ Express 2010 edition. However, I get various errors when trying to compile the SDL projects for this.

Opening the project:
SDL-1.3\SDL-1.3.0-5605\VisualC\SDL\SDL_VS2010

and choosing “Build Solution” results in this error:

1> SDL_xaudio2.c
1>c:\documents and settings\vern jensen\desktop\sdl-1.3\sdl-1.3.0-5605\src\audio\xaudio2\sdl_xaudio2.h(28): fatal error C1083: Cannot open include file: ‘XAudio2.h’: No such file or directory

Do I need to install something else that SDL is dependent upon before it’ll compile?

Building:
SDL-1.3\SDL-1.3.0-5605\VisualC\SDLmain\SDLmain_VS2010

seems to work just fine.

Would I have more success installing the 2005 or 2008 versions of Visual Studio Express? Or is there an easy fix for the above compile error?

-Vern

P.S. This is running the SDL build from August 5th (the current source snapshot in easily downloadable .zip form.)

Apparently I’m not the only one who has run into this:

http://forums.libsdl.org/viewtopic.php?p=30643#30643

But no one has replied to his message…

I made a shallow fork of SDL for the CoApp project a little while ago
and updated all VS2010 project files in the process. They should work
for any version of VS2010 (including express). I’ve never got around to
move this back into the main SDL repository though - maybe someone can
take a stab at it.

–AndreasOn 10/29/11 12:15 PM, VernJensen wrote:

Apparently I’m not the only one who has run into this:

http://forums.libsdl.org/viewtopic.php?p=30643#30643

But no one has replied to his message…


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

As the instructions state, you need to install the directx SDK from
Microsoft. You can find it here:
http://www.microsoft.com/download/en/details.aspx?id=6812 [1]

It contains
XAudio.h - After you install it, you’ll need to modify
$(USERPROFILE)appdatalocalmicrosoftmsbuildv4.0 according to this article:
http://blogs.msdn.com/b/vcblog/archive/2010/03/02/visual-studio-2010-c-project-upgrade-guide.aspx
[2] (relevant excerpt below)

  1. VC++ DIRECTORIES CHANGE

VC++
Directories are no longer supported in VS2010 through Tools->Options page.
Instead, VS2010 introduces the user settings file
(Microsoft.cpp…users.props) to control global settings including Global
search path. These files are located at
$(USERPROFILE)appdatalocalmicrosoftmsbuildv4.0 directory. Upon migration to
VS2010, the custom settings of VC++ Directories from VS2005 or VS2008 are
migrated to these user files. These global settings files are imported into
all the converted and newly created projects.

Here are the steps to
change the settings file through UI:

? Open up property manager by
clicking on View.Property Manager.

? Expand the project node and then the
Configuration|Platform nodes, you will see “Microsoft.cpp…users” file for
each Configuration|Platform. These are the files for the global settings,
similar to the old tools/Options/VC++ Directories.

? Multi-Select
"Microsoft.cpp…users", right click and bring up the property page window

? In the property page window, click on “VC++ Directories” (for example)
in the left pane, add new paths for the directories such as “Include
Directories”. separated by semicolons

? Make sure to save the settings
before shutting down Visual Studio.

? Re-launch Visual Studio and the new
settings will be in effect.

-NOTE: IF YOU WOULD LIKE TO ONLY CHANGE THE
SETTINGS FOR ONE PROJECT, YOU CAN RIGHT CLICK ON THE PROJECT AND BRING UP
THE PROPERTY PAGE. CHANGE THE SETTINGS FOR “VC++ DIRECTORIES”, THESE
SETTINGS WILL BE PERSISTED TO THE PROJECT FILE.--------

Vijay
Varadan
Skype: vijayvaradan | USA: +1-206-849-3710 ©
India:
+1-425-956-3326 (VOIP) | India: +91-99400-13652 ©
LinkedIn:
http://linkd.in/qTORH7 [3] | Blog: http://bit.ly/oQBwNl [4]
Google+:
http://bit.ly/vijayplus [5] | Facebook: http://on.fb.me/oF7dq9 [6]
Twitter:
http://bit.ly/qsiqrp [7]

AXHAM CORPORATION | Axham Technologies,
LLP
LinkedIn: http://linkd.in/nL9wNX [8] | LinkedIn: http://linkd.in/odgEc9
[9]
Website: http://axham.com [10] | Facebook: http://on.fb.me/axhamgames
[11]
Twitter: http://bit.ly/mPaDwB [12]

On Sat, 29 Oct 2011 14:04:17
-0700, Andreas Schiffler wrote: I made a shallow fork of SDL for the
CoApp project a little while ago and updated all VS2010 project files in
the process. They should work for any version of VS2010 (including
express). I’ve never got around to move this back into the main SDL
repository though - maybe someone can take a stab at
it.

https://github.com/coapp-packages/SDL [13]

–Andreas

On 10/29/11
12:15 PM, VernJensen wrote: Apparently I’m not the only one who has run
into this:

http://forums.libsdl.org/viewtopic.php?p=30643#30643 [14]

But
no one has replied to his message…


SDL mailing
list
SDL at lists.libsdl.org
[15]
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org [16]

Links:

[1]
http://www.microsoft.com/download/en/details.aspx?id=6812
[2]
http://blogs.msdn.com/b/vcblog/archive/2010/03/02/visual-studio-2010-c-project-upgrade-guide.aspx
[3]
http://linkd.in/qTORH7
[4] http://bit.ly/oQBwNl
[5]
http://bit.ly/vijayplus
[6] http://on.fb.me/oF7dq9
[7]
http://bit.ly/qsiqrp
[8] http://linkd.in/nL9wNX
[9]
http://linkd.in/odgEc9
[10] http://axham.com/
[11]
http://on.fb.me/axhamgames
[12] http://bit.ly/mPaDwB
[13]
https://github.com/coapp-packages/SDL
[14]
http://forums.libsdl.org/viewtopic.php?p=30643#30643
[15]
mailto:SDL at lists.libsdl.org
[16]
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Also, I forgot to mention that you can only build the Win32 debug and
release builds. To build Win64 targets, you’ll have to download and install
the Windows 7.1 SDK,. Additionally you’ll have to modify all the project
files to build against the newly installed SDK rather than against the VC++
2010 Express stuff.

There are a whole bunch of issues you may (and
probably will) run into trying to get this to work. It took me the better
part of a week to get everything work. In hindsight, it would’ve been
better to buy Visual Studio 2010 Pro, except I’m stuck overseas on work and
couldn’t.

Getting Win64 working with Visual C++ 2010 Express isn’t for
the faint of heart, but if you (and others on this thread) want to give it
a shot, I’ll be happy to help. Just note that I’m GMT+5:30

-VijayOn Sat, 29 Oct 2011 21:36:26 +0000, Vijay Varadan wrote:

As the
instructions state, you need to install the directx SDK from Microsoft. You
can find it here: http://www.microsoft.com/download/en/details.aspx?id=6812
[1]

It contains XAudio.h - After you install it, you’ll need to modify
$(USERPROFILE)appdatalocalmicrosoftmsbuildv4.0 according to this article:
http://blogs.msdn.com/b/vcblog/archive/2010/03/02/visual-studio-2010-c-project-upgrade-guide.aspx
[2] (relevant excerpt below)

  1. VC++ DIRECTORIES CHANGE

VC++
Directories are no longer supported in VS2010 through Tools->Options page.
Instead, VS2010 introduces the user settings file
(Microsoft.cpp…users.props) to control global settings including Global
search path. These files are located at
$(USERPROFILE)appdatalocalmicrosoftmsbuildv4.0 directory. Upon migration to
VS2010, the custom settings of VC++ Directories from VS2005 or VS2008 are
migrated to these user files. These global settings files are imported into
all the converted and newly created projects.

Here are the steps to
change the settings file through UI:

? Open up property manager by
clicking on View.Property Manager.

? Expand the project node and then
the Configuration|Platform nodes, you will see “Microsoft.cpp…users” file
for each Configuration|Platform. These are the files for the global
settings, similar to the old tools/Options/VC++ Directories.

?
Multi-Select “Microsoft.cpp…users”, right click and bring up the property
page window

? In the property page window, click on “VC++ Directories”
(for example) in the left pane, add new paths for the directories such as
"Include Directories". separated by semicolons

? Make sure to save the
settings before shutting down Visual Studio.

? Re-launch Visual Studio
and the new settings will be in effect.

-NOTE: IF YOU WOULD LIKE TO ONLY
CHANGE THE SETTINGS FOR ONE PROJECT, YOU CAN RIGHT CLICK ON THE PROJECT AND
BRING UP THE PROPERTY PAGE. CHANGE THE SETTINGS FOR “VC++ DIRECTORIES”,
THESE SETTINGS WILL BE PERSISTED TO THE PROJECT FILE.


Vijay
Varadan
Skype: vijayvaradan | USA: +1-206-849-3710 ©
India:
+1-425-956-3326 (VOIP) | India: +91-99400-13652 ©
LinkedIn:
http://linkd.in/qTORH7 [3] | Blog: http://bit.ly/oQBwNl [4]
Google+:
http://bit.ly/vijayplus [5] | Facebook: http://on.fb.me/oF7dq9 [6]
Twitter:
http://bit.ly/qsiqrp [7]

AXHAM CORPORATION | Axham Technologies,
LLP
LinkedIn: http://linkd.in/nL9wNX [8] | LinkedIn: http://linkd.in/odgEc9
[9]
Website: http://axham.com [10] | Facebook: http://on.fb.me/axhamgames
[11]
Twitter: http://bit.ly/mPaDwB [12]

On Sat, 29 Oct 2011 14:04:17
-0700, Andreas Schiffler wrote: I made a shallow fork of SDL for the CoApp
project a little while ago and updated all VS2010 project files in the
process. They should work for any version of VS2010 (including express).
I’ve never got around to move this back into the main SDL repository though

  • maybe someone can take a stab at
    it.

https://github.com/coapp-packages/SDL [13]

–Andreas

On 10/29/11
12:15 PM, VernJensen wrote: Apparently I’m not the only one who has run
into this:

http://forums.libsdl.org/viewtopic.php?p=30643#30643 [14]

But
no one has replied to his message…


SDL mailing
list
SDL at lists.libsdl.org
[15]
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org [16]


Vijay Varadan
Skype: vijayvaradan | USA: +1-206-849-3710
©
India: +1-425-956-3326 (VOIP) | India: +91-99400-13652 ©
LinkedIn:
http://linkd.in/qTORH7 [17] | Blog: http://bit.ly/oQBwNl [18]
Google+:
http://bit.ly/vijayplus [19] | Facebook: http://on.fb.me/oF7dq9
[20]
Twitter: http://bit.ly/qsiqrp [21]

AXHAM CORPORATION | Axham
Technologies, LLP
LinkedIn: http://linkd.in/nL9wNX [22] | LinkedIn:
http://linkd.in/odgEc9 [23]
Website: http://axham.com [24] | Facebook:
http://on.fb.me/axhamgames [25]
Twitter: http://bit.ly/mPaDwB [26]

Links:

[1]
http://www.microsoft.com/download/en/details.aspx?id=6812
[2]
http://blogs.msdn.com/b/vcblog/archive/2010/03/02/visual-studio-2010-c-project-upgrade-guide.aspx
[3]
http://linkd.in/qTORH7
[4] http://bit.ly/oQBwNl
[5]
http://bit.ly/vijayplus
[6] http://on.fb.me/oF7dq9
[7]
http://bit.ly/qsiqrp
[8] http://linkd.in/nL9wNX
[9]
http://linkd.in/odgEc9
[10] http://axham.com/
[11]
http://on.fb.me/axhamgames
[12] http://bit.ly/mPaDwB
[13]
https://github.com/coapp-packages/SDL
[14]
http://forums.libsdl.org/viewtopic.php?p=30643#30643
[15]
mailto:SDL at lists.libsdl.org
[16]
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org
[17]
http://linkd.in/qTORH7
[18] http://bit.ly/oQBwNl
[19]
http://bit.ly/vijayplus
[20] http://on.fb.me/oF7dq9
[21]
http://bit.ly/qsiqrp
[22] http://linkd.in/nL9wNX
[23]
http://linkd.in/odgEc9
[24] http://axham.com/
[25]
http://on.fb.me/axhamgames
[26] http://bit.ly/mPaDwB

Awesome, thanks! I will give all that a shot.

Hi Vijay,

I’m having trouuble finding the “Properties Manager” in VS 2010, to follow the instructions you posted. When the instructions say:

Open up property manager by clicking on View.Property Manager.

what does this refer to? If to the menu, the “View” menu has no item called “Property Manager”. There is a “Solution Explorer” tab that has both a “Properties” tab and a “Properties” button at the top, but neither of these seem to be what the document is talking about.

Sorry, I’m so unfamiliar with Windows and Visual Studio, I have no idea where to find this.

Would compiling with Visual Studio 2008 be a better idea?

okay, I did a Google search and ran across an article that helped. I needed to select “Tools -> Settings -> Expert Settings” from the menu. Otherwise Microsoft hides the Properties Manager item from the View menu. How stupid!

Okay, it looks like I’m making progress. It seems the SDL library has now built, but now the test projects won’t? It seems that they can’t find the SDL.dll or icon.bmp, even though it’s looking in the correct places for them, and the SDL library and .dll do exist in those directories. The output I’m getting when compiling is:

1>------ Build started: Project: SDL, Configuration: Release Win32 ------
1> Creating library Win32\Release\SDL.lib and object Win32\Release\SDL.exp
1> SDL_VS2010.vcxproj -> C:\Documents and Settings\Vern Jensen\Desktop\SDL-1.3\SDL-1.3.0-5605\VisualC\SDL\Win32\Release\SDL.dll
2>------ Build started: Project: testdraw2, Configuration: Release Win32 ------
3>------ Skipped Build: Project: testshape, Configuration: Release Win32 ------
3>Project not selected to build for this solution configuration
4>------ Build started: Project: testsprite2, Configuration: Release Win32 ------
4> testsprite2_VS2010.vcxproj -> C:\Documents and Settings\Vern Jensen\Desktop\SDL-1.3\SDL-1.3.0-5605\VisualC\tests\testsprite2\Win32\Release\testsprite2.exe
4> The system cannot find the file specified.
4> The system cannot find the file specified.
4>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: The command “copy C:\Documents and Settings\Vern Jensen\Desktop\SDL-1.3\SDL-1.3.0-5605\VisualC\SDL\Win32\Release\SDL.dll C:\Documents and Settings\Vern Jensen\Desktop\SDL-1.3\SDL-1.3.0-5605\VisualC\tests\testsprite2\Win32\Release\SDL.dll
4>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: copy C:\Documents and Settings\Vern Jensen\Desktop\SDL-1.3\SDL-1.3.0-5605\VisualC\…\test\icon.bmp C:\Documents and Settings\Vern Jensen\Desktop\SDL-1.3\SDL-1.3.0-5605\VisualC\tests\testsprite2\icon.bmp
4>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: :VCEnd” exited with code 1.
5>------ Build started: Project: testsprite, Configuration: Release Win32 ------
5> testsprite_VS2010.vcxproj -> C:\Documents and Settings\Vern Jensen\Desktop\SDL-1.3\SDL-1.3.0-5605\VisualC\tests\testsprite\Win32\Release\testsprite.exe
5> The system cannot find the file specified.
5> The system cannot find the file specified.
5>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: The command “copy C:\Documents and Settings\Vern Jensen\Desktop\SDL-1.3\SDL-1.3.0-5605\VisualC\SDL\Win32\Release\SDL.dll C:\Documents and Settings\Vern Jensen\Desktop\SDL-1.3\SDL-1.3.0-5605\VisualC\tests\testsprite\Win32\Release\SDL.dll
5>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: copy C:\Documents and Settings\Vern Jensen\Desktop\SDL-1.3\SDL-1.3.0-5605\VisualC\…\test\icon.bmp C:\Documents and Settings\Vern Jensen\Desktop\SDL-1.3\SDL-1.3.0-5605\VisualC\tests\testsprite\icon.bmp
5>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(113,5): error MSB3073: :VCEnd” exited with code 1.

There is similar output for the rest of the test projects. Is this just a matter of needing to add another path to the search paths for “library” as per your instructions above? I’m just not sure why it can’t find the files, when it’s looking for them in the right place, and they DO exist at that path.

Okay, so if I manully copy SDL.dll from:

C:\Documents and Settings\Vern Jensen\Desktop\SDL-1.3\SDL-1.3.0-5605\VisualC\SDL\Win32\Release

to:

C:\Documents and Settings\Vern Jensen\Desktop\SDL-1.3\SDL-1.3.0-5605\VisualC\tests\testsprite\Win32\Release

then the testsprite program launches. So why does the compiler fail to perform this copy itself? As far as I can tell, the paths are the same, other than a double backslash in the compiler’s path between VisualC and SDL:

C:\Documents and Settings\Vern Jensen\Desktop\SDL-1.3\SDL-1.3.0-5605\VisualC\SDL\Win32\Release\SDL.dll

Would this double backslash cause the problem? If so, any ideas how/where I’d fix this?

Oh, and by “works” I mean it launches and I see the empty outline of the SDL window, but then it quits. So not really quite working yet… Not sure where to go from here until I can try debugging from within Visual Studio.

Hey Vern,

I do recall that on an earlier attempt to build from the command line (a couple of weeks ago, I think), I too saw similar post build event failures. I traced them to extraneous carriage returns i.e. \r being appended to the end of each command.

Due to limitations of VC++ Express, I got an error message:
Solution folders are not supported in this version of the application.
Solution folder ‘tests’ will be displayed as unavailable.
But the test projects were listed out individually, rather than under the tests folder, which I expect would be the case with Visual Studio 2010 Pro. Not sure if this bit is relevant.

All of the following were built from the command line using msbuild and they were all successful:

  1. the website zip snapshot archive dated Aug 05, 2011 - I expanded the archive using 7zip
  2. the website tar.gz snapshot archive dated Aug 05, 2011 - I expanded the archive using 7zip
  3. the latest hg revision
  4. revision “5941:e4e18a80be61” dated “Thu Sep 15 23:51:07 2011 -0400”
  5. revision “5933:5f8a7ebc88e5” dated “Wed Aug 03 06:22:33 2011 +0000” which was the last commit before the snapshot available on the website

At this point, I’m not sure where the extraneous \r are coming from, but I’m unable to repro at this time using the combinations above.

Couple of questions that may help figure out the specifics of your env that might be the cause:

  1. Are you building from the SDL v1.3 snapshot from the libsdl.org website or grabbing the sources from hg directly?
    1.1 If you’re using the website snapshot, are you using the zip or tar.gz file?
    1.2 If you’re using the website snapshot, what are you using to decompress the archive?
  2. Are you using VC++ Express or Visual Studio Pro?–
    Vijay Varadan
    Skype: vijayvaradan | USA: +1-206-849-3710 ©
    India: +1-425-956-3326 (VOIP) | India: +91-99400-13652 ©
    LinkedIn: http://linkd.in/qTORH7 | Blog: http://bit.ly/oQBwNl
    Google+: http://bit.ly/vijayplus | Facebook: http://on.fb.me/oF7dq9
    Twitter: http://bit.ly/qsiqrp
    Axham Corporation | Axham Technologies, LLP
    LinkedIn: http://linkd.in/nL9wNX | LinkedIn: http://linkd.in/odgEc9
    Website: http://axham.com | Facebook: http://on.fb.me/axhamgames
    Twitter: http://bit.ly/mPaDwB

Hi Vijay, to answer your questions:

I’m building from the website snapshot (not hg sources), the .zip version, not tar.gz.

To decompress the archive, I used “Extract All…” by right-clicking in Windows XP on the archive.

I’m usig VC++ Express (not Pro).

I too get the “Solution folders are not supported in this version of the application.” error message you mention when opening the VC 2010 SDL project.

I followed what you outlined below and my build went fine. So, at this point, I’m unable to repro what you’ve run into now (which I ran into earlier as well).

At this point, I can’t think of anything else and can only suggest re-downloading the archive and starting from a fresh slate to see if the problem goes away.

-VijayOn Mon, Oct 31, 2011 at 03:21:16PM -0700, VernJensen wrote:

Hi Vijay, to answer your questions:

I’m building from the website snapshot (not hg sources), the .zip version, not tar.gz.

To decompress the archive, I used “Extract All…” by right-clicking in Windows XP on the archive.

I’m usig VC++ Express (not Pro).

I too get the “Solution folders are not supported in this version of the application.” error message you mention when opening the VC 2010 SDL project.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Okay, well, it’s not a big deal. I simply deleted the “Build step” that copied the .dll, having manually copied it instead, and it runs fine now.