CMake linking error (undefined reference to)

It could well be the linking order.

It looks like messages_robocup_ssl_wrapper.pb depends on messages_robocup_ssl_geometry.pb. If so, wrapper should come before geometry in the link line.

target_link_libraries( clientTest robocup_ssl_client
                       messages_robocup_ssl_detection.pb
                       messages_robocup_ssl_wrapper.pb
                       messages_robocup_ssl_geometry.pb
                       messages_robocup_ssl_refbox_log.pb
                       netraw
                       robocup_ssl_client
                       protobuf
                       QtCore )

Even better, let CMake take care of dependencies like this.

If you add...

target_link_libraries( messages_robocup_ssl_wrapper.pb
                       messages_robocup_ssl_geometry.pb )

then CMake will automatically retain that dependency when messages_robocup_ssl_wrapper.pb is specified as a dependency of another target. If you do this, then you can choose to omit messages_robocup_ssl_geometry.pb from the target_link_libraries( clientTest ... ) call.


Yet another reason to observe this error, maybe a less common one though, is that the ABIs are not compatible.

For instance, one of the library files could be built with the flag -D_GLIBCXX_USE_CXX11_ABI=0 while the project is not. This can be nasty to debug, especially when not being aware that this can be the problem.

I realize that this is not the issue in your specific scenario, but this answer might help other stumbling on it.