gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > Adding more sourcefiles

#43294 - cooky - Sat May 21, 2005 6:21 pm

I'm using the template that comes with ndsdev. And i'm compiling through Programmer notepad 2 that comes with that. When i try to compile all i can seem to get is that there is no rule to make the added .h and .cpp file need by main.

"make[2]: *** No rule to make target `c:/DS/ndsdev/projects/tester_ii/arm9/ds_sprites/ds_sprite.h', needed by `main.o'. Stop."


So my question is simple how do i add these source files and get them to compile with the two main source files?

#43306 - dagamer34 - Sat May 21, 2005 9:01 pm

Ummm.. it almost looks as if you are adding a .h file to the compile list, which is a bad thing. You only need to tell the compiler to compile .c/.cpp files.

If all else fails, look at the template code or some released demos with source included.
_________________
Little kids and Playstation 2's don't mix. :(

#43372 - cooky - Sun May 22, 2005 8:56 pm

I mangaed to get around (not the best term when your starting a large project) that problem by putting both my .h and .cpp file in arm 9 directory. but i now have another troublesome error that I carn't seem to work around. the code reads perfectly to me take a look.

The error is:
"c:/ds/ndsdev/projects/tester_ii/arm9/main.cpp:144: undefined reference to `ds_gfx::init_gfx(unsigned short const*, int, bool)' "

The code is:
Code:
   //disable all sprites
   initOAM();
   //set up the sprites
   //Make sprite container   
   ds_sprite sprites[3];
//   Sprite sprites[128];
   Sprite sprites_sub[128];

   ds_gfx gfx_ii;

   sprites[0].init_sprite( 1, 100, 10, 1, SIZE_16X16, &gfx_ii, true, 1, false, 0);
   sprites[1].init_sprite( 1, 23, 30, 1, SIZE_16X16, &gfx_ii, true, 0, false, 0);
   sprites[2].init_sprite( 1, 13, 30, 1, SIZE_16X16, &gfx_ii, true, 0, false, 0);

   const u16* pac;
   pac = &pac0Data[0];

   gfx_ii.init_gfx(&pac0Data[0], TILED_PIXEL_DATA_256, true);


Edit: the class code for ds_gfx is also held in another source file if that should make a difference.

I wonder if anyone has had this error befor and what they did to fix it?

#43423 - cooky - Mon May 23, 2005 10:55 am

Actually the answer was really really stupidly simple. I had missed the "ds_gfx::" off the definition of the function. so the compiler was compiling the function and noticing the link between the to but couldn't tell me that i was missing something from the deffinition of the function to make the link explicit.