c++ - Adding SDL 1.2.15 Framework on XCODE 7: 2 times class main gives error at compilation -
this problem has been asked after extensive search on google i've found no questions related 1.2.15 version of sdl last version of xcode please allow me post problem (again) , solution i've found up-to-date version (30th september 2015).
config:
osx 10.10.5 xcode 7.0 sdl 1.2.15
how reproduce:
copied sdl.framework /library/frameworks explained on readme.txt
on xcode template > building settings > framework search path /library/frameworks
i included sdl framework on main.cpp file follows:
#include <sdl/sdl.h>
when try compile , test error because of double declaration of class main...
this error message:
undefined symbols architecture x86_64: "_main", referenced from: implicit entry/start main executable (maybe meant: _sdl_main)
this how solved it:
i checked , saw sdl.h including following files:
#include "sdl_main.h" #include "sdl_stdinc.h" #include "sdl_audio.h" #include "sdl_cdrom.h" #include "sdl_cpuinfo.h" #include "sdl_endian.h" #include "sdl_error.h" #include "sdl_events.h" #include "sdl_loadso.h" #include "sdl_mutex.h" #include "sdl_rwops.h" #include "sdl_thread.h" #include "sdl_timer.h" #include "sdl_video.h" #include "sdl_version.h" #include "begin_code.h"
one of them sdl_main.h , on file see:
#define main sdl_main
this line producing conflict class main on main.cpp, commenting line on sdl_main.h or commenting line #include "sdl_main.h" on sdl.h solves issue. i'm noob on c++ (i learn @ university many years ago) other languages know "hacking" library bad practice... though seems particular compatibility problem maxosx , want use xcode...
please correct , comment, justify yes or no, i'm on learning process.
cheers!
i've resolved problem #undef main before declaration of main function.
Comments
Post a Comment