[Solved] target_link_libraries error: a missing vtable usually means the first non-inline virtual member function has no definition.

target_link_libraries error:

When compiling a project with cmake, the following appears:

NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.

Cmake:

target_link_libraries(target target1 target2)

In this way, Target1 and target2 libraries need to be used when linking target. However, if Target1 also uses target2, you need to add additional:

target_link_libraries(target1 target2)

Otherwise, when the link generates Target1, you can’t find anything in target2. If target uses Target1 link again, it will definitely report an error.

Read More: