How much c++

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

herby490
Chaos Rift Regular
Chaos Rift Regular
Posts: 122
Joined: Thu Feb 12, 2009 5:59 pm

Re: How much c++

Post 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.
User avatar
jtst1
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 80
Joined: Tue Sep 30, 2008 4:32 pm
Location: Atlanta Georgia

Re: How much c++

Post by jtst1 »

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.
herby490
Chaos Rift Regular
Chaos Rift Regular
Posts: 122
Joined: Thu Feb 12, 2009 5:59 pm

Re: How much c++

Post 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?
User avatar
jtst1
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 80
Joined: Tue Sep 30, 2008 4:32 pm
Location: Atlanta Georgia

Re: How much c++

Post 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.
When One learns to Love, One must bear the risk of Hatred.
herby490
Chaos Rift Regular
Chaos Rift Regular
Posts: 122
Joined: Thu Feb 12, 2009 5:59 pm

Re: How much c++

Post by herby490 »

That was my fault I forgot to remove the prototypes for the functions after i commented the action function.
User avatar
jtst1
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 80
Joined: Tue Sep 30, 2008 4:32 pm
Location: Atlanta Georgia

Re: How much c++

Post by jtst1 »

It's all good. Thanks for the help :worship:
When One learns to Love, One must bear the risk of Hatred.
User avatar
jtst1
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 80
Joined: Tue Sep 30, 2008 4:32 pm
Location: Atlanta Georgia

Re: How much c++

Post by jtst1 »

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.
User avatar
dandymcgee
ES Beta Backer
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++

Post 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.
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches! :twisted:
User avatar
jtst1
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 80
Joined: Tue Sep 30, 2008 4:32 pm
Location: Atlanta Georgia

Re: How much c++

Post 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 );
    }
When One learns to Love, One must bear the risk of Hatred.
herby490
Chaos Rift Regular
Chaos Rift Regular
Posts: 122
Joined: Thu Feb 12, 2009 5:59 pm

Re: How much c++

Post 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.
User avatar
jtst1
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 80
Joined: Tue Sep 30, 2008 4:32 pm
Location: Atlanta Georgia

Re: How much c++

Post by jtst1 »

I guess not... Where does it go?
When One learns to Love, One must bear the risk of Hatred.
User avatar
thejahooli
Chaos Rift Junior
Chaos Rift Junior
Posts: 265
Joined: Fri Feb 20, 2009 7:45 pm
Location: London, England

Re: How much c++

Post 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
I'll make your software hardware.
herby490
Chaos Rift Regular
Chaos Rift Regular
Posts: 122
Joined: Thu Feb 12, 2009 5:59 pm

Re: How much c++

Post 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
User avatar
jtst1
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 80
Joined: Tue Sep 30, 2008 4:32 pm
Location: Atlanta Georgia

Re: How much c++

Post 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
When One learns to Love, One must bear the risk of Hatred.
herby490
Chaos Rift Regular
Chaos Rift Regular
Posts: 122
Joined: Thu Feb 12, 2009 5:59 pm

Re: How much c++

Post 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.
Post Reply