[Solved] C++ unable to call std::endl


From the standard N4687:

20.5.4.3.2 Macro names

1 A translation unit that includes a standard library header shall not
#define or #undef names declared in any standard library header
.

2 A translation unit shall not #define or #undef names lexically
identical to keywords, to the identifiers listed in Table 4, or to the
attribute-tokens described in 10.6.

So what you are trying to do is prohibited by the standard!

Additionally in this specific case it won’t work because you are substituting endl for a string of some sort, causing the preprocessor to generate this: std::"\n\r" which causes the compilation to fail.


If you wan’t to replace std::endl by "\r\n" (BTW: not "\n\r") then do it by hand or write a script to do it.

8

solved C++ unable to call std::endl