gpt4 book ai didi

c++ - 更改编码后项目未构建

转载 作者:行者123 更新时间:2023-11-30 05:40:42 24 4
gpt4 key购买 nike

所以,当我正在处理我的项目时,visual studio 突然警告我我的行结尾不一致。然后它询问我是否要重新编码项目中的文件。我单击是并选择了“unicode”选项。

在那之后我无法再构建我的项目,它给出的错误非常抽象。

它基本上说有 3 个未解析的符号,代码为 LNK2019

我真的迷路了,因为我没有更改任何会导致它崩溃的代码。我浏览消息的速度也非常快,所以我无法阅读太多内容。

在项目属性中,字符集是Use Unicode Character Set。语言扩展选项也没有被禁用。

Error   1   error LNK2019: unresolved external symbol "public: __thiscall lh::Heightmap::Heightmap(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,int,int,int)" (??0Heightmap@lh@@QAE@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@HHH@Z) referenced in function "public: __thiscall Teste::Teste(int,int,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,float)" (??0Teste@@QAE@HHV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@M@Z) C:\Users\Leonardo\documents\visual studio 2013\Projects\lhengine\lhengine\teste.obj lhengine
Error 2 error LNK2019: unresolved external symbol "public: __thiscall lh::Heightmap::~Heightmap(void)" (??1Heightmap@lh@@QAE@XZ) referenced in function __unwindfunclet$??0Teste@@QAE@HHV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@M@Z$7 C:\Users\Leonardo\documents\visual studio 2013\Projects\lhengine\lhengine\teste.obj lhengine
Error 3 error LNK2019: unresolved external symbol "public: void __thiscall lh::Heightmap::draw(void)" (?draw@Heightmap@lh@@QAEXXZ) referenced in function "private: virtual void __thiscall Teste::render(void)" (?render@Teste@@EAEXXZ) C:\Users\Leonardo\documents\visual studio 2013\Projects\lhengine\lhengine\teste.obj lhengine
Error 4 error LNK1120: 3 unresolved externals C:\Users\Leonardo\documents\visual studio 2013\Projects\lhengine\Debug\lhengine.exe lhengine

据我所知,它是在提示 std::string 和带有 char 的东西,但我不知道该怎么做。我保存了文件,现在它也向我显示此警告:

warning C4067: unexpected tokens following preprocessor directive - expected a newline  c:\users\leonardo\documents\visual studio 2013\projects\lhengine\lhengine\heightmap.cpp 1   1   lhengine

最佳答案

我设法发现了错误。基本上,visual studio 使用 UTF8 编码保存文件,但行结尾为 Unicode Line Separator (LS)

出于某种原因 VS 无法识别此行结尾。为了让它再次工作,我重新保存了文件。 Save File as...>> Save with encoding... 行结尾 Windows (CR LF)

关于c++ - 更改编码后项目未构建,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31506731/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com