Visual Studio“项目+项目”问题

所以我在Visual Studio上遇到了一些问题

这是我当前的问题

const char* Char1 = "Foo ";
const char* Char2 = "Bar ";
const char* Char3 = Char1 + Char2;
/*                        ^ 
This is where the error is coming
Here the error I'm getting

expression must have integral or unscoped enum type
*/

这是用于字符串,并且ImVec <-(ImGui)。我的朋友告诉我,我的项目配置错误。但是我不知道我在做什么错。

某些天才可以帮助我吗?

忘记添加我正在使用Visual Studio 2019

编辑:有人问我试图在这里做什么

        void newStyle(const char* name) {
            const char* path = "./Assets/Styles/" + name + ".style";
            std::ofstream file(path);
            std::string data("STYLE (WIP)");
            file << data;
        }
艾克桑·哈克维迪利(Ayxan Haqverdili)

您不能在C ++中添加两个指针。我建议你用std::string

在C ++ 20中:

#include <string_view>
#include <format>

void newStyle(std::string_view const name) { // note string view
  auto path = std::format("./Assets/Styles/{}.style", name);
  // ...
}

大多数编译器尚不支持std::format同时,您可以使用{fmt}库:

#include <string_view>
#include <fmt/core.h>

void newStyle(std::string_view const name) {
  auto path = fmt::format("./Assets/Styles/{}.style", name);
  // ...
}

也考虑一下std::filesystem::path

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章