Comments (5)
The conflicts can be avoided by using #define NOGDI prior to including
windows.h.
Original comment by [email protected]
on 8 Feb 2010 at 3:06
from google-glog.
WinGDI.h contains the following line:
#define ERROR 0
which of course, eventually causes weird syntax errors.
The NOGDI solution should probably be documented, along with the fact that
ERROR is
not 0, and one should grep their code for possible misuse.
Those that need GDI should defines NOGDI then manually include the necessary
headers
with #undef ERROR afterward.
NOGDI should still be defined to prevent other #includes from including WinGDI.h
Original comment by [email protected]
on 17 May 2010 at 11:34
from google-glog.
I added a small section into our document.
http://code.google.com/p/google-glog/source/detail?r=79
Thanks for discussions!
Original comment by [email protected]
on 28 May 2010 at 3:23
- Changed state: Duplicate
from google-glog.
WIN32_LEAN_AND_MEAN doesn't really help. Or at least not in all VC versions. I
use MSVC 2008 and <wingdi.h> is included in <windows.h> out of the
"WIN32_LEAN_AND_MEAN" section so, the only thing that works is NOGDI.
For reducing further confusing I propose adding the following section in
log_severity.h (just before declaring severity constants):
#ifdef _WIN32
#ifdef ERROR
// If you see this warning then you included <windows.h> which tries to defines
ERROR macro. To
// avoid odd and unstable compile errors define a project wide macro NOGDI.
//
// Or if you plan using GDI at the very first line of the project add the
following code:
//
//#include <windows.h>
//#undef ERROR
//#undef RGN_ERROR
//#define RGN_ERROR 0
#define STRING2(x) #x
#define STRING(x) STRING2(x)
#pragma message (__FILE__ "(" STRING(__LINE__) ") : error: ERROR name has
already been defined")
#undef ERROR
#endif /* ERROR */
#endif /* _WIN32 */
This checking will catch the issue and produce nice VC-style error. Though, if
one include windows.h after the logging.h there still be a problem. It probably
makes sense to force definition of NOGDI right after the checking.
Original comment by [email protected]
on 8 Nov 2011 at 7:19
from google-glog.
Cam on
Original comment by [email protected]
on 19 May 2015 at 10:32
from google-glog.
Related Issues (20)
- Cannot Build Google-GLog on Visual Studio 2013 HOT 2
- Warning Reduction... HOT 1
- -lexecinfo is needed for backtrace() on FreeBSD HOT 1
- in VS2008 release case, the process crashed when glog output int,long and so on(numerical var)
- Error compiling glog-0.3.3
- unused parameters in mock-log.h
- Link Error while making gLog (recompile with -fIPC)
- .
- make: *** [logging_unittest-logging_unittest.o] Error 1
- Cannot compile on Linux gcc 4.8.1 HOT 1
- vector size() incompatability
- Glog‘s all functions are worked but InstallFailureSignalHandler() Linking failed in vs2010 HOT 2
- Add LOG_EVERY_N_SECS
- V0.3.3 build error under VS 2013 (v120)
- Demangle failed
- Process sleeps forever in FailureSignalHandler it is interrupted by another signal.
- -fPIC issue
- Symbolize can't handler address of plt
- OSX Make Error issue
- Question: how to get log file name?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from google-glog.