[問題] C++ 編譯時遇到的變數轉換錯誤

看板C_and_CPP作者 (狼爵々)時間8年前 (2016/04/26 17:50), 8年前編輯推噓1(104)
留言5則, 4人參與, 最新討論串1/1
開發平台(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://www.ptt.cc/bbs/C_and_CPP/M.1461664246.A.AF9.html ※ 編輯: Kanyahi (60.248.200.131), 04/26/2016 17:51:39

04/26 21:05, , 1F
#include <windows.h> ?
04/26 21:05, 1F
第一個code是send MSMQ 所以會用到windows.h 所以才加入 在想會不會是因為大小寫的關係? ※ 編輯: Kanyahi (220.129.51.245), 04/26/2016 21:51:28

04/26 22:34, , 2F
google找那兩個東西,應該能找到需要加入哪些.h檔吧?
04/26 22:34, 2F

04/27 13:03, , 3F
這二個應該是uni-code,Vc6有支援uni-code嗎?
04/27 13:03, 3F

04/27 13:50, , 4F
VC6沒_s,試試改用_snwprintf,不輸入dwBufferLength?
04/27 13:50, 4F

04/27 13:51, , 5F
沒有CT2CA macro...就自己想別的辦法轉嘍?
04/27 13:51, 5F
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
文章代碼(AID): #1N7pdshv (C_and_CPP)