Re: Issue 4 in google-glog: wchar_t support

閲覧: 118 回
最初の未読メッセージにスキップ

codesite...@google.com

未読、
2010/01/22 0:21:512010/01/22
To: googl...@googlegroups.com

Comment #4 on issue 4 by Ponimaskin: wchar_t support
http://code.google.com/p/google-glog/issues/detail?id=4

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?

--
You received this message because you are listed in the owner
or CC fields of this issue, or because you starred this issue.
You may adjust your issue notification preferences at:
http://code.google.com/hosting/settings

codesite...@google.com

未読、
2010/01/28 5:40:282010/01/28
To: googl...@googlegroups.com

Comment #5 on issue 4 by shinichiro.hamaji: wchar_t support
http://code.google.com/p/google-glog/issues/detail?id=4

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.

codesite...@google.com

未読、
2010/05/27 4:41:412010/05/27
To: googl...@googlegroups.com

Comment #6 on issue 4 by shinichiro.hamaji: wchar_t support
http://code.google.com/p/google-glog/issues/detail?id=4

Issue 29 has been merged into this issue.

codesite...@google.com

未読、
2010/07/01 7:55:432010/07/01
To: googl...@googlegroups.com

Comment #7 on issue 4 by hurricane1026: wchar_t support
http://code.google.com/p/google-glog/issues/detail?id=4

Ok,I try this bug-fix in my vs2008 sp1 project, and it works. well done!

codesite...@google.com

未読、
2010/07/01 7:59:472010/07/01
To: googl...@googlegroups.com

Comment #8 on issue 4 by hurricane1026: wchar_t support
http://code.google.com/p/google-glog/issues/detail?id=4

why not merge this in the project?

codesite...@google.com

未読、
2013/11/01 12:22:302013/11/01
To: googl...@googlegroups.com

Comment #9 on issue 4 by leoalves...@gmail.com: wchar_t support
http://code.google.com/p/google-glog/issues/detail?id=4

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.

--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

Qingze Wang

未読、
2015/10/15 4:09:072015/10/15
To: google-glog
I add this code to my project using g++ fedora, but it doese not work, why??

在 2010年1月28日星期四 UTC+8下午6:40:28,codesite...@google.com写道:
全員に返信
投稿者に返信
転送
新着メール 0 件