简体   繁体   中英

C++ GNU GCC with #define out & colliding

I am working with Code::Blocks and C++ GNU GCC and trying to port my Visual Studio Project to GNU GCC .
And while I am trying to compile I get stuck with my define macro from a Defines.h file:

#define out &

And when compiling I get this error:

error: expected unqualified-id before '=' token

On this line:

// Open for output.  Default for @c ofstream and fstream.
static const openmode out =     _S_out;

In ios_base.h

As I know, that file is a part of a libstd library. Can I disable it? If so, how can I do that?
My library doesn't requiring any std c++ , just c library.

There are two main options:

  1. Don't define a macro using the word out .
  2. Declare the macro after you include all of your headers.

But seriously, a macro named out that becomes & is a pretty awful macro. It's going to make it difficult to understand the code very quickly.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM