What seems to be the problem?

Hello, I just started out programming so I found a nice little tutorial on how to make a simple application called "Picking Sticks" from what was said, it was supposed to be the "hello world" of programming but i seem to be having some issues.
I am running on the CodeBlocks IDE, with mingw32 compiler and when the code is all typed out and ready to be compiled i push CTRL-SHIFT-F9 to start the process, but it freezes up with error messages in the build tab most of which have a section of my code with the words "not declared in this scope".
I am just a beginner, so i probably sound very immature when it comes to this stuff, but any sort of help would be appreciated.


Thanks a billion


Last edited on
It seems you are using some variable names in a scope where they are not declared. Maybe you need to include directive

using namespace std;

In any case it would be good if you would show the full error mesage or your code.
here is the code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include "SDL/._SDL.h"
int main ( int argc, char *args[] )
{
    SDL_Init( SDL_INIT_EVERYTHING );
    SDL_WM_SetCaption("Fuck yea!", NULL);

    SDL_Surface *buffer;
    bool fullscreen = false;

    if ( fullscreen == false )
        buffer = SDL_SetVideoMode( 640, 480, 32, SDL_SWSURFACE |SDL_FULLSCREEN );
    else
        buffer = SDL_SetVideoMove( 640, 480, 32, SDL_SWSURFACE );

    SDL_Event event;

    while ( event.type != SDL_QUIT )
    {
        SDL_PollEvent( &event );
        SDL_Flip( buffer );
    }

    SDL_Quit();
    return 0;
}
Last edited on
And the errors

C:\SDL\include\SDL\._SDL.h|1|error: #include nested too deeply|
C:\SDL\include\SDL\._SDL.h||In function 'int main(int, char**)':|
C:\SDL\include\SDL\._SDL.h|4|error: 'SDL_INIT_EVERYTHING' was not declared in this scope|
C:\SDL\include\SDL\._SDL.h|4|error: 'SDL_Init' was not declared in this scope|
C:\SDL\include\SDL\._SDL.h|5|error: 'NULL' was not declared in this scope|
C:\SDL\include\SDL\._SDL.h|5|error: 'SDL_WM_SetCaption' was not declared in this scope|
C:\SDL\include\SDL\._SDL.h|7|error: 'SDL_Surface' was not declared in this scope|
C:\SDL\include\SDL\._SDL.h|7|error: 'buffer' was not declared in this scope|
C:\SDL\include\SDL\._SDL.h|11|error: 'SDL_SWSURFACE' was not declared in this scope|
C:\SDL\include\SDL\._SDL.h|11|error: 'SDL_FULLSCREEN' was not declared in this scope|
C:\SDL\include\SDL\._SDL.h|11|error: 'SDL_SetVideoMode' was not declared in this scope|
C:\SDL\include\SDL\._SDL.h|13|error: 'SDL_SWSURFACE' was not declared in this scope|
C:\SDL\include\SDL\._SDL.h|13|error: 'SDL_SetVideoMove' was not declared in this scope|
C:\SDL\include\SDL\._SDL.h|15|error: 'SDL_Event' was not declared in this scope|
C:\SDL\include\SDL\._SDL.h|15|error: expected ';' before 'event'|
C:\SDL\include\SDL\._SDL.h|17|error: 'event' was not declared in this scope|
C:\SDL\include\SDL\._SDL.h|17|error: 'SDL_QUIT' was not declared in this scope|
C:\SDL\include\SDL\._SDL.h|19|error: 'SDL_PollEvent' was not declared in this scope|
C:\SDL\include\SDL\._SDL.h|20|error: 'SDL_Flip' was not declared in this scope|
C:\SDL\include\SDL\._SDL.h|23|error: 'SDL_Quit' was not declared in this scope|
C:\SDL\include\SDL\._SDL.h||In function 'int main(int, char**)':|
C:\SDL\include\SDL\._SDL.h|2|error: redefinition of 'int main(int, char**)'|
C:\SDL\include\SDL\._SDL.h|2|error: 'int main(int, char**)' previously defined here|
C:\SDL\include\SDL\._SDL.h|4|error: 'SDL_INIT_EVERYTHING' was not declared in this scope|
C:\SDL\include\SDL\._SDL.h|4|error: 'SDL_Init' was not declared in this scope|
C:\SDL\include\SDL\._SDL.h|5|error: 'NULL' was not declared in this scope|
C:\SDL\include\SDL\._SDL.h|5|error: 'SDL_WM_SetCaption' was not declared in this scope|
C:\SDL\include\SDL\._SDL.h|7|error: 'SDL_Surface' was not declared in this scope|
C:\SDL\include\SDL\._SDL.h|7|error: 'buffer' was not declared in this scope|
C:\SDL\include\SDL\._SDL.h|11|error: 'SDL_SWSURFACE' was not declared in this scope|
C:\SDL\include\SDL\._SDL.h|11|error: 'SDL_FULLSCREEN' was not declared in this scope|
C:\SDL\include\SDL\._SDL.h|11|error: 'SDL_SetVideoMode' was not declared in this scope|
C:\SDL\include\SDL\._SDL.h|13|error: 'SDL_SWSURFACE' was not declared in this scope|
C:\SDL\include\SDL\._SDL.h|13|error: 'SDL_SetVideoMove' was not declared in this scope|
C:\SDL\include\SDL\._SDL.h|15|error: 'SDL_Event' was not declared in this scope|
C:\SDL\include\SDL\._SDL.h|15|error: expected ';' before 'event'|
C:\SDL\include\SDL\._SDL.h|17|error: 'event' was not declared in this scope|
C:\SDL\include\SDL\._SDL.h|17|error: 'SDL_QUIT' was not declared in this scope|
C:\SDL\include\SDL\._SDL.h|19|error: 'SDL_PollEvent' was not declared in this scope|
C:\SDL\include\SDL\._SDL.h|20|error: 'SDL_Flip' was not declared in this scope|
C:\SDL\include\SDL\._SDL.h|23|error: 'SDL_Quit' was not declared in this scope|
C:\SDL\include\SDL\._SDL.h||In function 'int main(int, char**)':|
C:\SDL\include\SDL\._SDL.h|2|error: redefinition of 'int main(int, char**)'|
C:\SDL\include\SDL\._SDL.h|2|error: 'int main(int, char**)' previously defined here|
C:\SDL\include\SDL\._SDL.h|4|error: 'SDL_INIT_EVERYTHING' was not declared in this scope|
C:\SDL\include\SDL\._SDL.h|4|error: 'SDL_Init' was not declared in this scope|
C:\SDL\include\SDL\._SDL.h|5|error: 'NULL' was not declared in this scope|
C:\SDL\include\SDL\._SDL.h|5|error: 'SDL_WM_SetCaption' was not declared in this scope|
C:\SDL\include\SDL\._SDL.h|7|error: 'SDL_Surface' was not declared in this scope|
C:\SDL\include\SDL\._SDL.h|7|error: 'buffer' was not declared in this scope|
C:\SDL\include\SDL\._SDL.h|11|error: 'SDL_SWSURFACE' was not declared in this scope|
C:\SDL\include\SDL\._SDL.h|11|error: 'SDL_FULLSCREEN' was not declared in this scope|
C:\SDL\include\SDL\._SDL.h|11|error: 'SDL_SetVideoMode' was not declared in this scope|
||More errors follow but not being shown.|
||Edit the max errors limit in compiler options...|
It seems that all errors are consequences of the first error

C:\SDL\include\SDL\._SDL.h|1|error: #include nested too deeply|

And what does mean the period before _SDL? Maybe you should write


#include "SDL\_SDL.h"
Last edited on
Normally SDL is included as #include "SDL/SDL.h" or #include "SDL.h" .
Thank you both so very much, i fixed the problem, but now i get the error of
error: 'SDL_SetVideoMove' was not declared in this scope
is it a problem of the function not being in the associated file?
Last edited on
Nevermind about my last post, it was because i spelled it wrong XC....Thank you all for helping me.
@primalset3909

If your problem solved then make this thread ad solved.
Topic archived. No new replies allowed.