Is this C++ standard library <list> thingy broken!!!!

If you have any questions on programming, this is the place to ask them, whether you're a newbie or an experienced programmer. Discussion on programming in general is also welcome. We will help you with programming homework, but we will not do your work for you! Any porting requests must be made in Developmental Ideas.
Post Reply
User avatar
JS Lemming
Insane DCEmu
Insane DCEmu
Posts: 202
https://www.artistsworkshop.eu/meble-kuchenne-na-wymiar-warszawa-gdzie-zamowic/
Joined: Mon Apr 04, 2005 8:08 am
Location: C:\CON\CON
Has thanked: 0
Been thanked: 0
Contact:

Is this C++ standard library <list> thingy broken!!!!

Post by JS Lemming »

Gahhh. I've been trying for four friggen days to get this to work, but it just won't! First, I'm using the DCdevkit connected to Microsoft Visual C++ to do my compiling, whatever you call that. I needed a way to iterate through a list of Object classes (from which other classes are inherited). So I tried the Standard <list> thing. Welp, here is what the top of my source looks like.

Code: Select all

//Global data required in included functions below
int Zindex;

//this is needed by KOS
#define _arch_dreamcast

#include <kos.h>
#include <stdlib.h>
#include <cmath>
//#include <cstring>
#include <png/png.h>



//Include game sources
#include "Image.cpp"
#include "GameHeader.h"
#include "Input.cpp"

#include "Player.h"

//Include some standard stuff
#include <list>

using namespace std;



//Create a list to hold all the objects
list<Object*> Objects;
Now below you see what my base class look like so far.

Code: Select all

class Object
{
public:
	virtual void Update() = 0;
	virtual void Draw() = 0;
	virtual void Delete() = 0;
};
And an unfinished class that will inherit from that base class.

Code: Select all

class Player : public Object
{
public:
	float x,y,xvel,yvel;

	float facing;

	int frame;
	int frame_counter;

	Image character_set;

	int life;
	int score;
	int invincible;

	int coins_collected;
	int enemies_killed;

	int looking_up;

	int going_pipe;
	int going_door;

	bool captain;

	void Update()
	{

	}

	void Draw()
	{

	}

	void Delete()
	{

	}
};
I don't think there is anything wrong with that. Now below, I'm attempting to cycle through a list of the objects and call the update() function.

Code: Select all

		list<Object*>::iterator itr;
		for(itr=Objects.begin(); itr!=Objects.end(); ++itr)
		{
			(*itr)->Update();
		} 
Ok, so now I'm ready to compile... look what the compiler barfs at me:
Dang'ol'compiler wrote:In file included from /cygdrive/c/DevKitDC/include/g++-v3/bits/std_cwchar.h:39,
from /cygdrive/c/DevKitDC/include/g++-v3/bits/fpos.h:40,
from /cygdrive/c/DevKitDC/include/g++-v3/bits/std_iosfwd.h:41,
from /cygdrive/c/DevKitDC/include/g++-v3/bits/stl_algobase.h:77,
from /cygdrive/c/DevKitDC/include/g++-v3/bits/std_list.h:61,
from /cygdrive/c/DevKitDC/include/g++-v3/list:31,
from BlaaBlaa.cpp:26:
/cygdrive/c/DevKitDC/include/g++-v3/bits/std_ctime.h:55: `clock_t' not declared
/cygdrive/c/DevKitDC/include/g++-v3/bits/std_ctime.h:57: `tm' not declared
/cygdrive/c/DevKitDC/include/g++-v3/bits/std_ctime.h:59: `clock' not declared
/cygdrive/c/DevKitDC/include/g++-v3/bits/std_ctime.h:61: `mktime' not declared
/cygdrive/c/DevKitDC/include/g++-v3/bits/std_ctime.h:63: `asctime' not declared
/cygdrive/c/DevKitDC/include/g++-v3/bits/std_ctime.h:64: `ctime' not declared
/cygdrive/c/DevKitDC/include/g++-v3/bits/std_ctime.h:65: `gmtime' not declared
/cygdrive/c/DevKitDC/include/g++-v3/bits/std_ctime.h:66: `localtime' not
declared
/cygdrive/c/DevKitDC/include/g++-v3/bits/std_ctime.h:67: `strftime' not
declared
NMAKE : fatal error U1077: 'C:\DevKitDC\bin\g++.exe' : return code '0x1'
Stop.
Error executing NMAKE.

BlaaBlaa.exe - 1 error(s), 0 warning(s)
I simply don't understand... and this is serously hendering me from making homebrews. Does anybody see what could possibly be wrong here?
quarn
DC Developer
DC Developer
Posts: 80
Joined: Wed Oct 17, 2001 7:44 pm
Location: Sweden
Has thanked: 0
Been thanked: 1 time

Re: Is this C++ standard library <list> thingy broken!!!!

Post by quarn »

JS Lemming wrote:I simply don't understand... and this is serously hendering me from making homebrews. Does anybody see what could possibly be wrong here?
Yes, you are not using a patched newlib/gcc/etc. If you where using *nix you could just follow the guide at http://gamedev.allusion.net/softprj/kos/setup.php
GPF
DC Developer
DC Developer
Posts: 529
Joined: Wed Oct 17, 2001 7:44 pm
Location: Texas
Has thanked: 0
Been thanked: 0
Contact:

Post by GPF »

yes the dcdev environment is using i believe kos 1.2 and gcc 3.0.4 crossbuilt for mingw.

You need a later version of kos 1.3 svn level 165 or so which has a lot better support for c++

On old version you can integrate STLport into you code for some better support but I would recommend upgrading to a later version toolchain and version of kos. Yes unforunetly for windows you would have to go commandline cygwin but you can still use dev-cpp for an editor, techinically with the cygwin dll's it would probably be possible to integrate the cygwin toolchain into the older dev-cpp environment but no one has done that yet that I know of.

Or look around LyingAwake as an all in one ISO image of cygwin and my gcc 3.4.2 toolchain and Kos 1.3 which should work perfectly for what you are trying to accomplish above.

Also if I remember right you might try just modifying the std_ctime.h file and comment out those missing declarations and see if that will get you past this problem.

Goodluck,
Troy
User avatar
JS Lemming
Insane DCEmu
Insane DCEmu
Posts: 202
Joined: Mon Apr 04, 2005 8:08 am
Location: C:\CON\CON
Has thanked: 0
Been thanked: 0
Contact:

Post by JS Lemming »

Welp, commenting that out only caused more errors. But about LyingAwake's iso.... I'm not very smart with setting these things up, so would all I have to do is like replace the DevkitDc dirrectory with a newer version or something. See I barely got this one installed, and I used a program to do that.
User avatar
GyroVorbis
Elysian Shadows Developer
Elysian Shadows Developer
Posts: 1874
Joined: Mon Mar 22, 2004 4:55 pm
Location: #%^&*!!!11one Super Sonic
Has thanked: 81 times
Been thanked: 64 times
Contact:

Post by GyroVorbis »

Not exactly, JSL, since you've been using the old VC++ setup, it'll be a lot different than you're used to.

I'll walk you through it via PM or MSN Messenger.
User avatar
JS Lemming
Insane DCEmu
Insane DCEmu
Posts: 202
Joined: Mon Apr 04, 2005 8:08 am
Location: C:\CON\CON
Has thanked: 0
Been thanked: 0
Contact:

Post by JS Lemming »

Thanks a tun GyroVorbis. I'll try to catch you on the MS of N as soon as I can.
Post Reply