string class and vc++.wank :)

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



I dont think I have ever been as dissappointed, frustrated or bewildered in
all of my life.
The problem, well take this class definition:
#ifndef __DATA

#define __DATA

#pragma once

#include <iostream>

#include <string>

class Data

{

public:

Data(void);

~Data(void);

private:

int XAxis, YAxis, StartFrom;



};

#endif

This will compile quite happily. However, if I were to add a string called
s1 it wont compile.
#ifndef __DATA

#define __DATA

#pragma once

#include <iostream>

#include <string>

class Data

{

public:

Data(void);

~Data(void);

private:

int XAxis, YAxis, StartFrom;

string s1;

};

#endif

When I try to compile the above code I get: Error C2146, c2501 twice.
Can anyone please tell me what I am doing wrong please?????

I really am glad this is a small project. I am going to develop using QT.
Multi platform and a dream in comparison. Apparently.

Opions please.

Cheers
John
--
www.integrated-dev-sol.co.uk



.



Relevant Pages

  • Disable optimization within code
    ... auto-generated and included into this build into many applications which ... Basicly I need to compile it with -O0 when all other files are ... this particular file with a #pragma: ...
    (comp.unix.programmer)
  • RE: Remote debugging with VC2008
    ... just select native as the debugging code type. ... you first separate your pure managed code files and pure native code files ... select "Compile with Common Lanage Runtime support" as "No Common Language ... Additionally you can even use "#pragma managed ...
    (microsoft.public.vc.debugger)
  • Re: ATLComTime.h and alignment bug
    ... ATLComTime.h file breaks an alignment ... // Compile time assert: fails to compile if alignment of ADSVALUE ... ADSVALUE structure defined in iads.h is 4, ... #pragma pack ...
    (microsoft.public.vc.language)
  • Re: Could C++ do this without the #pragma
    ... > more common version of Test Collector, and not need macros. ... > You misunderstand the pragma. ... but there is more to the use of these directives ... than reducing code size and compile times. ...
    (comp.lang.cpp)
  • Re: #if !defined(AFX_
    ... My comment was about the claim that #pragma once is faster. ... there is no stopping the compiler from opening bar2.h a second ... time when it is included in foo.cpp (the first time is when it is included ...
    (microsoft.public.vc.mfc)