Building 'EmptyProject' 2.1: SDL2 for Visual Studio 2015

Problems building or running the engine, queries about how to use features etc.
Post Reply
joshcamas
Gnoblar
Posts: 7
Joined: Tue Jun 13, 2017 5:44 pm

Building 'EmptyProject' 2.1: SDL2 for Visual Studio 2015

Post by joshcamas »

Two days, still haven't been able to write a single line of code :( I'm dyin' here

Alright, so I'm trying to follow the instructions here: https://ogrecave.github.io/ogre/api/2.1 ... urApp.html

And it didn't work, since it couldn't find the SDL files SDL2Config.cmake or sdl2-config.cmake. I searched my system and could only find a sdl2-config.cmake.in file, which didn't work

So, I followed the advice of this link: https://brendanwhitfield.wordpress.com/ ... with-sdl2/ and grab https://github.com/brendan-w/collector/ ... SDL2.cmake and rename it to sdl2-config.cmake.

This seemed to work, until I tried building the EmptyProject build in Visual Studio 2015. It gave these errors:

Code: Select all

1>------ Build started: Project: EmptyProject, Configuration: Debug x64 ------
1>     Creating library D:/Projects/ogre/projects/EmptyProject/bin/Debug/EmptyProject.lib and object D:/Projects/ogre/projects/EmptyProject/bin/Debug/EmptyProject.exp
1>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
1>SDL2.lib(SDL_systimer.obj) : error LNK2019: unresolved external symbol __imp_timeGetTime referenced in function SDL_GetPerformanceCounter_REAL
1>SDL2.lib(SDL_systimer.obj) : error LNK2019: unresolved external symbol __imp_timeBeginPeriod referenced in function SDL_TimerResolutionChanged
1>SDL2.lib(SDL_systimer.obj) : error LNK2019: unresolved external symbol __imp_timeEndPeriod referenced in function SDL_TicksQuit
1>SDL2.lib(SDL_windowskeyboard.obj) : error LNK2019: unresolved external symbol GetFileVersionInfoSizeA referenced in function IME_GetId
1>SDL2.lib(SDL_windowskeyboard.obj) : error LNK2019: unresolved external symbol GetFileVersionInfoA referenced in function IME_GetId
1>SDL2.lib(SDL_windowskeyboard.obj) : error LNK2019: unresolved external symbol VerQueryValueA referenced in function IME_GetId
1>SDL2.lib(SDL_windowskeyboard.obj) : error LNK2019: unresolved external symbol ImmGetIMEFileNameA referenced in function IME_GetId
1>SDL2.lib(SDL_windowskeyboard.obj) : error LNK2019: unresolved external symbol ImmGetContext referenced in function IME_ClearComposition
1>SDL2.lib(SDL_windowskeyboard.obj) : error LNK2019: unresolved external symbol ImmReleaseContext referenced in function IME_ClearComposition
1>SDL2.lib(SDL_windowskeyboard.obj) : error LNK2019: unresolved external symbol ImmAssociateContext referenced in function IME_Disable
1>SDL2.lib(SDL_windowskeyboard.obj) : error LNK2019: unresolved external symbol ImmGetCompositionStringW referenced in function IME_GetCompositionString
1>SDL2.lib(SDL_windowskeyboard.obj) : error LNK2019: unresolved external symbol ImmSetCompositionStringW referenced in function IME_ClearComposition
1>SDL2.lib(SDL_windowskeyboard.obj) : error LNK2019: unresolved external symbol ImmGetCandidateListW referenced in function IME_GetCandidateList
1>SDL2.lib(SDL_windowskeyboard.obj) : error LNK2019: unresolved external symbol ImmNotifyIME referenced in function IME_ClearComposition
1>SDL2.lib(SDL_windowskeyboard.obj) : error LNK2019: unresolved external symbol ImmSetCompositionWindow referenced in function WIN_SetTextInputRect
1>SDL2.lib(SDL_winmm.obj) : error LNK2019: unresolved external symbol __imp_waveOutGetNumDevs referenced in function DetectWaveOutDevs
1>SDL2.lib(SDL_winmm.obj) : error LNK2019: unresolved external symbol __imp_waveOutGetDevCapsW referenced in function DetectWaveOutDevs
1>SDL2.lib(SDL_winmm.obj) : error LNK2019: unresolved external symbol __imp_waveOutGetErrorTextW referenced in function SetMMerror
1>SDL2.lib(SDL_winmm.obj) : error LNK2019: unresolved external symbol __imp_waveOutOpen referenced in function WINMM_OpenDevice
1>SDL2.lib(SDL_winmm.obj) : error LNK2019: unresolved external symbol __imp_waveOutClose referenced in function WINMM_CloseDevice
1>SDL2.lib(SDL_winmm.obj) : error LNK2019: unresolved external symbol __imp_waveOutPrepareHeader referenced in function WINMM_OpenDevice
1>SDL2.lib(SDL_winmm.obj) : error LNK2019: unresolved external symbol __imp_waveOutUnprepareHeader referenced in function WINMM_CloseDevice
1>SDL2.lib(SDL_winmm.obj) : error LNK2019: unresolved external symbol __imp_waveOutWrite referenced in function WINMM_PlayDevice
1>SDL2.lib(SDL_winmm.obj) : error LNK2019: unresolved external symbol __imp_waveInGetNumDevs referenced in function DetectWaveInDevs
1>SDL2.lib(SDL_winmm.obj) : error LNK2019: unresolved external symbol __imp_waveInGetDevCapsW referenced in function DetectWaveInDevs
1>SDL2.lib(SDL_winmm.obj) : error LNK2019: unresolved external symbol __imp_waveInOpen referenced in function WINMM_OpenDevice
1>SDL2.lib(SDL_winmm.obj) : error LNK2019: unresolved external symbol __imp_waveInClose referenced in function WINMM_CloseDevice
1>D:\Projects\ogre\projects\EmptyProject\bin\Debug\EmptyProject.exe : fatal error LNK1120: 27 unresolved externals
2>------ Skipped Build: Project: ALL_BUILD, Configuration: Debug x64 ------
2>Project not selected to build for this solution configuration 
========== Build: 0 succeeded, 1 failed, 1 up-to-date, 1 skipped ==========
Apparently, this is because SDL wasn't built in the same Visual Studio, which is strange cause... it was, right? I built the source.

I'm honestly going insane, I just wanna build a demo :(

Any ideas how to fix this? Thanks
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5299
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1280
Contact:

Re: Building 'EmptyProject' 2.1: SDL2 for Visual Studio 2015

Post by dark_sylinc »

Is there a folder and two files called...?

Code: Select all

Dependencies/Ogre/include/SDL2
Dependencies/Ogre/Dependencies/lib/SDL2.lib
Dependencies/Ogre/Dependencies/lib/SDL2main.lib
User avatar
daikane
Gnoblar
Posts: 9
Joined: Tue Oct 11, 2005 4:37 am
Location: Oulu, FI
Contact:

Re: Building 'EmptyProject' 2.1: SDL2 for Visual Studio 2015

Post by daikane »

dark_sylinc wrote:Is there a folder and two files called...?

Code: Select all

Dependencies/Ogre/include/SDL2
Dependencies/Ogre/Dependencies/lib/SDL2.lib
Dependencies/Ogre/Dependencies/lib/SDL2main.lib
Hmm, following the https://ogrecave.github.io/ogre/api/2.1 ... ndows.html generates as per:

Image

...but pointing (EmptyProject's) SDL2_DIR to any of those (tried them all, to no avail) results in SDL2 not found error.
/// Dai Kane
User avatar
daikane
Gnoblar
Posts: 9
Joined: Tue Oct 11, 2005 4:37 am
Location: Oulu, FI
Contact:

Re: Building 'EmptyProject' 2.1: SDL2 for Visual Studio 2015

Post by daikane »

joshcamas wrote: Apparently, this is because SDL wasn't built in the same Visual Studio, which is strange cause... it was, right? I built the source.

I'm honestly going insane, I just wanna build a demo :(

Any ideas how to fix this? Thanks
Got the same issue here, which I ended up "fixing" sort of... This by means isn't any universal solution to anything, but worked for me:

* Instead of using the VisualC dir's projects (which end up with the mess of errors in your post), use cmake(-gui) in SDL2's root as per i.e.:
** source dir: wherever you put SDL2's stuff
** build dir: as above, plus "/build" at end of the path
* compile away (in release mode)
* copy the SDL2.dll to your projects debug/release dirs
* Hardcode the .lib and sdl2 include dirs into your project's OGRE.cmake (where it looks for SDL2)... (I didn't get FindSDL2.cmake to work as intended, so hardcoding the paths I went).
* compile your stuff, and run

...that's about it - unless I forgot something, hmm.
Last edited by daikane on Wed Jun 21, 2017 9:20 am, edited 1 time in total.
/// Dai Kane
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5299
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1280
Contact:

Re: Building 'EmptyProject' 2.1: SDL2 for Visual Studio 2015

Post by dark_sylinc »

I see what your problem is. Thanks for posting that pic (btw. I did not know about the 'where' command. It's very useful!)

C:\Ogre\Dependencies should point to what currently your C:\Ogre\Dependencies\build\ogredeps folder contains (personally I just store Dependencies repo somewhere, and then use mklink /D Depepndencies pathToDeps/build/ogredeps with admin privileges).
User avatar
daikane
Gnoblar
Posts: 9
Joined: Tue Oct 11, 2005 4:37 am
Location: Oulu, FI
Contact:

Re: Building 'EmptyProject' 2.1: SDL2 for Visual Studio 2015

Post by daikane »

dark_sylinc wrote:C:\Ogre\Dependencies should point to what currently your C:\Ogre\Dependencies\build\ogredeps folder contains (personally I just store Dependencies repo somewhere, and then use mklink /D Depepndencies pathToDeps/build/ogredeps with admin privileges).
:D ...that made my life a lot easier...
/// Dai Kane
Post Reply