编译时出现如下错误:
Compiling...
StdAfx.cpp
e:\setup\test\common\glog.h(39) : error C2440: 'default argument' : cannot convert from 'char [1]' to 'const unsigned short *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
e:\setup\test\common\glog.h(39) : error C2440: 'default argument' : cannot convert from 'char [2]' to 'const unsigned short *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
e:\setup\test\common\glog.h(39) : error C2440: 'default argument' : cannot convert from 'char [3]' to 'const unsigned short *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
e:\setup\test\common\glog.h(39) : error C2440: 'default argument' : cannot convert from 'char [1]' to 'const unsigned short *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
e:\setup\test\common\glog.h(39) : error C2548: 'CGLog::CGLog' : missing default parameter for parameter 3
e:\setup\test\common\glog.h(39) : error C2548: 'CGLog::CGLog' : missing default parameter for parameter 4
e:\setup\test\common\glog.h(39) : error C2548: 'CGLog::CGLog' : missing default parameter for parameter 5
e:\setup\test\common\glog.h(39) : error C2548: 'CGLog::CGLog' : missing default parameter for parameter 6
e:\setup\test\test\stdafx.cpp(7) : error C2661: 'CGLog::CGLog' : no overloaded function takes 2 parameters
Error executing cl.exe.Test.exe - 9 error(s), 0 warning(s)错误行内容为:
CGLog(LPCTSTR p_lptPath, LPCTSTR p_lptFile, LPCTSTR p_lptModule = "", LPCTSTR p_lptOutLevel = "0", LPCTSTR p_lptLinesToFile = "50", LPCTSTR p_lptClearState = "");

解决方案 »

  1.   

    你用了Unicode吧,先把字符串转为Unicode再传进去。
      

  2.   

    可能是用了Unicode的编译方式。
    你可以不使用 Unicode的编译方式, 改为:
    菜单:Build->Set Active Configuration->在弹出的对话框中选择 Win32 Debug 的一项
      

  3.   

    前面是类型传递错误,VC下char 和const char被认为是不同的类型。
    后面CGLog是重载问题。
      

  4.   

    你将CGLog(LPCTSTR p_lptPath, LPCTSTR p_lptFile, LPCTSTR p_lptModule = "", LPCTSTR p_lptOutLevel = "0", LPCTSTR p_lptLinesToFile = "50", LPCTSTR p_lptClearState = "");
    改为:CGLog(LPCTSTR p_lptPath, LPCTSTR p_lptFile, LPTSTR p_lptModule = "", LPTSTR p_lptOutLevel = "0", LPTSTR p_lptLinesToFile = "50", LPTSTR p_lptClearState = "");
    再看看。