 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
HolgiB
Joined: 12 Jan 2007 Posts: 6
|
Posted: Fri Jan 12, 2007 6:55 am Post subject: Compile problem with graphics.h - understanding problem |
|
|
Hi,
this are my first steps in PSP development. I already coded some small programs in C, but this was 10 years ago. So I am a noob. Somebody already pointed me to my "text problem" to freetype. I also found "flib" and this seems to be an easy way to get the job done for me. The demo compile without any trouble. Unfortunately I have a problem compiling my own program together with it and I really dont know why. Analyzed the Makefile for an hour, tried a lot but I still get this:
| Code: | psp-gcc -I/include -I. -I/usr/local/pspdev/psp/sdk/include -G0 -Wall -O2 -I/usr/local/pspdev/psp/include/SDL -Dmain=SDL_main -L. -L/usr/local/pspdev/psp/sdk/lib sdlext.o flib.o graphics.o framebuffer.o sdlsidplay.o -lpsppower -lpspgu -lpng -lz -lm -lfreetype -lsidplay -lstdc++ -L/usr/local/pspdev/psp/lib -lSDLmain -lSDL -lm -L/usr/local/pspdev/psp/sdk/lib -lpspdebug -lpspgu -lpspctrl -lpspge -lpspdisplay -lpsphprm -lpspsdk -lpsprtc -lpspaudio -lc -lpspuser -lpsputility -lpspkernel -lpspdebug -lpspdisplay -lpspge -lpspctrl -lpspsdk -lc -lpspnet -lpspnet_inet -lpspnet_apctl -lpspnet_resolver -lpsputility -lpspuser -lpspkernel -o sdlsidplay.elf
sdlsidplay.o: In function `Intro()':
sdlsidplay.cpp:(.text+0x70): undefined reference to `initGraphics()'
sdlsidplay.cpp:(.text+0x7c): undefined reference to `load_font(char*)'
sdlsidplay.cpp:(.text+0x8c): undefined reference to `clearScreen(unsigned int)'
sdlsidplay.cpp:(.text+0x98): undefined reference to `set_font_color(unsigned int)'
sdlsidplay.cpp:(.text+0xa0): undefined reference to `set_font_size(int)'
sdlsidplay.cpp:(.text+0xb4): undefined reference to `text_to_screen(char*, int, int)'
sdlsidplay.cpp:(.text+0xc4): undefined reference to `flipScreen()'
sdlsidplay.o: In function `SDL_main':
sdlsidplay.cpp:(.text+0x85c): undefined reference to `unload_font()'
collect2: ld returned 1 exit status
make: *** [sdlsidplay.elf] Error 1
|
And this is my Makefile:
| Code: |
TARGET = sdlsidplay
OBJS = sdlext.o flib.o graphics.o framebuffer.o sdlsidplay.o
INCDIR = $(PSPDIR)/include
CFLAGS = -G0 -Wall -O2
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)
LIBDIR =
LDFLAGS =
LIBS= -lpsppower -lpspgu -lpng -lz -lm -lfreetype
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = sdlsidplay
PSP_EBOOT_ICON = sidplay.png
PSPBIN = $(PSPSDK)/../bin
CFLAGS += $(shell $(PSPBIN)/sdl-config --cflags)
LIBS += -lsidplay -lstdc++ $(shell $(PSPBIN)/sdl-config --libs)
PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak
strip: all
cp $(TARGET).elf sdlsid.elf
psp-strip sdlsid.elf
|
Hmm, is the order of OBJS important or not? Changed it but not success. Same error.
The includes in my main program (sdlsiplay.cpp):
| Code: |
#include <stdlib.h>
#include <stdio.h>
#include <SDL/SDL.h>
#include <sidplay/sidtune.h>
#include <sidplay/emucfg.h>
#include <pspdebug.h>
#include <pspctrl.h>
#include <string.h>
#include <dirent.h>
#include <pspdisplay.h>
#include "graphics.h"
#include "flib.h"
#include "sdlext.h"
|
And the code which are causing this problem. When I remove it, everything is fine. My program works, but I am just starting to build something like a user interface and need flib and all what I can get from graphics.h.
| Code: |
int
Intro()
{
initGraphics();
if(!load_font("times.ttf")) // load "times new roman" font
{
printf ("Could not load font file.\n");
return 1;
}
clearScreen(0);
set_font_color(0xff00ffff); // green
set_font_size(24); // 16 point
text_to_screen("PSP-Sidplayer", 0, 0);
sceDisplayWaitVblankStart();
flipScreen();
return(0);
}
|
I really dont have an idea. I think its an understanding problem because the flib demo compiles and works without any problems. In this program, I have to use also SDL. The audio routines of the original author are using SDL. This part works perfectly.
HELP :-)
--Holger |
|
| Back to top |
|
 |
Insert_witty_name
Joined: 10 May 2006 Posts: 376
|
Posted: Fri Jan 12, 2007 7:12 am Post subject: |
|
|
Wrap the graphics.h include in an extern C statement.
| Code: | extern "C" {
#include "graphics.h"
} |
You may have to do this for the flib/sdlext include also. |
|
| Back to top |
|
 |
HolgiB
Joined: 12 Jan 2007 Posts: 6
|
Posted: Fri Jan 12, 2007 4:49 pm Post subject: |
|
|
Thank you very much. That was the solution of my problem.
Didnt had a clue what could be the problem. Think this solution I neverever had found on my own :-) .
--Holger |
|
| Back to top |
|
 |
|
|
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
|