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.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)'
How much c++
Moderator: Coders of Rage
Re: How much c++
Re: How much c++
Nevermind about the error, I just had to delete the functions of firstdub I wasn't using.
When One learns to Love, One must bear the risk of Hatred.
Re: How much c++
Did you copy the code exactly or did you rewrite it because it worked fine with visual studio?jtst1 wrote:Nevermind about the error, I just had to delete the functions of firstdub I wasn't using.
Re: How much c++
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.herby490 wrote:Did you copy the code exactly or did you rewrite it because it worked fine with visual studio?jtst1 wrote:Nevermind about the error, I just had to delete the functions of firstdub I wasn't using.
When One learns to Love, One must bear the risk of Hatred.
Re: How much c++
That was my fault I forgot to remove the prototypes for the functions after i commented the action function.
Re: How much c++
It's all good. Thanks for the help
When One learns to Love, One must bear the risk of Hatred.
Re: How much c++
Anyone know how to install sdl for codeblocks? I tried a couple tutorials, but none seemed to work.
When One learns to Love, One must bear the risk of Hatred.
- dandymcgee
- ES Beta Backer
- Posts: 4709
- Joined: Tue Apr 29, 2008 3:24 pm
- Current Project: https://github.com/dbechrd/RicoTech
- Favorite Gaming Platforms: NES, Sega Genesis, PS2, PC
- Programming Language of Choice: C
- Location: San Francisco
- Contact:
Re: How much c++
Did you copy SDL's files into their respective directories inside the MinGW folder (ie. lib, include, bin)?jtst1 wrote:Anyone know how to install sdl for codeblocks? I tried a couple tutorials, but none seemed to work.
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
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches!
Re: How much c++
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:
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 );
}
When One learns to Love, One must bear the risk of Hatred.
Re: How much c++
Did you install SDL_image. It is seperate from SDL so you need to install that separately.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"
Re: How much c++
I guess not... Where does it go?
When One learns to Love, One must bear the risk of Hatred.
- thejahooli
- Chaos Rift Junior
- Posts: 265
- Joined: Fri Feb 20, 2009 7:45 pm
- Location: London, England
Re: How much c++
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.phpjtst1 wrote:I guess not... Where does it go?herby490 wrote:Did you install SDL_image. It is seperate from SDL so you need to install that separately.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"
I'll make your software hardware.
Re: How much c++
Have you tried lazyfoo's tutorials on how to set up SDL. If not here are the URLs for Code::Blocksjtst1 wrote:I guess not... Where does it go?
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++
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
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
When One learns to Love, One must bear the risk of Hatred.
Re: How much c++
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.