error C2061: syntax error
Hi,
I am creating an .exe project in VS. In that i have included all the files related to it.
I am getting errors in two files: tidy.c and lexer.c
--> The errors in tidy.c are as below:
.........\tidy.c(76): error C2061: syntax error : identifier 'bAbortTidy'
.........\tidy.c(76): error C2059: syntax error : ';'
..
..
some other errors because of error at 76 line
the code at 76 line is:
extern bool bAbortTidy;
--> The errors in lexer.c are as below:
.........\lexer.c(42): error C2061: syntax error : identifier 'bAbortTidy'
.........\lexer.c(42): error C2059: syntax error : ';'
..
..
some other errors because of error at 42 line
the code at 42 line no is:
extern bool bAbortTidy;
--> The variable "bAbortTidy" is declared in other file "HTMEngine.cpp" as
bool bAbortTidy = false; // used in tidy.c and lexer.c
I already included this file then also its showing the above error.
Also i added all the preprocessor definations, additional dependencies, directory paths of all files.
It would be better if anyone can guide me in this case.
Advance Thanks,
Regards,
Nagesh
Re: error C2061: syntax error
Hi,
Again this is Nagesh.
Related to the above error, if i remove the preprocessor NDEBUG then its showing those errors in the previous post.
If i include NDEBUG then its giving other errors like:
c:\newdir\xalan-c-r786300\inc\xalanc\include\vcppdefinitions.hpp(73): fatal error C1189: #error : NDEBUG must not be defined when _DEBUG is defined.
As i have not defined _DEBUG then also its giving the above error.
Please guide me in resolving the above error
Regards,
Nagesh
Re: error C2061: syntax error
Quote:
Originally Posted by
nageshshugar
If i include NDEBUG then its giving other errors like:
c:\newdir\xalan-c-r786300\inc\xalanc\include\vcppdefinitions.hpp(73): fatal error C1189: #error : NDEBUG must not be defined when _DEBUG is defined.
If you define both NDEBUG and _DEBUG then no compilation will be run, therefore you don't see compilation errors.
BTW, what is the reason to use .c files in VC++ project?
Re: error C2061: syntax error
Quote:
Originally Posted by
nageshshugar
some other errors because of error at 76 line
the code at 76 line is:
extern bool bAbortTidy;
--> The errors in lexer.c are as below:
.........\lexer.c(42): error C2061: syntax error : identifier 'bAbortTidy'
.........\lexer.c(42): error C2059: syntax error : ';'
Your file extension is ".c", therefore the compiler will compile your code assuming the 'C' language. In the 'C' language, there is no such type as bool. That is probably why you're getting the error.
If you need to be convinced, create this program, give it a ".c" extension, and try to compile it:
Code:
int main()
{
bool b;
}
Save this to a .c file and try to compile it. Now save it to a .cpp file and try to compile it. You will see that the .c file will fail, and the .cpp file will compile.
Regards,
Paul McKenzie
Re: error C2061: syntax error
Hi Paul,
Yes, your right that in 'C' language there is no bool type, but after getting information from my colleague i came to know that if compile as C++ code(/TP) in (Project->properties->C/C++->Advanced->Compile as) then we can use bool in c.
After doing this still i am getting another error :
>c:\newdir\boost_1_43_0\boost\config\auto_link.hpp(106): fatal error C1189: #error : "Incompatible build options"
I am not getting why this error is coming? when it will come ??
Can anybody sortout this problem?
Advance Thanks,
Regards,
Nagesh
Re: error C2061: syntax error
Quote:
Originally Posted by
nageshshugar
...
After doing this still i am getting another error :
>c:\newdir\boost_1_43_0\boost\config\auto_link.hpp(106): fatal error C1189: #error : "Incompatible build options"
I am not getting why this error is coming? when it will come ??
Well, I never worked with boost, so I can only suggest you to used Google
Re: error C2061: syntax error
Quote:
Originally Posted by
nageshshugar
Hi Paul,
Yes, your right that in 'C' language there is no bool type, but after getting information from my colleague i came to know that if compile as C++ code(/TP) in (Project->properties->C/C++->Advanced->Compile as) then we can use bool in c.
Just to clarify, you are not "using bool in c". When you tell the compiler to compile the file as C++, then it's C++.
Viggy