trouble with STL

D

DouglasUrbano

Hi all,


I have a class named CVector:

class CVector {

public:

float fx;
float fy;
};

and i also have a class named CImage:

#include "CVector.h"
#include <vector>

class CImage {
public:
CVector Size;
std::vector < CFrame* > Frames;
};

but when i try to compile it, i got some errors
\include\c++\3.4.2\bits\stl_bvector.h `vector' is not a template

and if i change the include orders, to:

#include <vector>
#include "CVector.h"

i got these error:
CImage.h ISO C++ forbids declaration of `CMyVector' with no type


and these code works perfectly on linux!

Anyone knows why, or how to fix it?
 
L

Lars Tetzlaff

Am 09.08.2010 21:53, schrieb DouglasUrbano:
Hi all,


I have a class named CVector:

class CVector {

public:

float fx;
float fy;
};

and i also have a class named CImage:

#include "CVector.h"
#include <vector>

class CImage {
public:
CVector Size;
std::vector < CFrame* > Frames;
};

but when i try to compile it, i got some errors
\include\c++\3.4.2\bits\stl_bvector.h `vector' is not a template

and if i change the include orders, to:

#include <vector>
#include "CVector.h"

i got these error:
CImage.h ISO C++ forbids declaration of `CMyVector' with no type


and these code works perfectly on linux!

Anyone knows why, or how to fix it?

You do not show your actual code, There is no CMyVector in your code but
there is one in the error message. Where is CFrame declared? Where is
your .cpp?

Lars
 
F

Felix Palmen

* DouglasUrbano said:
but when i try to compile it, i got some errors
\include\c++\3.4.2\bits\stl_bvector.h `vector' is not a template [...]
i got these error:
CImage.h ISO C++ forbids declaration of `CMyVector' with no type [...]
and these code works perfectly on linux!

If you posted all your source, this seems to be an implementation bug of
your compiler's STL. Did you take a look at your vector include file?

But anyway, I'd suggest to refrain from naming your classes with "C"
prefix. That's a silly thing that AFAIK Microsoft introduced with MFC in
a misguided attempt to apply hungarian notation naming convention to C++
classes. Better use namespaces. Maybe the problem will go away ;)

Regards, Felix
 
A

Aidy Sun

Hi all,

I have a class named CVector:

class CVector {

            public:

                        float fx;
                        float fy;

};

and i also have a class named CImage:

#include "CVector.h"
#include <vector>

class CImage {
  public:
    CVector Size;
    std::vector < CFrame* >  Frames;

};

but when i try to compile it, i got some errors
\include\c++\3.4.2\bits\stl_bvector.h `vector' is not a template

and if i change the include orders, to:

#include <vector>
#include "CVector.h"

i got these error:
CImage.h ISO C++ forbids declaration of `CMyVector' with no type

and these code works perfectly on linux!

Anyone knows why, or how to fix it?

Try to include the declaration file of CFrame.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,778
Messages
2,569,605
Members
45,238
Latest member
Top CryptoPodcasts

Latest Threads

Top