Code::Blocks Forums
User forums => Using Code::Blocks => Topic started by: MoonKid on May 28, 2007, 02:46:11 pm
-
I am using Code::Blocks on WinXP with MinGW gcc.
I have a foreign project and try to compile it.
There is this piece of code
SEARCHPGM { /* search program */
SEARCHSET *msgno; /* message numbers */
SEARCHSET *uid; /* unique identifiers */
SEARCHOR *or; /* or'ed in programs */
SEARCHPGMLIST *not; /* and'ed not program */
SEARCHHEADER *header; /* list of headers */
STRINGLIST *bcc; /* bcc recipients */
Look at '*or' and '*not'. I am not sure but I think the compiler interpret it as '*||' and '*!' what have to occure an error of course. This is the error:
In file included from include/Mcclient.h:24,
from D:\Garage\projekte\mahogany\mahoganySVN\src\classes\MApplication.cpp:30:
lib/imap/src/c-client/mail.h:933: error: expected unqualified-id before '||' token
lib/imap/src/c-client/mail.h:933: error: abstract declarator `search_or*' used as declaration
lib/imap/src/c-client/mail.h:933: error: expected `;' before '||' token
lib/imap/src/c-client/mail.h:934: error: expected unqualified-id before '!' token
lib/imap/src/c-client/mail.h:934: error: abstract declarator `search_pgm_list*' used as declaration
lib/imap/src/c-client/mail.h:934: error: expected `;' before '!' token
In file included from D:\Garage\projekte\mahogany\mahoganySVN\src\classes\MApplication.cpp:30:
Is it C++ standard to interpret or and not as the operators? If not, how can I turn that off?
The code works fine on MSVC.
-
Is it C++ standard to interpret or and not as the operators? If not, how can I turn that off?
AFAIK, "or" and "not" are compiled as operators, at least within gcc (edit: for g++, i.e. not in C but in C++). No idea on how to avoid it, but i think that the easiest way is "search and replace in files" and use another identifiers (initial capital or final underscore, for instance).
The code works fine on MSVC
:shock: Does it work fine or simply compiles without errors?
-
http://cs.smu.ca/~porter/csc/ref/cpp_keywords.html
In any case, I think it's a bad idea to use such keywords for identifiers. Microsoft has a long historial of being too soft on programmers, and that leads to errors like this one.