我正在尝试在 Visual C++ 6.0 中编译一些旧代码。缺少 DSW 文件,因此我将所有代码添加到新工作区中。
我有a.cpp
如下
#include "vld.h"
#include "afx.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <iostream>
#include "b.h"
...
void function_1(char* string1)
{
char buf[2000];
strcpy_s(&buf[0], 2000, string1);
strcat_s(&buf[0], 2000, "_append");
...
}
还使用了其他功能,例如fopen_s, strncpy_s, strncat_s
in a.cpp
。
并且b.h
是
#include <stdio.h>
#include <string.h>
char function_2(unsigned char * string2, int abc, int def)
{
char buf2[200];
sprintf_s(buf2, 200, "abcdef");
strcat_s(buf2, 200, "ghijkl");
}
尽管已经有了stdio.h
and string.h
,我仍然得到错误
'sprintf_s': undeclared identifier
'strcat_s': undeclared identifier
'strcpy_s': undeclared identifier
'fopen_s': undeclared identifier
'strncpy_s': undeclared identifier
'strncat_s': undeclared identifier
对于a.cpp
和b.h
。
有没有我遗漏的设置?为什么我会收到这些错误?