Page 2 of 4
Re: How much c++
Posted: Tue May 05, 2009 8:15 pm
by herby490
jtst1 wrote:
A few questions. When i try to use <iostream> codeblocks gives me an error. Second is namespace std for cout and cin. Also when I used your code I got an error saying "undefined reference to 'firstDub(int)'
using namespace std; is used for things in the standard namespace. That includes cin and cout plus many for. Instead of typing that line you could type std:: before all things in the namespace but for now you should be ok with using namespace std. Second what error did it give you.
Re: How much c++
Posted: Tue May 05, 2009 8:24 pm
by jtst1
Nevermind about the error, I just had to delete the functions of firstdub I wasn't using.
Re: How much c++
Posted: Tue May 05, 2009 8:31 pm
by herby490
jtst1 wrote:Nevermind about the error, I just had to delete the functions of firstdub I wasn't using.
Did you copy the code exactly or did you rewrite it because it worked fine with visual studio?
Re: How much c++
Posted: Tue May 05, 2009 8:38 pm
by jtst1
herby490 wrote:jtst1 wrote:Nevermind about the error, I just had to delete the functions of firstdub I wasn't using.
Did you copy the code exactly or did you rewrite it because it worked fine with visual studio?
I copied it exactly, and got a compile error. I'm using Codeblocks compiler. But I figured out that there were functions there that weren't used, or something I'm not to good on knowing all the words.
Re: How much c++
Posted: Tue May 05, 2009 8:53 pm
by herby490
That was my fault I forgot to remove the prototypes for the functions after i commented the action function.
Re: How much c++
Posted: Tue May 05, 2009 9:00 pm
by jtst1
It's all good. Thanks for the help
Re: How much c++
Posted: Wed May 06, 2009 3:15 pm
by jtst1
Anyone know how to install sdl for codeblocks? I tried a couple tutorials, but none seemed to work.
Re: How much c++
Posted: Wed May 06, 2009 3:26 pm
by dandymcgee
jtst1 wrote:Anyone know how to install sdl for codeblocks? I tried a couple tutorials, but none seemed to work.
Did you copy SDL's files into their respective directories inside the MinGW folder (ie. lib, include, bin)?
After you've done that you need to go to "Build Options..." in the Project menu, then click the Linker Settings tab. In the "Other Linker Options:" field paste the following:
Code: Select all
-lmingw32 -lSDLmain -lSDL -lSDL_image
If it still doesn't work, post any compile errors you are getting.
Re: How much c++
Posted: Wed May 06, 2009 3:55 pm
by jtst1
Yeah I copied the folders, but i'll try the other thing and post back.
EDIT----------------
Ok so I just copied some stuff from a tutorial to test it, and I only got 1 compile error "cannont find -1sdL_image"
heres the code:
Code: Select all
#include "SDL/SDL.h"
#include <string>
//The attributes of the screen
const int SCREEN_WIDTH = 640;
const int SCREEN_HEIGHT = 480;
const int SCREEN_BPP = 32;
//The surfaces that will be used
SDL_Surface *message = NULL;
SDL_Surface *background = NULL;
SDL_Surface *screen = NULL;
SDL_Surface *load_image( std::string filename )
{
//Temporary storage for the image that's loaded
SDL_Surface* loadedImage = NULL;
//The optimized image that will be used
SDL_Surface* optimizedImage = NULL;
//Load the image
loadedImage = SDL_LoadBMP( filename.c_str() );
//If nothing went wrong in loading the image
if( loadedImage != NULL )
{
//Create an optimized image
optimizedImage = SDL_DisplayFormat( loadedImage );
//Free the old image
SDL_FreeSurface( loadedImage );
}
Re: How much c++
Posted: Wed May 06, 2009 4:55 pm
by herby490
jtst1 wrote:Yeah I copied the folders, but i'll try the other thing and post back.
EDIT----------------
Ok so I just copied some stuff from a tutorial to test it, and I only got 1 compile error "cannont find -1sdL_image"
Did you install SDL_image. It is seperate from SDL so you need to install that separately.
Re: How much c++
Posted: Wed May 06, 2009 4:58 pm
by jtst1
I guess not... Where does it go?
Re: How much c++
Posted: Wed May 06, 2009 5:04 pm
by thejahooli
jtst1 wrote:herby490 wrote:jtst1 wrote:Yeah I copied the folders, but i'll try the other thing and post back.
EDIT----------------
Ok so I just copied some stuff from a tutorial to test it, and I only got 1 compile error "cannont find -1sdL_image"
Did you install SDL_image. It is seperate from SDL so you need to install that separately.
I guess not... Where does it go?
It doesn't look like you're using SDL_image but if you do want to use it you can read how to at
http://lazyfoo.net/SDL_tutorials/lesson03/index.php
Re: How much c++
Posted: Wed May 06, 2009 5:05 pm
by herby490
jtst1 wrote:I guess not... Where does it go?
Have you tried lazyfoo's tutorials on how to set up SDL. If not here are the URLs for Code::Blocks
Plain SDL:
http://lazyfoo.net/SDL_tutorials/lesson ... /index.php
SDL add ons:
http://lazyfoo.net/SDL_tutorials/lesson ... /index.php
also you might want to look at the FAQ for more information:
http://lazyfoo.net/faq.php
Re: How much c++
Posted: Wed May 06, 2009 5:17 pm
by jtst1
Well I started to follow the other tutorial, but this statement confused me:
3)Next extract the lib file that's inside of lib subfolder of the archive to your SDL lib folder. In my case it was at C:\SDL-1.2.12\lib\.
I have no Idea wtf it's talking about. Does it want me to extract the sdl_image file, thats the only thing that can be. All that does is make a whole bunch of DLL's named SDL_Image1 SDL_Image2 all the way to 32? I didn't know if this is correct.
Sorry for uber noobness
Re: How much c++
Posted: Wed May 06, 2009 5:35 pm
by herby490
Did you follow the directions for the first tutorial on how to setup SDL and for the DLLs make sure you got the correct download.