Solved C2632: 'int' can not be followed by 'bool'
-
Hi,
i am trying to compile one of my old projects with Qt5.14.2 - MSVC2017 64
It is a small project where i was testing Backfoff's ADS librarymy project doas not compile anymore, i have an error in application output saying
error c2632 : 'int' cannot be followed by 'bool' in C:\Program Files (x86)\Windows Kits\10\Include\10.0.17134.0\shared\minwindef.h this line typedef int BOOL;
i found this :
This error can be generated due to compiler compliance work for Visual Studio .NET 2003. bool is now an appropriate type. In previous versions, bool was a typedef, and you could create identifiers with this name.If i check my kit configuration, my compiler is
Microsoft Visual C++ Compiler 15.8.28010.2041
it is automatically detected from my MVStudio community 2017 installationDoes someone know how to solve this error please ?
-
@LeLev said in C2632: 'int' can not be followed by 'bool':
error c2632 : 'int' cannot be followed by 'bool'
Hello, I think you have somewhere a define like this:
#define BOOL bool
-
@KroMignon thx for your answer but i don't understand what do you mean sorry,
do i have to define that ?
as i said there istypedef int BOOL;
in minwindef.h
in my project code i don't have #define BOOL bool -
@LeLev As I have written previously, somewhere in all headers you are including, I am pretty sure there is a define
#define BOOL bool
.
I guess it is in the Backhoff ADS library headers. -
ok thank you i found it, but i'm not sure what should i do with it
-
@LeLev To explain a bit more: if there is a "#define BOOL bool" somewhere and you write "typedef int BOOL;" the precompiler will extend it to
typedef int bool;
which exactly what the error message says :-)
Why do you want to define BOOL? There is already bool in C++.
-
@jsulm thank you very much for the explanation
i don't write any of these lines, i include headers of ads libraries
it's TwinCat ADS lib
the define is in this file
"TcAdsAPI.h" -
@jsulm said in C2632: 'int' can not be followed by 'bool':
Why do you want to define BOOL? There is already bool in C++.
@LeLev I don't want you to add this define, I only say there is already somewhere this define and that is why you cannot build.
So you have definition clash in your program:
- MSVC2003 want to define
BOOL
asint
- ADS library want to define
BOOL
asbool
.
By the way, this is not a Qt issue, this is an issue between this library and your compiler.
So perhaps you have to contact you library reseller?Is this more clear to you?
- MSVC2003 want to define
-
@KroMignon said in C2632: 'int' can not be followed by 'bool':
I don't want you to add this define
Not sure what you mean? I did not say this define should be added. Or did you want to write this to @LeLev ?
-
@KroMignon yes it is thank you i appreciate
-
@jsulm Sorry my failure, message was for @LeLev!
-
@KroMignon said in C2632: 'int' can not be followed by 'bool':
this is an issue between this library and your compiler.
yes it is, this was compiling about 1 year ago, but i don't remember what exact MSVC version i was using..
-
@LeLev said in C2632: 'int' can not be followed by 'bool':
yes it is, this was compiling about 1 year ago, but i don't remember what exact MSVC version i was using..
I would suggest you to modify your code to isolate ADS library usage in a C++ class which do not needs to include
minwindef.h
.
So you can get around this issue. -
i found the original topic :)
https://forum.qt.io/topic/105541/including-3rd-party-lib/2