forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

undefined reference to SDL_Init

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
Neizan



Joined: 31 Oct 2007
Posts: 10

PostPosted: Fri Nov 02, 2007 9:41 pm    Post subject: undefined reference to SDL_Init Reply with quote

Hi,

I´m here again and I have another new problem.

I'm trying to use SDL libraries. My program looks like this:

Code:
#include <pspkernel.h>
#include <SDL/SDL.h>

...

int main(int argc, char* argv[])
{
    SetupCallbacks();

    SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO);

...
   
    SDL_Quit();
    sceKernelExitGame();
    return 0;
}

...


When I compile, I get the following error:

Code:
main.cpp:(.text+0x144): referencia a `SDL_Init' sin definir
main.cpp:(.text+0x15c): referencia a `SDL_Quit' sin definir


In English:

Code:
main.cpp:(.text+0x144): undefined reference to `SDL_Init'
main.cpp:(.text+0x15c): undefined reference to `SDL_Quit'


SDL.h looks like this:

Code:
#ifndef _SDL_H
#define _SDL_H

#include "SDL_main.h"
#include "SDL_types.h"
#include "SDL_getenv.h"
#include "SDL_error.h"
#include "SDL_rwops.h"
#include "SDL_timer.h"
#include "SDL_audio.h"
#include "SDL_cdrom.h"
#include "SDL_joystick.h"
#include "SDL_events.h"
#include "SDL_video.h"
#include "SDL_byteorder.h"
#include "SDL_version.h"

#include "begin_code.h"

...

extern DECLSPEC int SDLCALL SDL_Init(Uint32 flags);

...

extern DECLSPEC void SDLCALL SDL_Quit(void);

...

#include "close_code.h"

...


SDL_Init and SDL_Quit are declared as extern functions, but I searched in every library included and they aren't defined there.


Any suggestion?


EDIT: I don't know so much about Makefile, may be I need to add some library there?

[code=Makefile]...
LIBS = -unknown_option
...[/code]

Sorry for my ignorance :S
Back to top
View user's profile Send private message
jimparis



Joined: 10 Jun 2005
Posts: 1179
Location: Boston

PostPosted: Sat Nov 03, 2007 5:18 am    Post subject: Reply with quote

SDL/README.PSP
Quote:
Building applications
---------------------
Write your source file as you would a normal SDL program. Use the standard
Makefile as supplied with any PSPSDK sample program. Above the final "include"
line, add:

PSPBIN = $(PSPSDK)/../bin
CFLAGS += $(shell $(PSPBIN)/sdl-config --cflags)
LIBS += $(shell $(PSPBIN)/sdl-config --libs)
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group