作者Kanyahi (狼爵々)
看板C_and_CPP
标题[问题] C++ 编译时遇到的变数转换错误
时间Tue Apr 26 17:50:42 2016
开发平台(Platform): (Ex: VC++, GCC, Linux, ...)
VC++ 6.0
额外使用到的函数库(Library Used): (Ex: OpenGL, ...)
已经载入下列函数库
#include <sstream>
#include <iostream>
#include <string>
#include <stdio.h>
#include "windows.h"
#include "mq.h"
#include "tchar.h"
#include "wchar.h"
问题(Question):
原始码是从VS2010复制过来的
在VS2010可以正常编译
但在VC++ 6.0编译发生以下错误讯息
已上网查过必要载入函数库
并没有解决,
不知道是还有其他函数库没有载入
还是环境配置上要设定
程式码(Code):(请善用置底文网页, 记得排版)
http://codepad.org/QgClsAco
显示56行 error C2065: '_snwprintf_s' : undeclared identifier
http://codepad.org/kZFqZ1IV
显示6行 error C2065: 'CT2CA' : undeclared identifier
补充说明(Supplement):
还请各位先进不吝指教,谢谢
如果有违背版规的地方,请告知,会立即修改
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 60.248.200.131
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/C_and_CPP/M.1461664246.A.AF9.html
※ 编辑: Kanyahi (60.248.200.131), 04/26/2016 17:51:39
1F:→ kiedveian: #include <windows.h> ? 04/26 21:05
第一个code是send MSMQ
所以会用到windows.h 所以才加入
在想会不会是因为大小写的关系?
※ 编辑: Kanyahi (220.129.51.245), 04/26/2016 21:51:28
2F:→ james732: google找那两个东西,应该能找到需要加入哪些.h档吧? 04/26 22:34
3F:推 TeaEEE: 这二个应该是uni-code,Vc6有支援uni-code吗? 04/27 13:03
4F:→ colako: VC6没_s,试试改用_snwprintf,不输入dwBufferLength? 04/27 13:50
5F:→ colako: 没有CT2CA macro...就自己想别的办法转喽? 04/27 13:51
CT2CA 我有想到可能是因为VC6没支援的关系 所以已经改了
改成_snwprintf有出现
cannot convert parameter 3 from 'unsigned long' to 'const unsigned short *'
把原本的第二个参数dwBufferLength删掉就可以了
感谢回覆的几位先进帮忙
※ 编辑: Kanyahi (60.248.200.131), 04/27/2016 14:34:52