添加了cspreadsheet头文件之后,编译不通过。
怎么搞的,是不是宽字符的原因阿?
迷惑
部分错误提示如下:
1>24Channel2Dlg.cpp
1>c:\documents and settings\lenovo\my documents\visual studio 2005\projects\24channel2\24channel2\cspreadsheet.h(198) : warning C4244: '=' : conversion from 'INT_PTR' to 'short', possible loss of data
1>c:\documents and settings\lenovo\my documents\visual studio 2005\projects\24channel2\24channel2\cspreadsheet.h(206) : warning C4244: '=' : conversion from 'INT_PTR' to 'short', possible loss of data
1>c:\documents and settings\lenovo\my documents\visual studio 2005\projects\24channel2\24channel2\cspreadsheet.h(257) : error C2664: 'void ATL::CStringT<BaseType,StringTraits>::Format(const wchar_t *,...)' : cannot convert parameter 1 from 'const char [14]' to 'const wchar_t *'
1> with
1> [
1> BaseType=wchar_t,
1> StringTraits=StrTraitMFC_DLL<wchar_t>
1> ]
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>c:\documents and settings\lenovo\my documents\visual studio 2005\projects\24channel2\24channel2\cspreadsheet.h(310) : warning C4244: '=' : conversion from 'INT_PTR' to 'short', possible loss of data
1>c:\documents and settings\lenovo\my documents\visual studio 2005\projects\24channel2\24channel2\cspreadsheet.h(342) : warning C4244: '=' : conversion from 'INT_PTR' to 'short', possible loss of data
1>c:\documents and settings\lenovo\my documents\visual studio 2005\projects\24channel2\24channel2\cspreadsheet.h(352) : warning C4129: 'L' : unrecognized character escape sequence
1>c:\documents and settings\lenovo\my documents\visual studio 2005\projects\24channel2\24channel2\cspreadsheet.h(352) : error C2001: newline in constant
8 个解决方案
#1
看錯誤的提示好像是
全部用_T("")形式並加上_UNICODE宏
或直接用L""看看
全部用_T("")形式並加上_UNICODE宏
或直接用L""看看
#2
是的,最好贴出那几行代码。
#3
196 if (m_atempArray.GetSize() > m_dTotalColumns)
197 {
198 m_dTotalColumns = m_atempArray.GetSize();
199 }
206 m_dTotalColumns = FieldNames.GetSize();
257 m_stempSql.Format ("DROP TABLE %s", SheetName);
310 m_dTotalColumns = RowValues.GetSize();
if (RowValues.GetSize() > m_dTotalColumns)
{
342 m_dTotalColumns = RowValues.GetSize();
}
352 m_stempSql.Format(L"\"%s\L"%s", RowValues.GetAt(i), m_sSeparator);
197 {
198 m_dTotalColumns = m_atempArray.GetSize();
199 }
206 m_dTotalColumns = FieldNames.GetSize();
257 m_stempSql.Format ("DROP TABLE %s", SheetName);
310 m_dTotalColumns = RowValues.GetSize();
if (RowValues.GetSize() > m_dTotalColumns)
{
342 m_dTotalColumns = RowValues.GetSize();
}
352 m_stempSql.Format(L"\"%s\L"%s", RowValues.GetAt(i), m_sSeparator);
#4
另外,还有一个情况是,同样的cspreadsheet头文件,放在徐景周写的excel操作程序里,没有任何问题!
真的是看不出来,该怎么办~
真的是看不出来,该怎么办~
#5
问题解决!
首先解决UNICODE问题,全部添加L
----------
其次,
出现问题:
error C2664: 'SQLGetInstalledDriversW ' : cannot convert parameter 1 from 'char [2001] ' to 'LPWSTR '
SQLGetInstalledDrivers(szBuf,cbBufMax,& cbBufOut)
SQLGetInstalledDriversW的参数1需要宽字符,
修正它!
把
char szBuf[2001];
char *pszBuf = szBuf;
改为
wchar_t szBuf[2001];
wchar_t *pszBuf = szBuf;
+++++++++++++++++++++++
参考文献:
char转换成LPWSTR的小问题??
http://topic.csdn.net/u/20070422/17/80f22eb8-c0f2-4313-b191-e86b60ef2f5b.html
---------
再次,
出现问题:
error C2665: 'strstr' : none of the 2 overloads could convert all the argument types
把strstr改写成_tcsstr
+++++++++++++++++++++++
参考文献
今天很高兴,又解决了一个问题,感谢牛牛们
http://blog.csdn.net/ehfaafzv/archive/2006/09/20/1253120.aspx
++++++++++++++++++++++
同时会出现问题:
error C2665: 'strchr' : none of the 2 overloads could convert all the argument types
把strchr改写成wcschr
+++++++++++++++++++++++
参考文献
Unicode and find exceldriver
http://www.codeguru.com/forum/showthread.php?threadid=433263
over!
首先解决UNICODE问题,全部添加L
----------
其次,
出现问题:
error C2664: 'SQLGetInstalledDriversW ' : cannot convert parameter 1 from 'char [2001] ' to 'LPWSTR '
SQLGetInstalledDrivers(szBuf,cbBufMax,& cbBufOut)
SQLGetInstalledDriversW的参数1需要宽字符,
修正它!
把
char szBuf[2001];
char *pszBuf = szBuf;
改为
wchar_t szBuf[2001];
wchar_t *pszBuf = szBuf;
+++++++++++++++++++++++
参考文献:
char转换成LPWSTR的小问题??
http://topic.csdn.net/u/20070422/17/80f22eb8-c0f2-4313-b191-e86b60ef2f5b.html
---------
再次,
出现问题:
error C2665: 'strstr' : none of the 2 overloads could convert all the argument types
把strstr改写成_tcsstr
+++++++++++++++++++++++
参考文献
今天很高兴,又解决了一个问题,感谢牛牛们
http://blog.csdn.net/ehfaafzv/archive/2006/09/20/1253120.aspx
++++++++++++++++++++++
同时会出现问题:
error C2665: 'strchr' : none of the 2 overloads could convert all the argument types
把strchr改写成wcschr
+++++++++++++++++++++++
参考文献
Unicode and find exceldriver
http://www.codeguru.com/forum/showthread.php?threadid=433263
over!
#6
小弟也遇到了这个问题,感谢你的帖子,问题解决了~~~
#7
太有用了,嘻嘻
#8
想求一个在VS2005上没有错误的CSpreadSheet.h,看了您的帖子,想要一份可以吗?我的邮箱是:1214318641@qq.com
多谢!!!!!!!!!
多谢!!!!!!!!!
#1
看錯誤的提示好像是
全部用_T("")形式並加上_UNICODE宏
或直接用L""看看
全部用_T("")形式並加上_UNICODE宏
或直接用L""看看
#2
是的,最好贴出那几行代码。
#3
196 if (m_atempArray.GetSize() > m_dTotalColumns)
197 {
198 m_dTotalColumns = m_atempArray.GetSize();
199 }
206 m_dTotalColumns = FieldNames.GetSize();
257 m_stempSql.Format ("DROP TABLE %s", SheetName);
310 m_dTotalColumns = RowValues.GetSize();
if (RowValues.GetSize() > m_dTotalColumns)
{
342 m_dTotalColumns = RowValues.GetSize();
}
352 m_stempSql.Format(L"\"%s\L"%s", RowValues.GetAt(i), m_sSeparator);
197 {
198 m_dTotalColumns = m_atempArray.GetSize();
199 }
206 m_dTotalColumns = FieldNames.GetSize();
257 m_stempSql.Format ("DROP TABLE %s", SheetName);
310 m_dTotalColumns = RowValues.GetSize();
if (RowValues.GetSize() > m_dTotalColumns)
{
342 m_dTotalColumns = RowValues.GetSize();
}
352 m_stempSql.Format(L"\"%s\L"%s", RowValues.GetAt(i), m_sSeparator);
#4
另外,还有一个情况是,同样的cspreadsheet头文件,放在徐景周写的excel操作程序里,没有任何问题!
真的是看不出来,该怎么办~
真的是看不出来,该怎么办~
#5
问题解决!
首先解决UNICODE问题,全部添加L
----------
其次,
出现问题:
error C2664: 'SQLGetInstalledDriversW ' : cannot convert parameter 1 from 'char [2001] ' to 'LPWSTR '
SQLGetInstalledDrivers(szBuf,cbBufMax,& cbBufOut)
SQLGetInstalledDriversW的参数1需要宽字符,
修正它!
把
char szBuf[2001];
char *pszBuf = szBuf;
改为
wchar_t szBuf[2001];
wchar_t *pszBuf = szBuf;
+++++++++++++++++++++++
参考文献:
char转换成LPWSTR的小问题??
http://topic.csdn.net/u/20070422/17/80f22eb8-c0f2-4313-b191-e86b60ef2f5b.html
---------
再次,
出现问题:
error C2665: 'strstr' : none of the 2 overloads could convert all the argument types
把strstr改写成_tcsstr
+++++++++++++++++++++++
参考文献
今天很高兴,又解决了一个问题,感谢牛牛们
http://blog.csdn.net/ehfaafzv/archive/2006/09/20/1253120.aspx
++++++++++++++++++++++
同时会出现问题:
error C2665: 'strchr' : none of the 2 overloads could convert all the argument types
把strchr改写成wcschr
+++++++++++++++++++++++
参考文献
Unicode and find exceldriver
http://www.codeguru.com/forum/showthread.php?threadid=433263
over!
首先解决UNICODE问题,全部添加L
----------
其次,
出现问题:
error C2664: 'SQLGetInstalledDriversW ' : cannot convert parameter 1 from 'char [2001] ' to 'LPWSTR '
SQLGetInstalledDrivers(szBuf,cbBufMax,& cbBufOut)
SQLGetInstalledDriversW的参数1需要宽字符,
修正它!
把
char szBuf[2001];
char *pszBuf = szBuf;
改为
wchar_t szBuf[2001];
wchar_t *pszBuf = szBuf;
+++++++++++++++++++++++
参考文献:
char转换成LPWSTR的小问题??
http://topic.csdn.net/u/20070422/17/80f22eb8-c0f2-4313-b191-e86b60ef2f5b.html
---------
再次,
出现问题:
error C2665: 'strstr' : none of the 2 overloads could convert all the argument types
把strstr改写成_tcsstr
+++++++++++++++++++++++
参考文献
今天很高兴,又解决了一个问题,感谢牛牛们
http://blog.csdn.net/ehfaafzv/archive/2006/09/20/1253120.aspx
++++++++++++++++++++++
同时会出现问题:
error C2665: 'strchr' : none of the 2 overloads could convert all the argument types
把strchr改写成wcschr
+++++++++++++++++++++++
参考文献
Unicode and find exceldriver
http://www.codeguru.com/forum/showthread.php?threadid=433263
over!
#6
小弟也遇到了这个问题,感谢你的帖子,问题解决了~~~
#7
太有用了,嘻嘻
#8
想求一个在VS2005上没有错误的CSpreadSheet.h,看了您的帖子,想要一份可以吗?我的邮箱是:1214318641@qq.com
多谢!!!!!!!!!
多谢!!!!!!!!!