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: Select all
#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;
}