[Solved] MingGW (error: graphics.h: No such file or dir)

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
Pihas
Posts: 53
Joined: Sat Oct 25, 2008 10:26 pm
Location: Lithuania
Contact:

[Solved] MingGW (error: graphics.h: No such file or dir)

Post by Pihas »

Hello every body i'm new at C++ programing and have a problem with simple thing :/ just want to blit an Image. Made Hellow World and works perfectly but with image bliting have problems.

I'm using DevkitPro (http://www.devkitpro.org) with installed pspsdk-setup-0.9.2.exe (http://minpspw.sourceforge.net/)

Console:

Code: Select all

Owner@PRIVE-0D6D31055 ~/Projektai
$ cd Paveiksliukas

Owner@PRIVE-0D6D31055 ~/Projektai/Paveiksliukas
$ make
psp-gcc -I. -Ic:/devkitPro/devkitPSP/pspsdk/psp/sdk/include -O2 -G0 -Wall -D_PSP
_FW_VERSION=150   -c -o main.o main.c
main.c:17:22: error: graphics.h: No such file or directory
main.c: In function 'main':
main.c:60: error: 'Image' undeclared (first use in this function)
main.c:60: error: (Each undeclared identifier is reported only once
main.c:60: error: for each function it appears in.)
main.c:60: error: 'ourImage' undeclared (first use in this function)
main.c:64: warning: implicit declaration of function 'initGraphics'
main.c:67: warning: implicit declaration of function 'loadImage'
main.c:82: warning: implicit declaration of function 'blitAlphaImageToScreen'
main.c:90: warning: implicit declaration of function 'flipScreen'
make: *** [main.o] Error 1

Owner@PRIVE-0D6D31055 ~/Projektai/Paveiksliukas
$ 
My main.c:

Code: Select all

/*
          My Image Display Program
          Author: Brad Dwyer
          Date: 12/28/2005

          Thanks to Psilocybeing for the base code.
*/


#include <pspdisplay.h>
#include <pspctrl.h>
#include <pspkernel.h>
#include <pspdebug.h>
#include <pspgu.h>
#include <png.h>
#include <stdio.h>
#include "graphics.h"


#define printf pspDebugScreenPrintf
#define MAX&#40;X, Y&#41; &#40;&#40;X&#41; > &#40;Y&#41; ? &#40;X&#41; &#58; &#40;Y&#41;&#41;

PSP_MODULE_INFO&#40;"Image Display Program", 0, 1, 1&#41;;


/* Exit callback */
int exit_callback&#40;int arg1, int arg2, void *common&#41; &#123;
          sceKernelExitGame&#40;&#41;;
          return 0;
&#125;

/* Callback thread */
int CallbackThread&#40;SceSize args, void *argp&#41; &#123;
          int cbid;

          cbid = sceKernelCreateCallback&#40;"Exit Callback", exit_callback, NULL&#41;;
          sceKernelRegisterExitCallback&#40;cbid&#41;;

          sceKernelSleepThreadCB&#40;&#41;;

          return 0;
&#125;

/* Sets up the callback thread and returns its thread id */
int SetupCallbacks&#40;void&#41; &#123;
          int thid = 0;

          thid = sceKernelCreateThread&#40;"update_thread", CallbackThread, 0x11, 0xFA0, 0, 0&#41;;
          if&#40;thid >= 0&#41; &#123;
                    sceKernelStartThread&#40;thid, 0, 0&#41;;
          &#125;

          return thid;
&#125;



int main&#40;&#41; &#123;
          char buffer&#91;200&#93;;
          Image* ourImage;

          pspDebugScreenInit&#40;&#41;;
          SetupCallbacks&#40;&#41;;
          initGraphics&#40;&#41;;

          sprintf&#40;buffer, "bootlog.png"&#41;;
          ourImage = loadImage&#40;buffer&#41;;

          if &#40;!ourImage&#41; &#123;
                    //Image load failed
                    printf&#40;"Image load failed!\n"&#41;;
          &#125; else &#123;

                    int x = 0;
                    int y = 0;
                    sceDisplayWaitVblankStart&#40;&#41;;

                    while &#40;x < 480&#41; &#123;
                              while &#40;y < 272&#41; &#123;


                                        blitAlphaImageToScreen&#40;0 ,0 ,32 , 32, ourImage, x, y&#41;;
                                        y += 32;
                              &#125;

                              x += 32;
                              y = 0;
                    &#125;

                    flipScreen&#40;&#41;;
          &#125;

          sceKernelSleepThread&#40;&#41;;
          return 0;
&#125;

My make file:

Code: Select all

TARGET = hello
OBJS = main.o graphics.o framebuffer.o

CFLAGS = -O2 -G0 -Wall
CXXFLAGS = $&#40;CFLAGS&#41; -fno-exceptions -fno-rtti
ASFLAGS = $&#40;CFLAGS&#41;

LIBDIR =
LIBS = -lpspgu -lpng -lz -lm
LDFLAGS =

EXTRA_TARGETS = EBOOT.PBP
PSP_EBOOT_TITLE = Image Example

PSPSDK=$&#40;shell psp-config --pspsdk-path&#41;
include $&#40;PSPSDK&#41;/lib/build.mak
It think my problem is that did't installed (compiled) zlib, if it is how to do what on MinGW. Tried to use Minimalist PSPSDK for Windows: http://sourceforge.net/project/showfile ... _id=590671 zlib-1.2.2-pspdevpak.exe
Last edited by Pihas on Sat Mar 14, 2009 11:07 pm, edited 1 time in total.
Pihas
Posts: 53
Joined: Sat Oct 25, 2008 10:26 pm
Location: Lithuania
Contact:

Re: MingGW (error: graphics.h: No such file or dir)

Post by Pihas »

Sry for double posting, just press edit button...to add devkit version (1.4.10)
Heimdall
Posts: 245
Joined: Thu Nov 10, 2005 1:29 am
Location: Netherlands
Contact:

Post by Heimdall »

the minpspw 0.9.2 already comes with zlib and other included and you don't need devkitpro at all. The other thing is that graphics.h is not part of the sdk it comes (i think) from the tutorials from the psp-hacks book and site, maybe you should look for it there...
Pihas
Posts: 53
Joined: Sat Oct 25, 2008 10:26 pm
Location: Lithuania
Contact:

Post by Pihas »

Solved, just followed http://www.psp-programming.com/tutorials/c/lesson05.htm and puted those files http://www.psp-programming.com/tutorials/c/lesson05.zip to same dir as makefile and main.c Thx for help
Post Reply