使用FreeType编译时无法解析的外部 [英] Unresolved Externals When Compiling With FreeType

查看:639
本文介绍了使用FreeType编译时无法解析的外部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用FreeType库在Visual Studio 2015中编译程序.以前,我曾使用同一项目使用该库使用我自己的Font类(以及许多其他东西)来编译静态库.一切都很好,课堂上的表现很好.但是,最近我通过将Properties-> General-> Configuration Type更改为Application (.exe),将项目更改为Windows应用程序.这样,我可以同时编写一个程序和编辑代码,而无需复制所有20多个文件.

I am compiling a program in Visual Studio 2015, using the FreeType Library. Before, I had used the same project to compile a static library with my own Font class (and many other things), using the library. All was well, and the class worked great. However, I recently changed the project to a Windows application, by changing Properties->General->Configuration Type to Application (.exe). That way, I could make a program and edit the code at the same time, without copying all of the 20-some files.

在编写了简单的程序(与问题无关)并尝试重新编译后,我遇到了许多以前从未遇到过的错误.它们如下:

After writing my simple program (which is irrelevant to the question), and tried to recompile, I got many errors I didn't get before. They are as follows:

LNK2001无法解析的外部符号__imp__strncpy [...] \ freetype.lib(ftbase.obj)

LNK2001 unresolved external symbol __imp__strncpy [...]\freetype.lib(ftbase.obj)

LNK2001无法解析的外部符号__imp__fread [...] \ freetype.lib(ftsystem.obj)

LNK2001 unresolved external symbol __imp__fread [...]\freetype.lib(ftsystem.obj)

LNK2001无法解析的外部符号__imp__realloc [...] \ freetype.lib(ftsystem.obj)

LNK2001 unresolved external symbol __imp__realloc [...]\freetype.lib(ftsystem.obj)

LNK2001无法解析的外部符号__imp__strstr [...] \ freetype.lib(truetype.obj)

LNK2001 unresolved external symbol __imp__strstr [...]\freetype.lib(truetype.obj)

LNK2001无法解析的外部符号__except_handler4_common [...] \ MSVCRT.lib(_chandler4gs_.obj)

LNK2001 unresolved external symbol __except_handler4_common [...]\MSVCRT.lib(_chandler4gs_.obj)

所有这些方面在网络上似乎都很少,更不用说这个特殊情况了.当我编译为静态库时,一切都很好.之前我已经切换到编译.exe,然后它也可以正常工作.我过去处理过未解决的外部问题,但这似乎莫名其妙.

There seems to be very little on the net about any of these at all, not to mention for this particular case. All was well when I compiled as a static library. I had switched to compiling an .exe before, and it worked fine then too. I have dealt with unresolved externals in the past, but this just seems inexplicable.

我正在与 #pragma comment(lib, "freetype.lib"). freetype.lib存在并且在正确的目录中.

I am linking with #pragma comment(lib, "freetype.lib"). freetype.lib exists and is in the proper directory.

我包括:

#include <ft2build.h>
#include FT_FREETYPE_H

如果有关系,我的程序是C ++,并且我也与其他库建立链接.感谢您的帮助.

If it matters, my program is in C++, and I am linking with other libraries as well. Any help is appreciated.

推荐答案

我找到了一个解决方案:

I found a solution: according to this MSDN page, some unresolved externals can be solved by adding msvcrt.lib and msvcmrt.lib to the additional dependencies. I tried it, and somehow, it worked. I'm still confused as to how this would solve the issue. And, frankly, I'm still not quite sure was the issue actually was. If anyone could help me understand this, it would be greatly appreciated.

注意:
链接配置标志中的不匹配可能导致类似的问题.问题
解决LNK4098:defaultlib'MSVCRT'与冲突提供了一个很好的解释问题详细信息和解决方案.

Note:
Similar issues could be caused by a mistmatch in the linkage configuration flags. Question Resolving LNK4098: defaultlib 'MSVCRT' conflicts with provides a good explanation on the issue details and the solution.

这篇关于使用FreeType编译时无法解析的外部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆