Re: [Dev-C++] Can't use not-operator with non-bool?
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Daniel G. <sp...@ho...> - 2003-03-22 06:56:08
|
mode needs a type.
You are passing !mode as a parameter to a function aren't you? You can only
use ! in a conditional statement. So you might do
// Your new function
bool CheckMode(bool mode)
{
return mode;
};
// In your code, in the function call pass in the result of ChekMode
mode = SDL_WM_GrabInput( !CheckMode(mode) );
OR better still, try the following:
switch (mode)
{
case: SDL_GRAB_ON
//... do something
break;
default:
//... something else
}
Any help?
void HotKey_ToggleGrab(void)
{
SDL_GrabMode mode;
printf("Ctrl-G: toggling input grab!\n");
mode = SDL_WM_GrabInput(SDL_GRAB_QUERY);
if ( mode == SDL_GRAB_ON ) {
printf("Grab was on\n");
} else {
printf("Grab was off\n");
}
mode = SDL_WM_GrabInput(!mode); /* Error occurs here */
if ( mode == SDL_GRAB_ON ) {
printf("Grab is now on\n");
} else {
printf("Grab is now off\n");
}
}
>From: Ken Mortimer <gr...@ta...>
>To: dev...@li...
>Subject: [Dev-C++] Can't use not-operator with non-bool?
>Date: Sat, 22 Mar 2003 00:04:41 -0500
>
>Hey all,
>I've been having problems compiling a test program that comes with the CVS
>build of SDL (for those of you familiar with it)... My problem is that a
>function in the source uses the not-operator ( ! ) on non-bool datatypes...
>Can C++ not use this operator on non-bool?
>
>void HotKey_ToggleGrab(void)
>{
>SDL_GrabMode mode;
>
>printf("Ctrl-G: toggling input grab!\n");
>mode = SDL_WM_GrabInput(SDL_GRAB_QUERY);
>if ( mode == SDL_GRAB_ON ) {
>printf("Grab was on\n");
>} else {
>printf("Grab was off\n");
>}
>mode = SDL_WM_GrabInput(!mode); /* Error occurs here */
>if ( mode == SDL_GRAB_ON ) {
>printf("Grab is now on\n");
>} else {
>printf("Grab is now off\n");
>}
>}
>
>The errors reported are as follows:
>
>C:\SDL-1.2.6\test\testwm.c
>[Warning] In function `void HotKey_ToggleGrab()':
>
>96
>C:\SDL-1.2.6\test\testwm.c
>cannot convert `bool' to `SDL_GrabMode'
>
>C:\Documents and Settings\Granoblastic Man\My Documents\Dev-C++
>Projects\Makefile.win
>[Build Error] [../../../../SDL-1.2.6/test/testwm.o] Error 1
>
>
>
>-------------------------------------------------------
>This SF.net email is sponsored by:Crypto Challenge is now open! Get
>cracking and register here for some mind boggling fun and the chance of
>winning an Apple iPod:
>http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en
>_______________________________________________
>Dev-cpp-users mailing list
>Dev...@li...
>TO UNSUBSCRIBE: http://www.noicys.cjb.net/devcpp/ub.htm
>https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
_________________________________________________________________
Express yourself with cool emoticons http://messenger.msn.co.uk
|