【问题标题】:AnsiString does not work (AnsiString identifier is not defined)AnsiString 不起作用(未定义 AnsiString 标识符)
【发布时间】:2020-12-09 06:25:09
【问题描述】:

代码如下:

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>

【问题讨论】:

  • AnsiString 是 Borland/Embarcadero C++Builder 特定的类。你有合适的环境、合适的工具和合适的#include 头文件吗?

标签: c++ ansi converters shellexecute


【解决方案1】:

AnsiString 是特定于 C++Builder 编译器的字符串类。如果您正在使用该编译器,请确保您在编译项目时启用了 C++Builder 的 VCL(可视组件库)或 FMX(FireMonkey)框架,并且您的 C++ 中有相应的 #include &lt;vcl.h&gt;#include &lt;fmx.h&gt; 语句代码。

否则,如果您使用任何其他编译器,则应使用标准 C++ std::string 类(也可以在 C++Builder 中使用),例如:

#include <string>

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-03-16
    • 1970-01-01
    • 2018-10-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-02-07
    相关资源
    最近更新 更多