 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
JoRDozZzz
Joined: 05 Apr 2007 Posts: 9
|
Posted: Fri Apr 27, 2007 4:34 am Post subject: Compile Error |
|
|
Hello everybody,
I'm a beginner with coding in c/c++ and i'm doing a lot of tutorials and try to load music and images in an homebrew. I've made this but i get an error when i compile it. Someone else tried to help me, but it doesn't helped me. please can someone here help me, i'd really like to load an image AND a music(on the background without controls). TY in advance.
Error:
graphics.o: In function `loadImage':
graphics.c:(.text+0x128): undefined reference to `png_create_read_struct'
graphics.c:(.text+0x148): undefined reference to `png_set_error_fn'
graphics.c:(.text+0x150): undefined reference to `png_create_info_struct'
graphics.c:(.text+0x164): undefined reference to `png_init_io'
graphics.c:(.text+0x170): undefined reference to `png_set_sig_bytes'
graphics.c:(.text+0x17c): undefined reference to `png_read_info'
graphics.c:(.text+0x1a4): undefined reference to `png_get_IHDR'
graphics.c:(.text+0x1e0): undefined reference to `png_destroy_read_struct'
graphics.c:(.text+0x20c): undefined reference to `png_set_strip_16'
graphics.c:(.text+0x214): undefined reference to `png_set_packing'
graphics.c:(.text+0x248): undefined reference to `png_get_valid'
graphics.c:(.text+0x260): undefined reference to `png_set_filler'
graphics.c:(.text+0x2b8): undefined reference to `png_read_end'
graphics.c:(.text+0x2c8): undefined reference to `png_destroy_read_struct'
graphics.c:(.text+0x2e0): undefined reference to `png_set_tRNS_to_alpha'
graphics.c:(.text+0x2f8): undefined reference to `png_read_row'
graphics.c:(.text+0x360): undefined reference to `png_set_palette_to_rgb'
graphics.c:(.text+0x370): undefined reference to `png_set_gray_1_2_4_to_8'
graphics.o: In function `saveImage':
graphics.c:(.text+0xb08): undefined reference to `png_create_write_struct'
graphics.c:(.text+0xb18): undefined reference to `png_create_info_struct'
graphics.c:(.text+0xb2c): undefined reference to `png_init_io'
graphics.c:(.text+0xb5c): undefined reference to `png_set_IHDR'
graphics.c:(.text+0xb68): undefined reference to `png_write_info'
graphics.c:(.text+0xc1c): undefined reference to `png_write_row'
graphics.c:(.text+0xc38): undefined reference to `png_write_end'
graphics.c:(.text+0xc44): undefined reference to `png_destroy_write_struct'
graphics.c:(.text+0xc88): undefined reference to `png_destroy_write_struct'
graphics.o: In function `flipScreen':
graphics.c:(.text+0xce0): undefined reference to `sceGuSwapBuffers'
graphics.o: In function `guStart':
graphics.c:(.text+0xe6c): undefined reference to `sceGuStart'
graphics.o: In function `initGraphics':
graphics.c:(.text+0xe80): undefined reference to `sceGuInit'
graphics.c:(.text+0xe9c): undefined reference to `sceGuDrawBuffer'
graphics.c:(.text+0xeb0): undefined reference to `sceGuDispBuffer'
graphics.c:(.text+0xeb8): undefined reference to `sceGuClear'
graphics.c:(.text+0xec4): undefined reference to `sceGuDepthBuffer'
graphics.c:(.text+0xed0): undefined reference to `sceGuOffset'
graphics.c:(.text+0xee4): undefined reference to `sceGuViewport'
graphics.c:(.text+0xef0): undefined reference to `sceGuDepthRange'
graphics.c:(.text+0xf04): undefined reference to `sceGuScissor'
graphics.c:(.text+0xf0c): undefined reference to `sceGuEnable'
graphics.c:(.text+0xf1c): undefined reference to `sceGuAlphaFunc'
graphics.c:(.text+0xf24): undefined reference to `sceGuEnable'
graphics.c:(.text+0xf2c): undefined reference to `sceGuDepthFunc'
graphics.c:(.text+0xf34): undefined reference to `sceGuEnable'
graphics.c:(.text+0xf3c): undefined reference to `sceGuFrontFace'
graphics.c:(.text+0xf44): undefined reference to `sceGuShadeModel'
graphics.c:(.text+0xf4c): undefined reference to `sceGuEnable'
graphics.c:(.text+0xf54): undefined reference to `sceGuEnable'
graphics.c:(.text+0xf5c): undefined reference to `sceGuEnable'
graphics.c:(.text+0xf70): undefined reference to `sceGuTexMode'
graphics.c:(.text+0xf7c): undefined reference to `sceGuTexFunc'
graphics.c:(.text+0xf88): undefined reference to `sceGuTexFilter'
graphics.c:(.text+0xf90): undefined reference to `sceGuAmbientColor'
graphics.c:(.text+0xf98): undefined reference to `sceGuEnable'
graphics.c:(.text+0xfb0): undefined reference to `sceGuBlendFunc'
graphics.c:(.text+0xfb8): undefined reference to `sceGuFinish'
graphics.c:(.text+0xfc4): undefined reference to `sceGuSync'
graphics.c:(.text+0xfd4): undefined reference to `sceGuDisplay'
graphics.o: In function `clearScreen':
graphics.c:(.text+0x101c): undefined reference to `sceGuClearDepth'
graphics.c:(.text+0x1024): undefined reference to `sceGuClear'
graphics.c:(.text+0x102c): undefined reference to `sceGuFinish'
graphics.c:(.text+0x1040): undefined reference to `sceGuSync'
graphics.o: In function `blitAlphaImageToScreen':
graphics.c:(.text+0x10ec): undefined reference to `sceGuTexImage'
graphics.c:(.text+0x1110): undefined reference to `sceGuTexScale'
graphics.c:(.text+0x1120): undefined reference to `sceGuFinish'
graphics.c:(.text+0x1158): undefined reference to `sceGuSync'
graphics.c:(.text+0x118c): undefined reference to `sceGuGetMemory'
graphics.c:(.text+0x120c): undefined reference to `sceGuDrawArray'
graphics.c:(.text+0x1220): undefined reference to `sceGuFinish'
graphics.c:(.text+0x1258): undefined reference to `sceGuSync'
graphics.o: In function `blitImageToScreen':
graphics.c:(.text+0x1320): undefined reference to `sceGuCopyImage'
graphics.c:(.text+0x1328): undefined reference to `sceGuFinish'
graphics.c:(.text+0x135c): undefined reference to `sceGuSync'
collect2: ld returned 1 exit status
make: *** [mp3foto.elf] Error 1
Source:
| Code: |
#include <pspdisplay.h>
#include <pspctrl.h>
#include <pspkernel.h>
#include <pspdebug.h>
#include <pspgu.h>
#include <png.h>
#include <stdio.h>
#include <pspaudio.h>
#include <pspaudiolib.h>
#include <psppower.h>
#include "graphics.h"
#include "mp3player.h"
#define printf pspDebugScreenPrintf
#define MAX(X, Y) ((X) > (Y) ? (X) : (Y))
PSP_MODULE_INFO("Foto mp3 ding", 0, 1, 1);
// TWILIGHT ZONE! <do doo do doo>
/* Exit callback */
int exit_callback(int arg1, int arg2, void *common)
{
sceKernelExitGame();
return 0;
}
/* Callback thread */
int CallbackThread(SceSize args, void *argp)
{
int cbid;
cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
sceKernelRegisterExitCallback(cbid);
sceKernelSleepThreadCB();
return 0;
}
/* Sets up the callback thread and returns its thread id */
int SetupCallbacks(void)
{
int thid = 0;
thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0);
if(thid >= 0)
{
sceKernelStartThread(thid, 0, 0);
}
return thid;
}
// END OF TWILIGHT ZONE! <do doo do do>
//
int main()
{
scePowerSetClockFrequency(333, 333, 166);
pspDebugScreenInit();
SetupCallbacks();
pspAudioInit();
SceCtrlData pad;
int i;
char buffer[200];
Image* ourImage;
initGraphics();
sprintf(buffer, "psp.PNG");
ourImage = loadImage(buffer);
MP3_Init(1);
MP3_Load("intro.mp3");
MP3_Play();
while(1)
{
sceCtrlReadBufferPositive(&pad, 1);
if(pad.Buttons & PSP_CTRL_CROSS)
{
break;
}
else if(pad.Buttons & PSP_CTRL_CIRCLE)
{
MP3_Pause();
for(i=0; i<10; i++)
{
sceDisplayWaitVblankStart();
}
}
if (MP3_EndOfStream() == 1)
{
MP3_Stop();
}
}
if (!ourImage)
{
//Image load failed
printf("Image load failed!\n");
}
else
{
/* If the loadImage function */
int x = 0;
int y = 0;
sceDisplayWaitVblankStart();
while (x < 480)
{
while (y < 272)
{
blitAlphaImageToScreen(0 ,0 ,480 , 272, ourImage, x, y);
y += 272;
}
x += 480;
y = 0;
}
flipScreen();
}
MP3_Stop();
MP3_FreeTune();
sceKernelSleepThread();
return 0;
} |
_________________ C/C++ Noob/Beginner |
|
| Back to top |
|
 |
Insert_witty_name
Joined: 10 May 2006 Posts: 376
|
Posted: Fri Apr 27, 2007 5:10 am Post subject: |
|
|
| I didn't look at your code, but to fix the compiling errors add -lpng -lz and -lpspgu to the LIBS line in your Makefile. |
|
| Back to top |
|
 |
JoRDozZzz
Joined: 05 Apr 2007 Posts: 9
|
Posted: Fri Apr 27, 2007 5:23 am Post subject: |
|
|
OK Thanks for your comment.
I've done that and now it's like this:
TARGET = mp3foto
OBJS = mp3player.o main.o graphics.o framebuffer.o
CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti
ASFLAGS = $(CFLAGS)
LIBDIR =
LIBS = -lmad -lpspaudiolib -lpspaudio -lpsppower -lpng -lz -lpspgu
LDFLAGS =
EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = MP3 Player by Pspuser
PSPSDK=$(shell psp-config --pspsdk-path)
include $(PSPSDK)/lib/build.mak
// Greetzzzz _________________ C/C++ Noob/Beginner |
|
| Back to top |
|
 |
JoRDozZzz
Joined: 05 Apr 2007 Posts: 9
|
Posted: Fri Apr 27, 2007 5:26 am Post subject: |
|
|
Thanks, now i don't have ALL those errors. But i still have some errors. This is my error right now:
| Code: | psp-gcc -I. -I/usr/local/pspdev/psp/sdk/include -O2 -G0 -Wall -D_PSP_FW_VERSION=
150 -L. -L/usr/local/pspdev/psp/sdk/lib mp3player.o main.o graphics.o framebu
ffer.o -lmad -lpspaudiolib -lpspaudio -lpsppower -lpng -lz -lpspgu -lpspdebug -
lpspdisplay -lpspge -lpspctrl -lpspsdk -lc -lpspnet -lpspnet_inet -lpspnet_apctl
-lpspnet_resolver -lpsputility -lpspuser -lpspkernel -o mp3foto.elf
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../psp/lib/libpng.a(pngrtran.o): In
function `png_build_gamma_table':
pngrtran.c:(.text+0x1258): undefined reference to `pow'
pngrtran.c:(.text+0x1470): undefined reference to `pow'
pngrtran.c:(.text+0x1518): undefined reference to `pow'
pngrtran.c:(.text+0x1630): undefined reference to `pow'
pngrtran.c:(.text+0x170c): undefined reference to `pow'
/usr/local/pspdev/lib/gcc/psp/4.0.2/../../../../psp/lib/libpng.a(pngrtran.o):png
rtran.c:(.text+0x17f8): more undefined references to `pow' follow
collect2: ld returned 1 exit status
make: *** [mp3foto.elf] Error 1
|
Can you help me, my source is in the first post :)
Thank you very very very much for help. If there are other things for PSP then coding i'll help you all too :) but in coding i'm a beginner/noob ..
Grtzzzz _________________ C/C++ Noob/Beginner |
|
| Back to top |
|
 |
Insert_witty_name
Joined: 10 May 2006 Posts: 376
|
Posted: Fri Apr 27, 2007 6:13 am Post subject: |
|
|
| Add -lm to the end of the LIBS line. |
|
| Back to top |
|
 |
JoRDozZzz
Joined: 05 Apr 2007 Posts: 9
|
Posted: Fri Apr 27, 2007 6:29 am Post subject: |
|
|
Insert_witty_name your the best of the world. compiling is done. i've started the homebrew, but displaying the image and listening to music didn't work, so there is something wrong in de main.c source. But i'm going to ask friends to help me with the source, but compiling is now available to say so ;)
thanks you very very much for help. PS2Dev.org Forums are the best forums to ask things about coding and developing i see. on other forums i still have no reactions :(
when my homebrew is completed i'll post it here with thanks to Insert_witty_name.
// greetzzzz _________________ C/C++ Noob/Beginner |
|
| Back to top |
|
 |
JoRDozZzz
Joined: 05 Apr 2007 Posts: 9
|
Posted: Fri Apr 27, 2007 6:37 am Post subject: |
|
|
It's done, sorry for all those double posts in this topic :( but i've to say that i ve a musicsong AND an image in my homebrew. Thats what i want :D Thanks again :)
Greetzz _________________ C/C++ Noob/Beginner |
|
| 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
|