zelda3 icon indicating copy to clipboard operation
zelda3 copied to clipboard

Can't find SDL.h on windows

Open Manurocker95 opened this issue 2 years ago • 10 comments

Just following the python extraction (and install), makes it impossible to compile as SDL library is missing

Manurocker95 avatar Aug 23 '22 21:08 Manurocker95

Have the same issue, but i also have added the sdl include folder.

nitrostemp avatar Aug 23 '22 21:08 nitrostemp

Have the same issue, but i also have added the sdl include folder.

The linker also has a dependency of D:\Lib\SDL2-2.0.20\lib\x64\SDL2main.lib and D:\Lib\SDL2-2.0.20\lib\x64\SDL2.lib. After fixing those paths and running again VS, I face this:

image

Manurocker95 avatar Aug 23 '22 22:08 Manurocker95

That didn't fix the issue, as compiling for x86 makes the application to run. There's something wrong with x64 :/

Edit: Linking the DLL instead worked for me.

Manurocker95 avatar Aug 23 '22 22:08 Manurocker95

Got the same error, x86, x64, debug, release build. Nothing seems to work

Severity Code Description Project File Line Suppression State Error C1083 Cannot open include file: 'SDL.h': No such file or directory zelda3 C:\Users\davis\source\repos\zelda3\main.cpp 8

EDIT: I fixed by checking the properties of the project, it has the SDL library on D: directory lol so i placed my files there :v and it worked!

homebrewGT avatar Aug 25 '22 02:08 homebrewGT

Which version of SDL should I install? I used SDL by Sam Lantinga 1.2.15.16 and I'm not longer getting the Can't find SDL.h error, but now I'm getting 16 new errors in the vein of 'device': undeclared identifier all in the file spc_player.cpp

ReticentRobot avatar Aug 25 '22 16:08 ReticentRobot

To get this to build (in Visual Studio) and run I did the following:

  1. Make sure you have the "Desktop development with C++" workload installed for Visual Studio (in the "Visual Studio Installer")
  2. Download / Extract latest SDL2-devel (SDL2-devel-2.24.0-VC.zip) - from https://github.com/libsdl-org/SDL/releases
  3. Open Zelda3 SLN in Visual Studio
  4. Go to "Project Properties" (right click "zelda3" in Solution Explorer and select "Properties")
  5. In Configuration Properties > C / C++ > General: Updated Additional Include Directories path to point to the extracted SDL files "include" directory
  6. In Configuration Properties > Linker > Input: Change Additional Dependencies path to point to: lib\x64\SDL2.lib and lib\x64\SDL2main.lib
  7. Build solution
  8. Copy lib\x64\SDL2.dll to output directory (x64\Release or x64\Debug)
  9. Run Zelda3.exe
  10. Rejoice!

Screenshots:

image

image

image

image

aplocher avatar Aug 25 '22 17:08 aplocher

I downloaded SDL2-devel-2.24.0-VC.zip from that project, but I seem to be missing some files in the zip? Like I don't see a .sln file in it at all:

image

EDIT: Oh wait, I missed your edit on step 3 :) Thank you!!

ReticentRobot avatar Aug 25 '22 18:08 ReticentRobot

@ReticentRobot the SLN file I referenced is for the Zelda3 project (I updated my post).

A better option might be to use kageurufu's fork of this project. He fixed all the SDL dependencies to use Nuget. Using his branch might be a better option since it doesn't require any setup of SDL and it "just works" (he has an open PR which will hopefully get merged into this repo).

git clone https://github.com/kageurufu/zelda3 cd zelda3 git checkout sdl_from_nuget

Then extract/compile rom stuff in the tables directory.

Open in VS, build, and run .exe

aplocher avatar Aug 25 '22 18:08 aplocher

Perfect! Thank you so much, that way went way smoother. Success!!

ReticentRobot avatar Aug 25 '22 18:08 ReticentRobot

I tried doing this and am getting below errors:

Severity Code Description Project File Line Suppression State Error NuGet Package restore failed for project zelda3: Unable to find version '2.0.5' of package 'sdl2'. C:\Program Files (x86)\Microsoft SDKs\NuGetPackages: Package 'sdl2.2.0.5' is not found on source 'C:\Program Files (x86)\Microsoft SDKs\NuGetPackages'. . Please see Error List window for detailed warnings and errors.

Severity Code Description Project File Line Suppression State Error NuGet Package restore failed for project zelda3: Unable to find version '2.0.5' of package 'sdl2.redist'. C:\Program Files (x86)\Microsoft SDKs\NuGetPackages: Package 'sdl2.redist.2.0.5' is not found on source 'C:\Program Files (x86)\Microsoft SDKs\NuGetPackages'. . Please see Error List window for detailed warnings and errors.

Severity Code Description Project File Line Suppression State Error This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is packages\sdl2.redist.2.0.5\build\native\sdl2.redist.targets. zelda3 C:\Users\rdmci\Desktop\zelda3\zelda3\zelda3.vcxproj 249

rdmcintee avatar Aug 25 '22 21:08 rdmcintee

@rdmcintee Looks like you need to manually restore NuGet packages for the project (see the error in the last paragraph). https://docs.microsoft.com/en-us/nuget/consume-packages/package-restore#restore-packages-manually-using-visual-studio

keatongreve avatar Aug 30 '22 18:08 keatongreve

@ReticentRobot the SLN file I referenced is for the Zelda3 project (I updated my post).

A better option might be to use kageurufu's fork of this project. He fixed all the SDL dependencies to use Nuget. Using his branch might be a better option since it doesn't require any setup of SDL and it "just works" (he has an open PR which will hopefully get merged into this repo).

git clone https://github.com/kageurufu/zelda3 cd zelda3 git checkout sdl_from_nuget

Then extract/compile rom stuff in the tables directory.

Open in VS, build, and run .exe

This worked much better for me. No SDL setup is needed. Visual Studio does everything for you when you build the project/solution. Thanks!

njs-guy avatar Aug 31 '22 00:08 njs-guy

NuGet is used now.

snesrev avatar Aug 31 '22 01:08 snesrev