Welcome! Log In Create A New Profile

Advanced

Problems compiling a .dol

Posted by Oscar_Richard 
Problems compiling a .dol
August 18, 2010 01:19AM
I'm trying to compile my code to .dol file using a Makefile, of course. But when I do I get three errors:
1.-GX_BM_Substract was not declared
2.-Two or more data types in declaration of 'spr_oscright_high'
3.-A 'spr_oscright_high' was not declared.

Here is a screen capture:


For error 1 I don't know if I installed grrlib so bad.
For error 3 I suppose is from error 2.
Here is the code of the header file spr_oscright.h:

// Image file from spr_oscright.bmp

const int spr_oscright_high=32;
const int spr_oscright_width=16;

const u16 spr_oscright_img[]={
0x4E7B,0x4E7B,0x4E7B,0x4E7B,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4E7B,0x4E7B,0x4E7B,
0x4E7B,0x4E7B,0x4E7B,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4E7B,0x4E7B,
0x4E7B,0x4E7B,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4E7B,
0x4E7B,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4E7B,
0x4E7B,0x0,0x0,0x0,0x0,0x0,0x0,0xF6AD,0xF6AD,0xF6AD,0xF6AD,0xF6AD,0xF6AD,0xF6AD,0x0,0x4E7B,
0x4E7B,0x0,0x0,0x0,0x0,0xF6AD,0xF6AD,0xFFFF,0xFFFF,0xF6AD,0xF6AD,0xFFFF,0xFFFF,0xF6AD,0x0,0x0,
0x0,0x0,0x0,0x0,0x0,0xF6AD,0xF6AD,0xFFFF,0xFFFF,0xF6AD,0xF6AD,0xFFFF,0xFFFF,0xF6AD,0xF6AD,0x0,
0x0,0xF6AD,0xF6AD,0x0,0x0,0xF6AD,0xF6AD,0xFFFF,0x0,0xF6AD,0xF6AD,0x0,0xFFFF,0xF6AD,0xF6AD,0x0,
0x0,0xF6AD,0xF6AD,0x0,0xF6AD,0xF6AD,0x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D,0x0,0x0,0x0,0x0,0xF6AD,0xF6AD,0x0,0x4E7B,0x4E7B,0x4E7B,
0x0,0x0,0xF6AD,0xF6AD,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xF6AD,0xF6AD,0x0,0x0,0x4E7B,
0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x4E7B,0x4E7B,0x0,0x0,0x0,0x0,0x0,0x0,0x4E7B
};

And the code for error 3:
player.cpp:
#include "player.h"
#include "img/spr_oscright.h"


objOscar::objOscar () : faith(10.0), xspeed(0), yspeed(0), hand(false)
{
posx=(256/2);
posy=(240/2);
}

objOscar::~objOscar()
{
}

void objOscar::handed()
{
hand=true;
}

bool objOscar::draw()
{
GRRLIB_DrawImg(posx, posy, spr_oscright_width, spr_oscright_high, spr_oscright_img, 0, 1);
return true;
}


Could somebody help me?
Re: Problems compiling a .dol
August 18, 2010 04:37AM
If you are using the svn version of libogc you need to use the svn version of GRRLIB.

In revision 4170 of libogc, GX_BM_SUBSTRACT was renamed GX_BM_SUBTRACT.
Re: Problems compiling a .dol
August 18, 2010 07:56AM
I renamed GX_BM_SUBSTRACT to GX_BM_SUBTRACT so the error dissapeared. I suppose that is OK.
For the rest two errors I put a semi-colon in other header file (player.h) and then I got now these two mistakes:

Re: Problems compiling a .dol
August 18, 2010 06:00PM
The parameters for GRRLIB_DrawImg are in order:
xpos    Specifies the x-coordinate of the upper-left corner.
ypos    Specifies the y-coordinate of the upper-left corner.
tex     The texture to draw.
degrees Angle of rotation.
scaleX  Specifies the x-coordinate scale. -1 could be used for flipping the texture horizontally.
scaleY  Specifies the y-coordinate scale. -1 could be used for flipping the texture vertically.
color   Color in RGBA format.
In your code you wrote:
GRRLIB_DrawImg(posx, posy, spr_oscright_width, spr_oscright_high, spr_oscright_img, 0, 1);
It does not seems accurate.

PS: did you forget to load the texture into a GRRLIB_texImg struct?
Re: Problems compiling a .dol
August 19, 2010 12:39AM
I try to load the texture.
It says now this:
e:/game/source/player.cpp:10: expected constructor, destructor, or type conversion before '.' token

Here is the updated code for player.cpp:

//
#include "player.h"
#include "img/spr_oscright.h"

typedef struct OscImg {
GRRLIB_texImg * texture;
} OscImg;

OscImg imgOsc;
imgOsc.texture = GRRLIB_LoadTexture(spr_oscright_img);

objOscar::objOscar () : faith(10.0), xspeed(0), yspeed(0), hand(false)
{
posx=(256/2);
posy=(240/2);
}

objOscar::~objOscar()
{
}

void objOscar::handed()
{
hand=true;
}

bool objOscar::draw()
{
GRRLIB_DrawImg(posx, posy, imgOsc.texture, 0, spr_oscright_width, spr_oscright_high, 0xFFFFFFFF);
return true;
};
Re: Problems compiling a .dol
August 19, 2010 07:43AM
From what I see in your code, those two lines seems to be in the middle of nowhere:
OscImg imgOsc;
imgOsc.texture = GRRLIB_LoadTexture(spr_oscright_img);
Call GRRLIB_LoadTexture in your constructor or something ...

PS: Next time use the code tag when you post source code on this forum.



Edited 2 time(s). Last edit at 08/19/2010 07:45AM by Crayon.
Re: Problems compiling a .dol
August 21, 2010 12:37AM
I try to call to this constructor, but it say that cannot convert 'const u16*' to 'const u8*' for argument '1' to GRRLIB_teximg* GRRLIB_Loadtexture(const u8*)

I even tried to put u16 and u8 next to imgOsc, but it marks the same previous error.

#include "player.h"
#include "img/spr_oscright.h"

typedef struct OscImg {
    GRRLIB_texImg * texture;
} OscImg;

OscImg imgOsc;


objOscar::objOscar () //: faith(10.0), xspeed(0), yspeed(0), hand(false)
{
    imgOsc.texture = GRRLIB_LoadTexture(spr_oscright_img);
    posx=(256/2); //X
    posy=(240/2); //Y
}

objOscar::~objOscar()
{
}

void objOscar::handed()
{
    hand=true;
}

bool objOscar::draw()
{
    GRRLIB_DrawImg(posx, posy, imgOsc.texture, 0, spr_oscright_width, spr_oscright_high, 0xFFFFFFFF);
    return true;
};

Re: Problems compiling a .dol
August 21, 2010 12:49AM
What tool did you use to generate spr_oscright_img??
Re: Problems compiling a .dol
August 21, 2010 02:36AM
I used Wii Builder
Re: Problems compiling a .dol
August 21, 2010 03:37PM
How did you create the object with the objOscar class? Could you paste that code.

Maybe it could a good thing to paste the .h too.

When there is an error in Programmer's Notepad you could click on the red line to go to the error, could you paste that line too.

Thanks.
Re: Problems compiling a .dol
August 22, 2010 07:11PM
I'm basing in some examples in Wiibrew.org. Here's the .h code:

#ifndef __PLAYER_H__
#define __PLAYER_H__

class objOscar
    {
        public:
            objOscar();
            ~objOscar();
            int diamonds;
            void handed();
            void update();
            bool draw();
        private:
            int score;
            double faith;
            int xspeed, yspeed;
            int posx, posy;
            bool hand;
            u16* imgOscar;
    };

#endif

I was trying to put u16* imgOscar to try to resolve the error, but not. So I don't think it's something to do.

Well, here's the error in Programmer's notepad:

e:/yosdemo/source/player.cpp:14: error: cannot convert 'const u16*' to 'const u8*' for argument '1' to 'GRRLIB_texImg* GRRLIB_LoadTexture(const u8*)'

I was using Dev C++ ^^'
Re: Problems compiling a .dol
August 22, 2010 07:59PM
I'm sorry I just don't understand the problem. If it's possible just put every thing in a zip file and upload it somewhere.

I tried this code:
typedef struct OscImg {
    GRRLIB_texImg * texture;
} OscImg;

OscImg imgOsc;
Whit this in the main():
    imgOsc.texture = GRRLIB_LoadTexture(my_img);
// ...
    GRRLIB_DrawImg(10, 60, imgOsc.texture, 0, 1, 1, 0xFFFFFFFF);
And every thing worked like a charm.

By the way the code you show on your first post has not been generated by WiiBuilder, because the output should look like this:
/**
 * This file was autogenerated from spr_oscright.png by WiiBuilder.
 */

//---------------------------------------------------------------------------------
#ifndef _spr_oscright_h_
#define _spr_oscright_h_
//---------------------------------------------------------------------------------
const unsigned char spr_oscright[] = {
	0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A, 0x00, 0x00, 0x00, 0x0D, 0x49, 0x48, 0x44, 0x52, 
	0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, 0xAC, 0x08, 0x06, 0x00, 0x00, 0x00, 0x87, 0x29, 0x65, 
...
};
const int spr_oscright_size = 45111;
//---------------------------------------------------------------------------------
#endif //_spr_oscright_h_
//---------------------------------------------------------------------------------
Re: Problems compiling a .dol
August 24, 2010 01:14AM
I made some changes in player.cpp:
#include 
#include "player.h"
#include "img/spr_oscright.h"

/*typedef struct OscImg {
    GRRLIB_texImg * imgOsc;
} OscImg;

OscImg imgOsc;*/
GRRLIB_texImg * imgOsc;


objOscar::objOscar () 
{
    posx=(256/2); //X
    posy=(240/2); //Y
}

objOscar::~objOscar()
{
}

void objOscar::handed()
{
    hand=true;
}
 
bool objOscar::draw()
{
	imgOsc = GRRLIB_LoadTexture(spr_oscright);
    GRRLIB_DrawImg(posx, posy, imgOsc, 0, spr_oscright_width, spr_oscright_high, 0xFFFFFFFF);
    return true;
};


When I compile it says this now:

main.cpp
player.cpp
linking ... yosdemo.elf
main.o: In function `main':
e:/yosdemo/source/main.cpp:14: undefined reference to `GRRLIB_Init'
e:/yosdemo/source/main.cpp:33: undefined reference to `GRRLIB_Render'
e:/yosdemo/source/main.cpp:36: undefined reference to `GRRLIB_Exit'
player.o: In function `objOscar::draw()':
e:/yosdemo/source/player.cpp:31: undefined reference to `GRRLIB_LoadTexture'
e:/yosdemo/source/player.cpp:32: undefined reference to `GRRLIB_DrawImg'
collect2: ld returned 1 exit status
make[1]: *** [/e/yosdemo/yosdemo.elf] Error 1
"make": *** [build] Error 2

> Process Exit Code: 2
> Time Taken: 00:23

For some reason it marks on main. Here's the main.cpp code:
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include "player.h" 

int main(int argc, char **argv) {

    // Initialise the Graphics & Video subsystem
	GRRLIB_Init();
        // Initialise the Wiimotes
    WPAD_Init();

    objOscar Oscar;
    // Loop forever
    while(1) {

        WPAD_ScanPads();  // Scan the Wiimotes

        // If [HOME] was pressed on the first Wiimote, break out of the loop
        if (WPAD_ButtonsDown(0) & WPAD_BUTTON_HOME)  break;

        // ---------------------------------------------------------------------
        // Place your drawing code here
        // ---------------------------------------------------------------------
            //Oscar.update();
            Oscar.draw();
            
        GRRLIB_Render();  // Render the frame buffer to the TV
    }

    GRRLIB_Exit(); // Be a good boy, clear the memory allocated by GRRLIB

    exit(0);  // Use exit() to exit a program, do not use 'return' from main()
}
Re: Problems compiling a .dol
August 24, 2010 02:14AM
I guess it's because you changed your Makefile, it should look like this: [code.google.com]
Re: Problems compiling a .dol
August 28, 2010 08:02PM
Thanks. I modified my Makefile and it runs already on my Wii. However the image looks extended, but I guess it's because the width/high I put it.
Re: Problems compiling a .dol
August 29, 2010 07:36AM
ScaleX and ScaleY should be equal to 1 in order to use the original size. GRRLIB_DrawImg::
	xpos 	Specifies the x-coordinate of the upper-left corner.
	ypos 	Specifies the y-coordinate of the upper-left corner.
	tex 	The texture to draw.
	degrees 	Angle of rotation.
	scaleX 	Specifies the x-coordinate scale. -1 could be used for flipping the texture horizontally.
	scaleY 	Specifies the y-coordinate scale. -1 could be used for flipping the texture vertically.
	color 	Color in RGBA format.
Sorry, only registered users may post in this forum.

Click here to login