Comments (9)
Will look into this issue after releasing 0.2.
Original comment by [email protected]
on 23 Jan 2009 at 7:41
- Changed state: Accepted
from google-glog.
I vote for this too! All new projects in VS9 are anyways have unicode on with
the
character type (TCHAR/wchar_t)
Original comment by [email protected]
on 10 Jun 2009 at 4:50
from google-glog.
Maybe you can just add a header file whose content is
#ifndef WCHAR_LOGGING_H_
#define WCHAR_LOGGING_H_
#include <wchar.h>
#include <iostream>
#include <string>
std::ostream& operator<<(std::ostream& out, const wchar_t* str) {
size_t len = wcsrtombs(NULL, &str, 0, NULL);
char* buf = (char*)malloc(len + 1);
buf[len] = 0;
wcsrtombs(buf, &str, len, NULL);
out << buf;
free(buf);
return out;
}
std::ostream& operator<<(std::ostream& out, const std::wstring& str) {
return operator<<(out, str.c_str());
}
#endif // WCHAR_LOGGING_H_
or something for this? If you think it's useful, I'll add this header file into
glog's package.
Original comment by [email protected]
on 30 Jul 2009 at 8:03
from google-glog.
i've tried to use this header in my qt project and get linker error:
CMakeFiles/test.dir/myerror.cpp.o: In function
`operator<<(std::basic_ostream<char,
std::char_traits<char> >&, wchar_t const*)':
/opt/google/include/glog/logging.h:1093: multiple definition of
`operator<<(std::basic_ostream<char, std::char_traits<char> >&, wchar_t const*)'
CMakeFiles/test.dir/xmlcheckthread.cpp.o:/usr/include/QtCore/qglobal.h:1499:
first
defined here
CMakeFiles/test.dir/myerror.cpp.o: In function
`operator<<(std::basic_ostream<char,
std::char_traits<char> >&, std::basic_string<wchar_t, std::char_traits<wchar_t>,
std::allocator<wchar_t> > const&)':
/home/aeon/projects/shalficky/qt_client/wchar_log.h:19: multiple definition of
`operator<<(std::basic_ostream<char, std::char_traits<char> >&,
std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >
const&)'
CMakeFiles/test.dir/xmlcheckthread.cpp.o:/home/aeon/projects/shalficky/qt_client
/wchar_log.h:19:
first defined here
including header in logging.h gives me same result.
is there any way to resolve this problem?
Original comment by [email protected]
on 22 Jan 2010 at 5:21
from google-glog.
Ah, I think I forgot to add "inline" for the two operators.
#ifndef WCHAR_LOGGING_H_
#define WCHAR_LOGGING_H_
#include <wchar.h>
#include <iostream>
#include <string>
inline std::ostream& operator<<(std::ostream& out, const wchar_t* str) {
size_t len = wcsrtombs(NULL, &str, 0, NULL);
char* buf = (char*)malloc(len + 1);
buf[len] = 0;
wcsrtombs(buf, &str, len, NULL);
out << buf;
free(buf);
return out;
}
inline std::ostream& operator<<(std::ostream& out, const std::wstring& str) {
return operator<<(out, str.c_str());
}
#endif // WCHAR_LOGGING_H_
Please let me know if this doesn't solve your issue.
Original comment by [email protected]
on 28 Jan 2010 at 10:40
from google-glog.
Issue 29 has been merged into this issue.
Original comment by [email protected]
on 27 May 2010 at 8:36
from google-glog.
Ok,I try this bug-fix in my vs2008 sp1 project, and it works. well done!
Original comment by [email protected]
on 1 Jul 2010 at 11:54
from google-glog.
why not merge this in the project?
Original comment by [email protected]
on 1 Jul 2010 at 11:55
from google-glog.
I got a simmilar problem, with operator ==
The code suggested doesn't fix my problem...
When will google test support wchar/wstring?
I'm using VS2012 ultimate.
Original comment by [email protected]
on 1 Nov 2013 at 4:22
from google-glog.
Related Issues (20)
- Cannot Build Google-GLog on Visual Studio 2013 HOT 2
- Warning Reduction... HOT 2
- -lexecinfo is needed for backtrace() on FreeBSD
- 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
- vector size() incompatability
- Glog‘s all functions are worked but InstallFailureSignalHandler() Linking failed in vs2010 HOT 1
- 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.