We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3114

Summary: SDL's Visual C++ 2010+ projects fail to build, when included in a custom VS Solution (.sln)
Product: SDL Reporter: David Ludwig <dll>
Component: buildAssignee: David Ludwig <dll>
Status: RESOLVED FIXED QA Contact: David Ludwig <dll>
Severity: normal    
Priority: P2    
Version: HG 2.0   
Hardware: x86   
OS: Windows (All)   
Attachments: Patch for proposed fix - use $(ProjectDir), rather than $(SolutionDir), to find SDL headers

Description David Ludwig 2015-09-07 17:23:09 UTC
SDL's own Visual C++ 2010+ projects will typically fail to build, if and when they are included via a custom, Visual Studio Solution file (.sln).  The errors generated are all due to SDL being unable to find its own header files.


Here is some sample build-output:

------ Build started: Project: SDL2, Configuration: Debug Win32 ------
  e_atan2.c
c:\users\davidl\documents\code\sdl\sdl\src\libm\../SDL_internal.h(34): fatal error C1083: Cannot open include file: 'SDL_config.h': No such file or directory
  e_log.c
c:\users\davidl\documents\code\sdl\sdl\src\libm\../SDL_internal.h(34): fatal error C1083: Cannot open include file: 'SDL_config.h': No such file or directory
  e_pow.c
c:\users\davidl\documents\code\sdl\sdl\src\libm\../SDL_internal.h(34): fatal error C1083: Cannot open include file: 'SDL_config.h': No such file or directory
  e_rem_pio2.c


... and so on ...

----------------------------------------


The build errors can be fixed by modifying SDL's own Visual C++ 2010+ project files, telling them to look for its header files in a directory relative to the MSVC project.  As of this writing, using the latest SDL code from hg.libsdl.org/SDL (which is at changeset 9858 / 6d6a972746b3 / http://hg.libsdl.org/SDL/rev/6d6a972746b3 ), has SDL looking for its header files relative to SDL's own VS .sln file.

This bug can make it tricky to build customized, or development versions of SDL, as part of another app.

A patch is forthcoming, one which simply changes SDL's primary .vcxproj files to use '$(ProjectDir)', rather than '$(SolutionDir)', in order to locate SDL's public headers.  This change should allow SDL to continue building via it's own .sln file (in VisualC/SDL.sln), as well as via external, custom .sln files.
Comment 1 David Ludwig 2015-09-07 17:28:54 UTC
Created attachment 2260 [details]
Patch for proposed fix - use $(ProjectDir), rather than $(SolutionDir), to find SDL headers
Comment 2 David Ludwig 2015-09-07 19:32:23 UTC
Fixed in SDL HG, via http://hg.libsdl.org/SDL/rev/2ec928ff921c