gitfredy / google-glog

Automatically exported from code.google.com/p/google-glog
Other
0 stars 0 forks source link

Warnings when compiling under Windows #99

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Use Visual Studio 2008. I think any other version is good too but I use the 
one.
2. Donwload and build gflags.
3. Add gflags to linker paths and add the library to input.
4. Activate use of gflags by modyfing windows/confing.h: #define 
HAVE_LIB_GFLAGS 1
5. Build glog and get lots of warnings like: "inconsistent dll linkage" (in 
build) and "locally defined symbol XXXX imported" (in linking).

What is the expected output? What do you see instead?
No warnings. Many projects consider warnings as errors and this is the true way.

What version of the product are you using? On what operating system?
Trunk at Sep 15, 2011. Windows 7. MSVC 2008.

Please provide any additional information below.
Problem happens because of logging.h declares all the flags used in the logging 
system. As a result same symbolы get delcared both as dllimport and dllexport. 
It's nice to have all the flags explained in header file but most of them are 
only needed by the system itself, just comments would be enough. Thouse who 
want turning logging from their modules could declare the flags explicitly.

I removed "inconsistent dll linkage" warning by by commenting out all the flags 
in logging.h and doing DECLARE in logging.cc. I can release them if anyone say 
how to do that (I'm new in code.google).

IMO, header files must not forward declare flags, every module should 
explicitly declare flags it uses. Flags have global namespace and this makes 
troubles sometimes, let's avoid "headers hell" at least.

Original issue reported on code.google.com by rea...@gmail.com on 17 Sep 2011 at 8:09