【发布时间】:2013-02-06 16:55:42
【问题描述】:
我有一个使用 freetype 库编译得很好的项目。
从那时起,我的操作系统已重新安装,因此 Visual Studio 2010 也已重新安装。
我已重新包含并重新安装了所有 .lib .dll 和头文件。出于某种原因,现在如果我使用发布配置运行程序,它运行得很好。但是,如果我切换到调试配置,它会在 freetype 库函数上给我来自链接器的未解决的外部符号错误。
现在,我确定这两种配置的 C++ 目录是相同的,因为我使用解决方案设置中的所有配置选项卡重新设置了它们。除此之外,两种配置“附加目录/附加依赖项设置”也是如此,以相同的方式设置。
我发现项目文件夹中的发布文件夹和调试文件夹之间的唯一区别是调试文件夹中存在一个名为“vc100.idb”的文件,这是一个最小的重建依赖文件。这看起来很有希望,但删除它没有产生任何结果,所以我把它放回去了。
您对导致配置编译之间出现这种差异的原因有任何想法吗?
最坏的结果,我可以继续在发布配置上进行编程,但我不想继续走这条路,因为我真的很想知道这个问题的根源。
提前致谢,
男人
错误:
1>freetype.obj : error LNK2019: unresolved external symbol _FT_Glyph_To_Bitmap referenced in function "void __cdecl freetype::make_dlist(struct FT_FaceRec_ *,char,unsigned int,unsigned int *)" (?make_dlist@freetype@@YAXPAUFT_FaceRec_@@DIPAI@Z)
1>freetype.obj : error LNK2019: unresolved external symbol _FT_Get_Glyph referenced in function "void __cdecl freetype::make_dlist(struct FT_FaceRec_ *,char,unsigned int,unsigned int *)" (?make_dlist@freetype@@YAXPAUFT_FaceRec_@@DIPAI@Z)
1>freetype.obj : error LNK2019: unresolved external symbol _FT_Load_Glyph referenced in function "void __cdecl freetype::make_dlist(struct FT_FaceRec_ *,char,unsigned int,unsigned int *)" (?make_dlist@freetype@@YAXPAUFT_FaceRec_@@DIPAI@Z)
1>freetype.obj : error LNK2019: unresolved external symbol _FT_Get_Char_Index referenced in function "void __cdecl freetype::make_dlist(struct FT_FaceRec_ *,char,unsigned int,unsigned int *)" (?make_dlist@freetype@@YAXPAUFT_FaceRec_@@DIPAI@Z)
1>freetype.obj : error LNK2019: unresolved external symbol _FT_Done_FreeType referenced in function "public: void __thiscall freetype::font_data::init(char const *,unsigned int)" (?init@font_data@freetype@@QAEXPBDI@Z)
1>freetype.obj : error LNK2019: unresolved external symbol _FT_Done_Face referenced in function "public: void __thiscall freetype::font_data::init(char const *,unsigned int)" (?init@font_data@freetype@@QAEXPBDI@Z)
1>freetype.obj : error LNK2019: unresolved external symbol _FT_Set_Char_Size referenced in function "public: void __thiscall freetype::font_data::init(char const *,unsigned int)" (?init@font_data@freetype@@QAEXPBDI@Z)
1>freetype.obj : error LNK2019: unresolved external symbol _FT_New_Face referenced in function "public: void __thiscall freetype::font_data::init(char const *,unsigned int)" (?init@font_data@freetype@@QAEXPBDI@Z)
1>freetype.obj : error LNK2019: unresolved external symbol _FT_Init_FreeType referenced in function "public: void __thiscall freetype::font_data::init(char const *,unsigned int)" (?init@font_data@freetype@@QAEXPBDI@Z)
编辑:好吧,这很奇怪。我已经从发布配置中的包含和库目录设置以及其他依赖项中删除了 ALL 的 freetype 目录信息。并且发布的配置版本仍然有效!
这让我相信移动我的文件时缺少一些东西(与配置方面相比)。
【问题讨论】:
-
调试配置的链接器设置与发布配置的设置是分开的。因此,一个明显的解释是,您正确地将 freetype .lib 文件添加到链接器的附加依赖项设置中以用于发布配置,但在调试配置中忘记这样做。
-
我在上面解释过。我使用“所有配置”同时设置它们。所以它们是彼此的镜子。我认为发布配置以某种方式“卡住”了。正如对我的问题的编辑所解释的那样。我目前正在将项目复制到一个新的、干净的项目中,其中包含一个新的、干净的解决方案文件。但到目前为止,我无法正确地将任一配置与库链接。
-
配置不会“卡住”。通过在链接器的命令行设置页面中添加 /verbose 选项来检查您的假设。您将在“输出”窗口中看到它查看的每个库的转储。
-
@HansPassant 我听从了你的建议,在扫描了相关库的转储后,我找不到任何对“freetype.lib”的引用,这很奇怪,因为我已经包含了将此文件存放在库目录中。
-
这当然不够。再次阅读我的第一条评论。
标签: c++ visual-studio-2010 dll linker