hxsdl
hxsdl copied to clipboard
working with cpp on mac?
im having troubles getting this working with heaps on mac.
building to html works fine. but once it comes to cpp it does spit out trouble.
i have the setup of putting glext.h inside the SDL2 [sdk download] include folder. but am getting nothing. still more errors
Error: In file included from ./src/sdl/Sdl.cpp:10:
In file included from include/sdl/Sdl.h:10:
/usr/local/lib/haxelib/hxsdl/git/SDLSupport.h:11:10: fatal error: 'GL/GLU.h' file not found
#include <GL/GLU.h>
just help with hopefully some screenshots would be great ;)
I don't have an OSX to test on here, but I've commit a fix, tell me how it works
My bad, try again
hmmmm. this is the output
Error: ./src/sdl/Sdl.cpp:62:2: error: use of undeclared identifier 'timeBeginPeriod'
timeBeginPeriod(1);
^
./src/sdl/Sdl.cpp:213:2: error: use of undeclared identifier 'timeEndPeriod'
timeEndPeriod(1);
^
2 errors generated.
Error: ./src/sdl/GL.cpp:63:14: error: use of undeclared identifier 'GLLoadAPI'
bool tmp = (GLLoadAPI() == (int)0); HX_STACK_VAR(tmp,"tmp");
^
./src/sdl/GL.cpp:852:64: warning: cast to 'void *' from smaller integer type 'int' [-Wint-to-void-pointer-cast]
glVertexAttribPointer(index, size, type, normalized, stride, VOIDPTR(position));
^
/usr/local/lib/haxelib/hxsdl/git/SDLSupport.h:28:21: note: expanded from macro 'VOIDPTR'
#define VOIDPTR(v) ((void*)(v))
^
./src/sdl/GL.cpp:919:37: warning: cast to 'void *' from smaller integer type 'int' [-Wint-to-void-pointer-cast]
glDrawElements(mode, count, type, VOIDPTR(start));
^
/usr/local/lib/haxelib/hxsdl/git/SDLSupport.h:28:21: note: expanded from macro 'VOIDPTR'
#define VOIDPTR(v) ((void*)(v))
^
2 warnings and 1 error generated.
Error: Build failed
also this is what my hxsdl looks like. just to make it easier ;)
also where the glext is, which is inside the SDL2 folder
One more try? :)
ha. it built quite a bit more this time. but then came up with some other errors
here is the last portion which has the errors
lib/x86/SDL2.lib opengl32.lib winmm.lib
clang: error: no such file or directory: '/usr/local/lib/haxelib/hxsdl/git/SDL2/lib/x86/SDL2.lib'
clang: error: no such file or directory: 'opengl32.lib'
clang: error: no such file or directory: 'winmm.lib'
Error: error running g++ -o Main -stdlib=libstdc++ -framework Cocoa -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -m64 @/Users/lepton/Developer/Heaps/GAMES/MIORA/bin/obj/darwin64/all_objs /usr/local/lib/haxelib/hxsdl/git/SDL2/lib/x86/SDL2.lib opengl32.lib winmm.lib
Error: Build failed
[Finished in 76.1s with exit code 1]
this is the first part which has some warnings
-o/Users/lepton/Developer/Heaps/GAMES/MIORA/bin/obj/darwin64/5a0e3030_NativeWrapper.o
./src/sdl/GL.cpp:856:64: warning: cast to 'void *' from smaller integer type 'int' [-Wint-to-void-pointer-cast]
glVertexAttribPointer(index, size, type, normalized, stride, VOIDPTR(position));
^
/usr/local/lib/haxelib/hxsdl/git/SDLSupport.h:30:21: note: expanded from macro 'VOIDPTR'
#define VOIDPTR(v) ((void*)(v))
^
./src/sdl/GL.cpp:923:37: warning: cast to 'void *' from smaller integer type 'int' [-Wint-to-void-pointer-cast]
glDrawElements(mode, count, type, VOIDPTR(start));
^
/usr/local/lib/haxelib/hxsdl/git/SDLSupport.h:30:21: note: expanded from macro 'VOIDPTR'
#define VOIDPTR(v) ((void*)(v))
^
2 warnings generated.
on more try :)
little bit better here is the output
@/Users/lepton/Developer/Heaps/GAMES/MIORA/bin/obj/darwin64/all_objs
Undefined symbols for architecture x86_64:
"_SDL_CreateWindow", referenced from:
sdl::Window_obj::__construct(String, int, int) in 5a0e3030_Window.o
"_SDL_GL_CreateContext", referenced from:
sdl::Window_obj::__construct(String, int, int) in 5a0e3030_Window.o
"_SDL_GL_SetAttribute", referenced from:
sdl::Window_obj::__construct(String, int, int) in 5a0e3030_Window.o
"_SDL_GL_SetSwapInterval", referenced from:
sdl::Window_obj::set_vsync(bool) in 5a0e3030_Window.o
"_SDL_GL_SwapWindow", referenced from:
sdl::Window_obj::present() in 5a0e3030_Window.o
"_SDL_GetWindowSize", referenced from:
sdl::Window_obj::get_width() in 5a0e3030_Window.o
sdl::Window_obj::get_height() in 5a0e3030_Window.o
"_SDL_Init", referenced from:
sdl::Sdl_obj::init() in 5a0e3030_Sdl.o
sdl::__Sdl_objinit() in 5a0e3030_Sdl.o
"_SDL_PollEvent", referenced from:
sdl::Sdl_obj::loop(Dynamic, Dynamic) in 5a0e3030_Sdl.o
"_SDL_Quit", referenced from:
sdl::Sdl_obj::quit() in 5a0e3030_Sdl.o
sdl::__Sdl_objquit() in 5a0e3030_Sdl.o
"_SDL_SetWindowFullscreen", referenced from:
sdl::Window_obj::set_fullScreen(bool) in 5a0e3030_Window.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Error: error running g++ -o Main -stdlib=libstdc++ -framework Cocoa -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -m64 -framework OpenGL @/Users/lepton/Developer/Heaps/GAMES/MIORA/bin/obj/darwin64/all_objs
Error: Build failed
Right, SDL linking is missing, could you try again?
just tried and it seemed to have. but said about SDL missing
ld: framework not found SDL2
though am sure i have installed it in hxsdl. plus do have it in my local frameworks folder
the pictures i posted before show the layout of the hxsdl setup
Could you check replacing SDL2 by SDL in native.xml ?
hmmm. same thing. says that it is not found
@hughsando any insight? PS: I'm using the following config file https://github.com/ncannasse/hxsdl/blob/master/native.xml
I guess checking the link line to make sure it has the flags you want. Also, do you need to install the sdl2 framework somehow on mac - third party installer? FYI, there is also a similar project https://github.com/snowkit/linc_sdl
i do have sdl instaled in my framework folder. did just try another time that im back from work, but again, not working
linc_sdl directly compiles the SDL sources, whereas hxsdl usually uses the precompiled shared library. @lewislepton it seems that you need the SDL library actually installed to be used in OSX toolchain, not sure exactly how to do that.
Look at https://developer.apple.com/library/mac/documentation/MacOSX/Conceptual/BPFrameworks/Tasks/InstallingFrameworks.html
normally in mac-land. to install SDL [or any packed framework], you just need to plop SDL2, into your global frameworks folder. so it affects everything no matter what user. which actually, the link you gave is just that
but SDL installing is probably the fifth thing i do when i either do a clean install or on a new mac computer ;)