Trying to use SDL 2 with Visual Studio c++ -
i trying 1 requires use sdl2 , excited start attempting write program. downloaded sdl2 , didn't have problems.
next opened new empty project followed instructions add include folder, lib(x86) folder, , added sdl2.lib , sdl2main.lib linker.
when tried build project received following error.
1>msvcrtd.lib(cinitexe.obj) : warning lnk4098: defaultlib 'msvcrt.lib' conflicts use of other libs; use /nodefaultlib:library 1>sdl2main.lib(sdl_windows_main.obj) : error lnk2019: unresolved external
symbol _sdl_main referenced in function _main 1>c:\users\nas\documents\visual studio 2013\projects\basic sdl\debug\basic sdl.exe : fatal error lnk1120: 1 unresolved externals
you need link library files.
- right click project ,
properties
- click
vc++ directories
. - click
include directories
,down arrow
,<edit>
. - then add directory of include files (where .h files are, example
e:\visual studio .net\sdl2-2.0.3\include
). - then same library files clicking
library directories',
down arrow,
edit. however, want make sure targeting x86 (for 32 bit program example
e:\visual studio .net\sdl2-2.0.3\lib\x86`) or x64 (64bit program, not common) - then expand
linker
, clickinput
on left hand side. - click additional dependencies, , edit , add
sdl2.lib
,sdl2main.lib
. - click
system
underlinker
heading. - change subsystem
/subsystem:console
. - finally make sure
sdl.dll
file in folder of project debug folder.
Comments
Post a Comment