Click here to Skip to main content
15,884,739 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: pointer to std::list problem! Pin
Avion859-May-09 8:15
Avion859-May-09 8:15 
GeneralRe: pointer to std::list problem! Pin
Code-o-mat9-May-09 8:22
Code-o-mat9-May-09 8:22 
GeneralRe: pointer to std::list problem! Pin
Avion859-May-09 8:26
Avion859-May-09 8:26 
GeneralRe: pointer to std::list problem! Pin
Code-o-mat9-May-09 8:49
Code-o-mat9-May-09 8:49 
GeneralRe: pointer to std::list problem! Pin
Avion859-May-09 8:56
Avion859-May-09 8:56 
GeneralRe: pointer to std::list problem! Pin
Code-o-mat9-May-09 9:00
Code-o-mat9-May-09 9:00 
AnswerRe: pointer to std::list problem! Pin
Stephen Hewitt9-May-09 7:26
Stephen Hewitt9-May-09 7:26 
GeneralRe: pointer to std::list problem! Pin
Avion859-May-09 8:12
Avion859-May-09 8:12 
First off, thanks for the reply. Now to the code. This is the actual code i should have posted earlier, this is the actual full code:
I am not sure what you mean by not being able to see whats between the <> and the brackets themselves? what am i doing wring?

//util.h   this is like globals.h
#include "stdlib.h"
#include "stdio.h"
#include "Sphere.h"
#include <list>

extern std::list<sphere>list_of_classes;
extern std::list<sphere>::const_iterator iterator;


//Sphere.h
#include <list>

class sphere{
public:
	int id;
	int promjer;
	int x;		//pos in world coordinates
	int y;		

	sphere(int idd, int ppromj, int xx, int yy, std::list<sphere> *llist_of_classes) : id(idd), promjer(ppromj), x(xx), y(yy){
		llist_of_classes.push_back(this);    //<-c2228 times 3!!
	};	
};

//main
#include "sphere.h"
#include "util.h"       //wich holds include<list> so its available

std::list<sphere>list_of_classes;
std::list<sphere>::const_iterator iterator;

void main(){

	sphere objekt(1,2,3,4,&list_of_classes); //     calling with the right number of arguments
	
        for(iterator=list_of_classes.begin(); iterator!=list_of_classes.end(); ++iterator)  //this simply writes objects data after creation
	{
		printf("kugla:%d, promjer: %d, x: %d, y: %d\n",iterator->id, iterator->promjer, iterator->x, iterator->y);
	} 

	getchar();
}

this code generates C2228:left of '.push_back' must have class/struct/union <-3times

This is the entire literal code.
All i need is a way to correctly pass a pointer to the list, add the newly created sphere object in its constructor into the list, and thats it!
Anyone spot the problem?

thank you!
GeneralRe: pointer to std::list problem! Pin
Stuart Dootson9-May-09 8:35
professionalStuart Dootson9-May-09 8:35 
GeneralRe: pointer to std::list problem! Pin
Avion859-May-09 8:55
Avion859-May-09 8:55 
QuestionAfxRegisterWndClass Pin
john56329-May-09 1:11
john56329-May-09 1:11 
AnswerRe: AfxRegisterWndClass Pin
Stuart Dootson9-May-09 2:27
professionalStuart Dootson9-May-09 2:27 
AnswerRe: AfxRegisterWndClass Pin
Taran910-May-09 20:09
Taran910-May-09 20:09 
Questionneed help Pin
ahmedbhatti9-May-09 1:03
ahmedbhatti9-May-09 1:03 
QuestionRe: need help Pin
CPallini10-May-09 0:51
mveCPallini10-May-09 0:51 
AnswerRe: need help Pin
ahmedbhatti10-May-09 20:49
ahmedbhatti10-May-09 20:49 
QuestionRe: need help Pin
CPallini10-May-09 21:28
mveCPallini10-May-09 21:28 
Questionreqest Pin
ahmed el haut9-May-09 0:39
ahmed el haut9-May-09 0:39 
AnswerRe: reqest Pin
CPallini10-May-09 0:52
mveCPallini10-May-09 0:52 
QuestionExecuting inf files Pin
VishalIndia9-May-09 0:14
VishalIndia9-May-09 0:14 
AnswerRe: Executing inf files Pin
Stuart Dootson9-May-09 0:39
professionalStuart Dootson9-May-09 0:39 
AnswerRe: Executing inf files Pin
«_Superman_»9-May-09 4:28
professional«_Superman_»9-May-09 4:28 
QuestionPlaying avi file Pin
AnayKulkarni8-May-09 20:18
AnayKulkarni8-May-09 20:18 
AnswerRe: Playing avi file Pin
Nuri Ismail8-May-09 22:53
Nuri Ismail8-May-09 22:53 
AnswerRe: Playing avi file Pin
Hamid_RT9-May-09 0:20
Hamid_RT9-May-09 0:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.