From: "Alexandre Devaure" Newsgroups: comp.os.msdos.djgpp References: <8dk3aa$m6a$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE> <9LgL4.1906$D21 DOT 3649551 AT nnrp4 DOT proxad DOT net> <8dkfaj$rk1$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE> <8dkh60$sjr$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE> Subject: Re: 'volatile' undeclared from here Lines: 88 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2615.200 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200 Message-ID: Date: Thu, 20 Apr 2000 07:37:52 GMT NNTP-Posting-Host: 194.51.236.59 X-Complaints-To: abuse AT proxad DOT net X-Trace: nnrp6.proxad.net 956216272 194.51.236.59 (Thu, 20 Apr 2000 09:37:52 CEST) NNTP-Posting-Date: Thu, 20 Apr 2000 09:37:52 CEST Organization: Guest of ProXad - France To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Hans-Bernhard Broeker a écrit dans le message : 8dkh60$sjr$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE... > That's a bit strange. I compiled your code (as a .cc file, directly, > as you hadn't provided the main source file, nor any other module), on > a Linux installation of gcc-2.95.2, and it accepted it without any > complaints. Which means this is either a problem with the DJGPP build > of gcc-2.95.2, or the actual problem is elsewhere in your program, > i.e. in those parts you didn't show. > > Could you try and cut down the source to the absolute minimum that > still reports that compiler error, and post the result? > This is the source code that reports the compiler error. It seems to be a problem with the template in the class TValueFifo. When I comment out the template declaration, the compiler accepts the source code. #include "ports.h" #include class bidon { int toto; public: int flags() { return toto; } }; #include template class TValueFifo { private: unsigned Head; unsigned Tail; unsigned Count; unsigned char Buffer[Size*sizeof(T)]; unsigned char Buffer[1024]; public: int Empty() { return !Count; } int Full() { return Count==1024; } // int Put(const T& Value) int Put(const bidon& Value) { if (!Full()) { // ((T*)Buffer)[Head]= Value; ((bidon*)Buffer)[Head]=Value; if (Head>=1024-1) Head=0; else Head++; Count++; return 0; } return 1; } int PutSecure(const T& Value) int PutSecure(const bidon& Value) { __asm__ __volatile__("pushf"); int Error = Put(Value); popf(); return Error; } TValueFifo() : Head(0), Tail(0), Count(0) {} }; TValueFifo obj; int main() { bidon b; int i=obj.PutSecure(b); } Alex