GP2X 'sdl_Sys_Joystickgp2Xsys' Was Not Declared In This Scope


DCurro

Still Fresh
Joined
Jul 8, 2009
Messages
27
C:\Codeblocks\Projects\NewTest\sdltest.cpp||In function 'void TestNewJoystick()':|
C:\Codeblocks\Projects\NewTest\sdltest.cpp|536|error: 'BACK_LIGHT_OFF' was not declared in this scope|
C:\Codeblocks\Projects\NewTest\sdltest.cpp|536|error: 'SDL_SYS_JoystickGp2xSys' was not declared in this scope|
C:\Codeblocks\Projects\NewTest\sdltest.cpp|536|error: 'BACK_LIGHT_ON' was not declared in this scope|
C:\Codeblocks\Projects\NewTest\sdltest.cpp|537|error: 'BATT_LED_ON' was not declared in this scope|
C:\Codeblocks\Projects\NewTest\sdltest.cpp|537|error: 'SDL_SYS_JoystickGp2xSys' was not declared in this scope|
C:\Codeblocks\Projects\NewTest\sdltest.cpp|537|error: 'BATT_LED_OFF' was not declared in this scope|
||=== Build finished: 6 errors, 0 warnings ===|

I couldn't find an answer on how to solve this. The search made it appear like a common event, but I had trouble finding a thread with an answer.

Does anyone know how to solve this?

Thanks!
 
DCurro said:
C:CodeblocksProjectsNewTestsdltest.cpp||In function 'void TestNewJoystick()':|
C:CodeblocksProjectsNewTestsdltest.cpp|536|error: 'BACK_LIGHT_OFF' was not declared in this scope|
C:CodeblocksProjectsNewTestsdltest.cpp|536|error: 'SDL_SYS_JoystickGp2xSys' was not declared in this scope|
C:CodeblocksProjectsNewTestsdltest.cpp|536|error: 'BACK_LIGHT_ON' was not declared in this scope|
C:CodeblocksProjectsNewTestsdltest.cpp|537|error: 'BATT_LED_ON' was not declared in this scope|
C:CodeblocksProjectsNewTestsdltest.cpp|537|error: 'SDL_SYS_JoystickGp2xSys' was not declared in this scope|
C:CodeblocksProjectsNewTestsdltest.cpp|537|error: 'BATT_LED_OFF' was not declared in this scope|
||=== Build finished: 6 errors, 0 warnings ===|

I couldn't find an answer on how to solve this. The search made it appear like a common event, but I had trouble finding a thread with an answer.

Does anyone know how to solve this?

Thanks!

These need to be declared the compiler doesnt know what they are. Typically if your using functions/defines from someone else's c files you need a header file that points the compiler to what they are.
Ive not used these things, but if anywhere they would probably be in sdl_gp2x.h
 
Last edited by a moderator:
Code:
/*
 * Non-standard SDL header.
 *
 * This header gives access to a few extra features of the GP2X hardware
 * that I added to the video driver.
 */

#ifndef SDL_GP2X__H
#define SDL_GP2X__H

#ifdef __cplusplus
extern "C" {
#endif

void SDL_GP2X_SetMonoColours(int background, int foreground);
int  SDL_GP2X_GetPhysicalScreenSize(SDL_Rect *size);
void SDL_GP2X_Display(SDL_Rect *area);
void SDL_GP2X_SetCursorColour(WMcursor *wcursor,
			      int bred, int bgreen, int bblue, int balpha,
			      int fred, int fgreen, int fblue, int falpha)

#ifdef __cplusplus
}
#endif

#endif

That is the content of my sdl_gp2x.h file. Does mine differ from everyone elses? Also this header file gives me an error stating:

C:\devkitGP2X\include\SDL_GP2X.H|23|error: expected initializer before '}' token|



Other than this my code runs fine. Playing with the backlight and LED isn't mission critical but I would like to incorporate the LED into a game eventually.

Thanks!
 
Ok,

You have a monumentally ancient version of the GP2X SDL there :eek: , it does not feature the functions you want to use.

I have a one of the Open2x libpacks I tweaked to work with DevKitGP2X somewhere, I'll see if I can dig it out but I won't be able to do it for a few days.

Tip, check your ;'s in that include ;) .
 
I used this tutorial:
http://wiki.gp2x.org/wiki/Using_CodeBlocks

bingo on the missing ;!


[EDIT]
I solved my problem by getting an updated version of the lib and include folder from the open2x website. I also edited the wiki.

Thanks so much for everyone's help, everything works perfectly now!
[\EDIT]
 
Back
Top