zelda3
zelda3 copied to clipboard
Can't find SDL.h on windows
Just following the python extraction (and install), makes it impossible to compile as SDL library is missing
Have the same issue, but i also have added the sdl include folder.
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:
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.
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!
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
To get this to build (in Visual Studio) and run I did the following:
- Make sure you have the "Desktop development with C++" workload installed for Visual Studio (in the "Visual Studio Installer")
- Download / Extract latest SDL2-devel (SDL2-devel-2.24.0-VC.zip) - from https://github.com/libsdl-org/SDL/releases
- Open Zelda3 SLN in Visual Studio
- Go to "Project Properties" (right click "zelda3" in Solution Explorer and select "Properties")
- In Configuration Properties > C / C++ > General: Updated Additional Include Directories path to point to the extracted SDL files "include" directory
- In Configuration Properties > Linker > Input: Change Additional Dependencies path to point to:
lib\x64\SDL2.lib
andlib\x64\SDL2main.lib
- Build solution
- Copy
lib\x64\SDL2.dll
to output directory (x64\Release
orx64\Debug
) - Run Zelda3.exe
- Rejoice!
Screenshots:
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:
EDIT: Oh wait, I missed your edit on step 3 :) Thank you!!
@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
Perfect! Thank you so much, that way went way smoother. Success!!
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 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
@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!
NuGet is used now.