Unresolved external in .obj files concerning FreeType library class destructors T::~T

末鹿安然 提交于 2020-01-06 16:22:57

问题


After having solved in a more or less good manner this problem : How to update a Borland 6 C++ Project from including indy.bpi to indy60.bpi?

... I now meet another difficulty : I now have "unresolved external" destuctors in .obj files : I have allready seen this error before : it seems to be a question of virtual destuctors that should be implemented with nothing : T::~T() { } ; (or = null;)

The problem is that the concerned destructors are in the FreeType Library. I therefore suppose it to be well-written and am reluctant to modify its destructors ...

=> Anybody knows about problems with unresolved external on destructors in .obj files while compiling FreeType Library ?


回答1:


I have not worked with FreeType yet, but I guess the destructors are defined directly inside the class declaration. This means they are implicitly declared as inline. Depending on your compiler, this will prevent the destructors from being included with external linkage in any of the library files generated.

What to do now:

  • check whether you have missed any of the necessary libraries for FreeType. On Unix-like OSes, you can check with nm if the destructors code is included in a library file using the 'nm' command (refer to the man page).

  • Check the FreeType documentation whether this is a known issue or a newer version exists

  • Change the header files containing these classes, make the destructors non-inline and move their definitions to a separate file:

    class A { ... virtual ~A() {} }

becomes

class A {
  ...
  virtual ~A();
}

and in a seperate file provide this:

A::~A() {}


来源:https://stackoverflow.com/questions/5118115/unresolved-external-in-obj-files-concerning-freetype-library-class-destructors

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!