Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 2

Qt-interest Archive, May 2007
what is the wrong with following code


Message 1 in thread

hi, good morning... plz tell me what is the wrong with following code


#ifndef SAMPLECFILE_H
#define SAMPLECFILE_H

#ifdef __cplusplus
extern "C" {
#endif
enum Bool{FALSE = 0,TRUE}; 
int AdditionOfNumbers(int, int);
#ifdef __cplusplus
};
#endif
#endif  //SAMPLECFILE_H

compiler is showing errors like :

error C2143: syntax error : missing '}' before 'constant'
 error C2143: syntax error : missing ';' before '}'
 error C2059: syntax error : '}'
 error C2143: syntax error : missing ';' before '}'
 error C2059: syntax error : '}'


D. Anil kumar

Every success has a story of great failure.
So don't stop with failure where
Success comes after failure.

Message 2 in thread

On 5/8/07, anil kumar <d.anil@xxxxxxxxxxxxx> wrote:
>
> hi, good morning... plz tell me what is the wrong with following code
>
>
> #ifndef SAMPLECFILE_H
> #define SAMPLECFILE_H
>
> #ifdef __cplusplus
> extern "C" {
> #endif
> enum Bool{FALSE = 0,TRUE};
> int AdditionOfNumbers(int, int);
> #ifdef __cplusplus
> };
> #endif
> #endif  //SAMPLECFILE_H
>
> compiler is showing errors like :
>
> error C2143: syntax error : missing '}' before 'constant'
>  error C2143: syntax error : missing ';' before '}'
>  error C2059: syntax error : '}'
>  error C2143: syntax error : missing ';' before '}'
>  error C2059: syntax error : '}'

Works for me. Try a list for your C++ compiler - this has nothing to do with Qt.


-- 
 [ signature omitted ] 

Message 3 in thread

On 2007-05-08, anil kumar wrote:
>
> #ifndef SAMPLECFILE_H
> #define SAMPLECFILE_H
>
> #ifdef __cplusplus
> extern "C" {
> #endif
> enum Bool{FALSE = 0,TRUE};
> int AdditionOfNumbers(int, int);
> #ifdef __cplusplus
> };
> #endif
> #endif  //SAMPLECFILE_H
>
> compiler is showing errors like :
>
> error C2143: syntax error : missing '}' before 'constant'
>  error C2143: syntax error : missing ';' before '}'
>  error C2059: syntax error : '}'
>  error C2143: syntax error : missing ';' before '}'
>  error C2059: syntax error : '}'
>

You are almost certainly including another header before this which
contains #define for TRUE and FALSE. I suggest that you refrain from
using all uppercase for enum values such as these.

HTH,

Stephen Jackson

--
 [ signature omitted ] 

Message 4 in thread

> hi, good morning... plz tell me what is the wrong with following code

And what exactly does this have to do with Qt?
Have a look here: http://www.catb.org/~esr/faqs/smart-questions.html
The sad thing is that as long as you're getting your answers you
probably don't care.

Peter

P.S.
Is it just me or did the amount of Off-Topic questions skyrocket lately?

--
 [ signature omitted ] 

Message 5 in thread

> P.S.
> Is it just me or did the amount of Off-Topic questions skyrocket
lately?
Its not you... It almost seems that a university class opened up
somewhere using QT...

Scott

--
 [ signature omitted ]