// 5.1.cpp : 定义控制台应用程序的入口点。
//#include "stdafx.h"
#include"5.h"#pragma comment(lib,"5.lib")int _tmain(int argc, _TCHAR* argv[])
{ int i=add(7,8);
printf_s(_T("7+8=%d\n"),i); return 0;
}这里为什么不好用cout语句呢,我习惯用VC++6.0,VC++7.0还很生疏。
我用教程里的printf_s(_T("7+8=%d\n"),i);来输出add结果,却被VS2005报错,错误结果如下:
1>------ 已启动生成: 项目: 5.1, 配置: Debug Win32 ------
1>正在编译...
1>5.1.cpp
1>c:\documents and settings\czx\my documents\visual studio 2005\projects\5\5.1\5.1.cpp(11) : error C2664: 'printf_s' : cannot convert parameter 1 from 'const wchar_t [8]' to 'const char *'
1>        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>生成日志保存在“file://c:\Documents and Settings\czx\My Documents\Visual Studio 2005\Projects\5\5.1\Debug\BuildLog.htm”
1>5.1 - 1 个错误,0 个警告
========== 生成: 0 已成功, 1 已失败, 0 最新, 0 已跳过 ==========