c++ AnsiString不起作用(未定义AnsiString标识符)

hm2xizp9  于 2023-04-08  发布在  其他
关注(0)|答案(1)|浏览(153)

代码如下:

AnsiString path = "BrowserBot.exe";
ShellExecute(0, TEXT("open"), path.c_str(), TEXT("-parametr"), 0, SW_SHOW);

写一个错误,没有定义AnsiString标识符。我不知道问题是什么。
所有连接的库:

#include <iostream>
#include <conio.h>
#include <Windows.h>
#include <fstream>
#include <sstream>
k10s72fa

k10s72fa1#

AnsiString是特定于CBuilder编译器的字符串类。如果您正在使用该编译器,请确保在编译项目时启用了CBuilder的VCL(Visual Component Library)或FMX(FireMonkey)框架,并且在C代码中具有相应的#include <vcl.h>#include <fmx.h>语句。
否则,如果你使用任何其他编译器,你应该使用标准的C
std::string类(也可以在C++Builder中使用),例如:

#include <string>

std::string path = "BrowserBot.exe";
ShellExecuteA(0, "open", path.c_str(), "-parametr", 0, SW_SHOW);

相关问题