我正在尝试构建一个用于发布的程序,但即使它在调试配置中运行良好,当我使用发布配置时出现此错误:
1>c:\users\owner.ben-pc\documents\visual studio 2010\projects\xsp quick unpacker\xsp quick unpacker\Form1.h(217): error C2664: 'DeleteFile' : cannot convert parameter 1 from 'const char *' to 'LPCTSTR'
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
我尝试根据此线程添加“#define _SECURE_SCL 0”行,但这并没有改变任何东西。
这是引发错误的行所在的程序部分(“DeleteFile(temp);”是引发错误的特定行):
path=this->FilePathBox->Text;
if (!File::Exists(path+"\\filemaker\\start.ini"))
{
FileStream^ fs=File::Create(path+"\\filemaker\\start.ini");
delete fs;
}
else
{
marshal_context^ context=gcnew marshal_context();
String^ filepath=path+"\\filemaker\\start.ini";
const char* temp;
temp=context->marshal_as<const char*>(filepath);
DeleteFile(temp);
delete context;
}
PS我正在使用VS 2010 Premium。