How can one set up SDL in Netbeans on a Mac (Lion)?
Moderator: Coders of Rage
How can one set up SDL in Netbeans on a Mac (Lion)?
I have been trying for a while and cannot get anywhere with trying to use SDL in Netbeans on my Mac running Lion. Does anyone know how to do this?
- Ginto8
- ES Beta Backer
- Posts: 1064
- Joined: Tue Jan 06, 2009 4:12 pm
- Programming Language of Choice: C/C++, Java
Re: How can one set up SDL in Netbeans on a Mac (Lion)?
I'm sure there are a few people who could tell you multiple ways to do this, but to be helpful you probably want to tell people 1. what you've already done and 2. what didn't happen that you thought would.
Quit procrastinating and make something awesome.
Ducky wrote:Give a man some wood, he'll be warm for the night. Put him on fire and he'll be warm for the rest of his life.
Re: How can one set up SDL in Netbeans on a Mac (Lion)?
C/++ or java?
If C/++ then you should maybe look into xcode. Its much nicer, and I believe there are templates.
If C/++ then you should maybe look into xcode. Its much nicer, and I believe there are templates.
Some person, "I have a black belt in karate"
Dad, "Yea well I have a fan belt in street fighting"
Dad, "Yea well I have a fan belt in street fighting"
- Light-Dark
- Dreamcast Developer
- Posts: 307
- Joined: Sun Mar 13, 2011 7:57 pm
- Current Project: 2D RPG & NES Platformer
- Favorite Gaming Platforms: NES,SNES,N64,Genesis,Dreamcast,PC,Xbox360
- Programming Language of Choice: C/++
- Location: Canada
Re: How can one set up SDL in Netbeans on a Mac (Lion)?
good god, they ported SDL to java?, thats a bigger waste of time than trying to beat ninja gaiden on NES.avansc wrote:C/++ or java?
If C/++ then you should maybe look into xcode. Its much nicer, and I believe there are templates.
<tpw_rules> LightDark: java is a consequence of inverse moore's law: every 18 months, the average program will be twice as slow. therefore, computers always run at the same percevied speed. java's invention was a monumental step
Re: How can one set up SDL in Netbeans on a Mac (Lion)?
Oh yeah? So what constructive things do you do with your time?Light-Dark wrote:good god, they ported SDL to java?, thats a bigger waste of time than trying to beat ninja gaiden on NES.avansc wrote:C/++ or java?
If C/++ then you should maybe look into xcode. Its much nicer, and I believe there are templates.
Some person, "I have a black belt in karate"
Dad, "Yea well I have a fan belt in street fighting"
Dad, "Yea well I have a fan belt in street fighting"
Re: How can one set up SDL in Netbeans on a Mac (Lion)?
I had tried using XCode earlier, but it gave me an error saying that "_main" was causing issues. I followed multiple guides and tutorials, but no luck. And I am doing this all in C++.
- szdarkhack
- Chaos Rift Cool Newbie
- Posts: 61
- Joined: Fri May 08, 2009 2:31 am
Re: How can one set up SDL in Netbeans on a Mac (Lion)?
http://www.cplusplus.com/forum/general/11692/wabushooo wrote:I had tried using XCode earlier, but it gave me an error saying that "_main" was causing issues. I followed multiple guides and tutorials, but no luck. And I am doing this all in C++.
This could be related to your issue, it's a common issue with SDL 1.2 and a pretty stupid design decision. Thankfully, it's no longer used with SDL 1.3, so make sure you're not including it by accident, or if you're using the older version try some of the suggestions in the linked topic.
- Light-Dark
- Dreamcast Developer
- Posts: 307
- Joined: Sun Mar 13, 2011 7:57 pm
- Current Project: 2D RPG & NES Platformer
- Favorite Gaming Platforms: NES,SNES,N64,Genesis,Dreamcast,PC,Xbox360
- Programming Language of Choice: C/++
- Location: Canada
Re: How can one set up SDL in Netbeans on a Mac (Lion)?
Work on my game, turn java 'programmers' to C/++ Programmers and play Sonic Adventure and sometimes if the mood is right ill play some mega man 2.avansc wrote:Oh yeah? So what constructive things do you do with your time?Light-Dark wrote:good god, they ported SDL to java?, thats a bigger waste of time than trying to beat ninja gaiden on NES.avansc wrote:C/++ or java?
If C/++ then you should maybe look into xcode. Its much nicer, and I believe there are templates.
<tpw_rules> LightDark: java is a consequence of inverse moore's law: every 18 months, the average program will be twice as slow. therefore, computers always run at the same percevied speed. java's invention was a monumental step
Re: How can one set up SDL in Netbeans on a Mac (Lion)?
Ok, using the C linkage worked. I'm not sure why, but it compiled and I can see and image now. Thanks guys.
Re: How can one set up SDL in Netbeans on a Mac (Lion)?
Sooo... nothing...Light-Dark wrote: Work on my game, turn java 'programmers' to C/++ Programmers and play Sonic Adventure and sometimes if the mood is right ill play some mega man 2.
C++ name mangling causes a lot of issues if you are not careful.wabushooo wrote:Ok, using the C linkage worked. I'm not sure why, but it compiled and I can see and image now. Thanks guys.
Some person, "I have a black belt in karate"
Dad, "Yea well I have a fan belt in street fighting"
Dad, "Yea well I have a fan belt in street fighting"
Re: How can one set up SDL in Netbeans on a Mac (Lion)?
Ok, and just like that, it doesn't work at all. I used what the website had and it compiled and ran the first time, but now I end up with the same error as before. When I use what it tells me, an error is given saying that there is a confliction with SDL_main.h. Any ideas as to what is going on?
- LeonBlade
- Chaos Rift Demigod
- Posts: 1314
- Joined: Thu Jan 22, 2009 12:22 am
- Current Project: Trying to make my first engine in C++ using OGL
- Favorite Gaming Platforms: PS3
- Programming Language of Choice: C++
- Location: Blossvale, NY
Re: How can one set up SDL in Netbeans on a Mac (Lion)?
With SDL on OS X you need to link the Cocoa framework and include the SDLmain.h and SDLmain.m files in order for that problem to go away.wabushooo wrote:Ok, and just like that, it doesn't work at all. I used what the website had and it compiled and ran the first time, but now I end up with the same error as before. When I use what it tells me, an error is given saying that there is a confliction with SDL_main.h. Any ideas as to what is going on?
I assume that's what you're talking about?
For example, if I try to compile this code on OS X:
Code: Select all
g++ -c SDLTest.c
g++ -o SDLTest SDLTest.o -lSDL
Code: Select all
Undefined symbols for architecture x86_64:
"_main", referenced from:
start in crt1.10.6.o
(maybe you meant: _SDL_main)
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
Code: Select all
g++ -o SDLTest SDLTest.o -lSDL -lSDLmain -framework Cocoa
Code: Select all
g++ -c SDLTest.c SDLmain.m
g++ -o SDLTest SDLTest.o SDLmain.o -lSDL -framework Cocoa
Please note that if you try and use fullscreen you might get this:
Code: Select all
<Warning>: CGDisplayBaseAddress is obsolete and returning NULL for display 0x19091a40
Here's that test code just to show it's working just fine.
Hope this helps, everything I did here I literally built as I was writing it, so you shouldn't have any problems. Obviously, I'm compiling this with G++ in the terminal, but it shouldn't be that difficult to link SDLmain and the Cocoa framework in whatever IDE you want to use.
There's no place like ~/
Re: How can one set up SDL in Netbeans on a Mac (Lion)?
Everytime I try this, I get an error saying that -lSDL does not exist. This may have been the root of my problem, but what can I do to get that in the correct place?
I'll also make note that I had used SDL fine in Snow Leopard, but now Lion seems to have moved many things around.
I'll also make note that I had used SDL fine in Snow Leopard, but now Lion seems to have moved many things around.
- LeonBlade
- Chaos Rift Demigod
- Posts: 1314
- Joined: Thu Jan 22, 2009 12:22 am
- Current Project: Trying to make my first engine in C++ using OGL
- Favorite Gaming Platforms: PS3
- Programming Language of Choice: C++
- Location: Blossvale, NY
Re: How can one set up SDL in Netbeans on a Mac (Lion)?
You might have to reinstall the SDL framework onto your computer where your compiler can link to it.wabushooo wrote:Everytime I try this, I get an error saying that -lSDL does not exist. This may have been the root of my problem, but what can I do to get that in the correct place?
I'll also make note that I had used SDL fine in Snow Leopard, but now Lion seems to have moved many things around.
One way you might be able to get it to work is by using a package manager for OS X like brew and then link from your /usr/local/Cellar or wherever you install it.
You simply run:
Code: Select all
brew install sdl
It should symlink SDL into /usr/local by default, and there you can link your compiler to find the SDL library.
You might have to run sudo brew link sdl after you install if you get this error:
Code: Select all
Error: The linking step did not complete successfully
The formula built, but is not symlinked into /usr/local
You can try again using `brew link sdl'
Code: Select all
-framework SDL
Either way should work the same, potential version differences aside.
Hopefully this will help as well, and again I ran the brew command while typing this and checked my symlinks to make sure everything was being linked over properly.
Happy Thanksgiving by the way (if you're from America).
There's no place like ~/
Re: How can one set up SDL in Netbeans on a Mac (Lion)?
Using brew got it to work, and the application runs, but I now get the warning in terminal that you had before. Any idea what this means? Also, it tried to go fullscreen for me, and I didn't see anything in the window. It's probably an issue in the code. Thanks though for showing me how get SDL installed, and happy Thanksgiving to you too (assuming you're in America) :D