更改编码后未生成项目

Project does not build after changing encoding

本文关键字:项目 未生 编码      更新时间:2023-10-16

所以,我正在处理我的项目,突然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:UsersLeonardodocumentsvisual studio 2013Projectslhenginelhengineteste.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:UsersLeonardodocumentsvisual studio 2013Projectslhenginelhengineteste.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:UsersLeonardodocumentsvisual studio 2013Projectslhenginelhengineteste.obj lhengine
Error   4   error LNK1120: 3 unresolved externals   C:UsersLeonardodocumentsvisual studio 2013ProjectslhengineDebuglhengine.exe lhengine

据我所知,它在抱怨std::string和一些带有char的东西,但我不知道该怎么办。我保存了这些文件,现在它也向我显示了这个警告:

warning C4067: unexpected tokens following preprocessor directive - expected a newline  c:usersleonardodocumentsvisual studio 2013projectslhenginelhengineheightmap.cpp 1   1   lhengine

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

由于某种原因,VS无法识别这一行的结尾。为了让它再次工作,我重新保存了文件。具有以CCD_ 5结尾的行的CCD_。