Hi and first thanks for reading this and giving me a bit of your time !:)
So I try to do a simple hello world with SDL 2.0.3 and VisualStudio 2012.
#include <SDL.h>
#include <iostream>
int main(int argc, char **argv)
{
SDL_Window* fenetre(0);
SDL_Event evenements;
bool terminer(false);
if(SDL_Init(SDL_INIT_VIDEO) < 0)
{
std::cout << "Erreur lors de l'initialisation de la SDL : " << SDL_GetError() << std::endl;
SDL_Quit();
return -1;
}
fenetre = SDL_CreateWindow("Test SDL 2.0", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 800, 600, SDL_WINDOW_SHOWN);
if(fenetre == 0)
{
std::cout << "Erreur lors de la creation de la fenetre : " << SDL_GetError() << std::endl;
SDL_Quit();
return -1;
}
while(!terminer)
{
SDL_WaitEvent(&evenements);
if(evenements.window.event == SDL_WINDOWEVENT_CLOSE)
terminer = true;
}
SDL_DestroyWindow(fenetre);
SDL_Quit();
return 0;
}
I have already installed SDL before, I've set additional lib and include folder, I also added addition dependency (SDL2.lib;SDL2main.lib). So I guess the problem is the linking because I get those errors when building
Quote:
Erreur 1 error LNK2001: symbole externe non résolu __purecall c:\Users\holder\documents\visual studio 2012\Projects\SDL1\main.obj SDL1
Erreur 2 error LNK2019: symbole externe non résolu "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z) référencé dans la fonction "char * __cdecl std::_Allocate<char>(unsigned int,char *)" (??$_Allocate@D@std@@YAPADIPAD@Z) c:\Users\holder\documents\visual studio 2012\Projects\SDL1\main.obj SDL1
Erreur 3 error LNK2019: symbole externe non résolu "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) référencé dans la fonction "public: virtual void * __thiscall std::_Generic_error_category::`scalar deleting destructor'(unsigned int)" (??_G_Generic_error_category@std@@UAEPAXI@Z) c:\Users\holder\documents\visual studio 2012\Projects\SDL1\main.obj SDL1
Erreur 4 error LNK2019: symbole externe non résolu _atexit référencé dans la fonction "void __cdecl `dynamic initializer for 'public: static class std::_Generic_error_category std::_Error_objects<int>::_Generic_object''(void)" (??__E?_Generic_object@?$_Error_objects@H@std@@2V_Generic_error_category@2@A@@YAXXZ) c:\Users\holder\documents\visual studio 2012\Projects\SDL1\main.obj SDL1
Erreur 5 error LNK2019: symbole externe non résolu _memcpy référencé dans la fonction "public: static char * __cdecl std::char_traits<char>::copy(char *,char const *,unsigned int)" (?copy@?$char_traits@D@std@@SAPADPADPBDI@Z) c:\Users\holder\documents\visual studio 2012\Projects\SDL1\main.obj SDL1
Erreur 6 error LNK2019: symbole externe non résolu _strlen référencé dans la fonction "public: static unsigned int __cdecl std::char_traits<char>::length(char const *)" (?length@?$char_traits@D@std@@SAIPBD@Z) c:\Users\holder\documents\visual studio 2012\Projects\SDL1\main.obj SDL1
Erreur 7 error LNK2019: symbole externe non résolu __imp__memmove référencé dans la fonction "public: static char * __cdecl std::char_traits<char>::move(char *,char const *,unsigned int)" (?move@?$char_traits@D@std@@SAPADPADPBDI@Z) c:\Users\holder\documents\visual studio 2012\Projects\SDL1\main.obj SDL1
Erreur 8 error LNK2019: symbole externe non résolu "__declspec(dllimport) void __cdecl std::_Debug_message(wchar_t const *,wchar_t const *,unsigned int)" (__imp_?_Debug_message@std@@YAXPB_W0I@Z) référencé dans la fonction "void __cdecl std::_Debug_pointer<char>(char const *,wchar_t const *,unsigned int)" (??$_Debug_pointer@D@std@@YAXPBDPB_WI@Z) c:\Users\holder\documents\visual studio 2012\Projects\SDL1\main.obj SDL1
Erreur 9 error LNK2019: symbole externe non résolu "__declspec(dllimport) public: __thiscall std::_Container_base12::_Container_base12(void)" (__imp_??0_Container_base12@std@@QAE@XZ) référencé dans la fonction "public: __thiscall std::_String_val<struct> >::_String_val<struct> >(void)" (??0?$_String_val@U?$_Simple_types@D@std@@@std@@QAE@XZ) c:\Users\holder\documents\visual studio 2012\Projects\SDL1\main.obj SDL1
Erreur 10 error LNK2019: symbole externe non résolu "__declspec(dllimport) public: __thiscall std::_Container_base12::~_Container_base12(void)" (__imp_??1_Container_base12@std@@QAE@XZ) référencé dans la fonction "public: __thiscall std::_String_val<struct> >::~_String_val<struct> >(void)" (??1?$_String_val@U?$_Simple_types@D@std@@@std@@QAE@XZ) c:\Users\holder\documents\visual studio 2012\Projects\SDL1\main.obj SDL1
Erreur 11 error LNK2019: symbole externe non résolu "__declspec(dllimport) public: void __thiscall std::_Container_base12::_Orphan_all(void)" (__imp_?_Orphan_all@_Container_base12@std@@QAEXXZ) référencé dans la fonction "public: void __thiscall std::_String_alloc<0,struct std::_String_base_types<char,class> > >::_Free_proxy(void)" (?_Free_proxy@?$_String_alloc@$0A@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEXXZ) c:\Users\holder\documents\visual studio 2012\Projects\SDL1\main.obj SDL1
Erreur 12 error LNK2019: symbole externe non résolu "__declspec(dllimport) void __cdecl std::_Xbad_alloc(void)" (__imp_?_Xbad_alloc@std@@YAXXZ) référencé dans la fonction "char * __cdecl std::_Allocate<char>(unsigned int,char *)" (??$_Allocate@D@std@@YAPADIPAD@Z) c:\Users\holder\documents\visual studio 2012\Projects\SDL1\main.obj SDL1
Erreur 13 error LNK2019: symbole externe non résolu "__declspec(dllimport) void __cdecl std::_Xlength_error(char const *)" (__imp_?_Xlength_error@std@@YAXPBD@Z) référencé dans la fonction "public: void __thiscall std::basic_string<char,struct>,class std::allocator<char> >::_Xlen(void)const " (?_Xlen@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEXXZ) c:\Users\holder\documents\visual studio 2012\Projects\SDL1\main.obj SDL1
Erreur 14 error LNK2019: symbole externe non résolu "__declspec(dllimport) void __cdecl std::_Xout_of_range(char const *)" (__imp_?_Xout_of_range@std@@YAXPBD@Z) référencé dans la fonction "public: void __thiscall std::basic_string<char,struct>,class std::allocator<char> >::_Xran(void)const " (?_Xran@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEXXZ) c:\Users\holder\documents\visual studio 2012\Projects\SDL1\main.obj SDL1
Erreur 15 error LNK2019: symbole externe non résolu "__declspec(dllimport) char const * __cdecl std::_Syserror_map(int)" (__imp_?_Syserror_map@std@@YAPBDH@Z) référencé dans la fonction "public: virtual class std::error_condition __thiscall std::_System_error_category::default_error_condition(int)const " (?default_error_condition@_System_error_category@std@@UBE?AVerror_condition@2@H@Z) c:\Users\holder\documents\visual studio 2012\Projects\SDL1\main.obj SDL1
Erreur 16 error LNK2019: symbole externe non résolu "__declspec(dllimport) char const * __cdecl std::_Winerror_map(int)" (__imp_?_Winerror_map@std@@YAPBDH@Z) référencé dans la fonction "public: virtual class std::basic_string<char,struct>,class std::allocator<char> > __thiscall std::_System_error_category::message(int)const " (?message@_System_error_category@std@@UBE?AV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@2@H@Z) c:\Users\holder\documents\visual studio 2012\Projects\SDL1\main.obj SDL1
Erreur 17 error LNK2019: symbole externe non résolu @_RTC_CheckStackVars@8 référencé dans la fonction "public: void __thiscall std::_String_alloc<0,struct std::_String_base_types<char,class> > >::_Alloc_proxy(void)" (?_Alloc_proxy@?$_String_alloc@$0A@U?$_String_base_types@DV?$allocator@D@std@@@std@@@std@@QAEXXZ) c:\Users\holder\documents\visual studio 2012\Projects\SDL1\main.obj SDL1
Erreur 18 error LNK2019: symbole externe non résolu @__security_check_cookie@4 référencé dans la fonction __unwindfunclet$??$construct@PADAAPAD@?$allocator@D@std@@QAEXPAPADAAPAD@Z$0 c:\Users\holder\documents\visual studio 2012\Projects\SDL1\main.obj SDL1
Erreur 19 error LNK2019: symbole externe non résolu __CxxThrowException@8 référencé dans la fonction __catch$?_Copy@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEXII@Z$1 c:\Users\holder\documents\visual studio 2012\Projects\SDL1\main.obj SDL1
Erreur 20 error LNK2019: symbole externe non résolu __RTC_CheckEsp référencé dans la fonction "char * __cdecl std::_Allocate<char>(unsigned int,char *)" (??$_Allocate@D@std@@YAPADIPAD@Z) c:\Users\holder\documents\visual studio 2012\Projects\SDL1\main.obj SDL1
Erreur 21 error LNK2001: symbole externe non résolu __RTC_InitBase c:\Users\holder\documents\visual studio 2012\Projects\SDL1\main.obj SDL1
Erreur 22 error LNK2001: symbole externe non résolu __RTC_Shutdown c:\Users\holder\documents\visual studio 2012\Projects\SDL1\main.obj SDL1
Erreur 23 error LNK2019: symbole externe non résolu ___CxxFrameHandler3 référencé dans la fonction __unwindfunclet$??$construct@PADAAPAD@?$allocator@D@std@@QAEXPAPADAAPAD@Z$0 c:\Users\holder\documents\visual studio 2012\Projects\SDL1\main.obj SDL1
Erreur 24 error LNK2001: symbole externe non résolu "const type_info::`vftable'" (??_7type_info@@6B@) c:\Users\holder\documents\visual studio 2012\Projects\SDL1\main.obj SDL1
Erreur 25 error LNK2019: symbole externe non résolu ___security_cookie référencé dans la fonction "public: void __thiscall std::allocator<char>::construct<char>(char * *,char * &)" (??$construct@PADAAPAD@?$allocator@D@std@@QAEXPAPADAAPAD@Z) c:\Users\holder\documents\visual studio 2012\Projects\SDL1\main.obj SDL1
Erreur 26 error LNK2001: symbole externe non résolu _mainCRTStartup c:\Users\holder\documents\visual studio 2012\Projects\SDL1\LINK SDL1
Erreur 27 error LNK1120: 26 externes non résolus c:\users\holder\documents\visual studio 2012\Projects\SDL1\Debug\SDL1.exe SDL1
Quote:
I can run this simple sdl code
#include "SDL.h"
#include <stdio.h>
int main(int argc, char* argv[]) {
SDL_Window *window;
SDL_Init(SDL_INIT_VIDEO);
window = SDL_CreateWindow(
"An SDL2 window",
SDL_WINDOWPOS_UNDEFINED,
SDL_WINDOWPOS_UNDEFINED,
640,
480,
SDL_WINDOW_OPENGL
);
if (window == NULL) {
printf("Could not create window: %s\n", SDL_GetError());
return 1;
}
SDL_Delay(3000);
SDL_DestroyWindow(window);
SDL_Quit();
return 0;
}
I only got a warning Quote:
Avertissement 1 warning LNK4098: conflit entre la bibliothèque par défaut 'msvcrt.lib' et les autres bibliothèques ; utilisez /NODEFAULTLIB:library c:\Users\holder\documents\visual studio 2012\Projects\SDL1\MSVCRTD.lib(cinitexe.obj) SDL1
I've tried to use the /NODEFAULTLIB but if I do that I got the same errors as before.
Here is my building command line
Quote:
/OUT:"c:\users\holder\documents\visual studio 2012\Projects\SDL1\Debug\SDL1.exe" /MANIFEST /NXCOMPAT /PDB:"c:\users\holder\documents\visual studio 2012\Projects\SDL1\Debug\SDL1.pdb" /DYNAMICBASE "SDL2.lib" "SDL2main.lib" "glew32.lib" /DEBUG /MACHINE:X86 /INCREMENTAL /PGD:"c:\users\holder\documents\visual studio 2012\Projects\SDL1\Debug\SDL1.pgd" /SUBSYSTEM:CONSOLE /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /ManifestFile:"Debug\SDL1.exe.intermediate.manifest" /ERRORREPORT:PROMPT /NOLOGO /VERBOSE /LIBPATH:"C:\Users\holder\Work\DustPlanet\glew-1.11.0\lib\Release\Win32" /LIBPATH:"C:\Users\holder\Work\DustPlanet\SDL2-2.0.3\lib\x86" /TLBID:1
Moreover I need to use glew, I got the same kind of erros when I try adding gluw.
Some pictures of mt configuration:
http://i.imgur.com/JqbROVN.png
http://i.imgur.com/LkQvzno.png
http://i.imgur.com/DYe4vJ2.png
http://i.imgur.com/Rykqq5x.png