dd-opentracing-cpp icon indicating copy to clipboard operation
dd-opentracing-cpp copied to clipboard

dd-opentracing-cpp Win x64 Error opentracing dependency missing from CMakeLists.txt - LNK2019 unresolved external symbol propagation_error_category

Open buzz3791 opened this issue 2 years ago • 4 comments

I’ve modified our C++ application to use DataDog. I’ve added:

  1. the following include:
#include <opentracing/dynamic_load.h>
  1. the DataDog include folder:
dd-opentracing-cpp\.build\vcpkg_installed\x64-windows\include
  1. the DataDog link library folder:
dd-opentracing-cpp\.build\RelWithDebInfo
  1. the DataDog link library: dd_opentracing.lib After the changes above, when building our C++ application with Visual Studio, the build is failing at link time with these DataDog related errors:
Error        LNK2019        unresolved external symbol "__declspec(dllimport) class std::error_category const & __cdecl opentracing::v3::propagation_error_category(void)" (__imp_?propagation_error_category@v3@opentracing@@YAAEBVerror_category@std@@XZ) referenced in function "void __cdecl opentracing::v3::`dynamic initializer for 'invalid_carrier_error''(void)" (??__Einvalid_carrier_error@v3@opentracing@@YAXXZ)        someapp        C:\dev\mvtrunk\someapp\someapp\someapp.obj

Error LNK2019 unresolved external symbol "__declspec(dllimport) class std::error_category const & __cdecl opentracing::v3::tracer_factory_error_category(void)" (__imp_?tracer_factory_error_category@v3@opentracing@@YAAEBVerror_category@std@@XZ) referenced in function "void __cdecl opentracing::v3::`dynamic initializer for 'configuration_parse_error''(void)" (??__Econfiguration_parse_error@v3@opentracing@@YAXXZ) someapp C:\dev\mvtrunk\someapp\someapp\someapp.obj
 
Error  LNK2019 unresolved external symbol "__declspec(dllimport) class std::error_category const & __cdecl opentracing::v3::dynamic_load_error_category(void)" (__imp_?dynamic_load_error_category@v3@opentracing@@YAAEBVerror_category@std@@XZ) referenced in function "void __cdecl opentracing::v3::`dynamic initializer for 'dynamic_load_failure_error''(void)" (??__Edynamic_load_failure_error@v3@opentracing@@YAXXZ) someapp C:\dev\mvtrunk\someapp\someapp\someapp.obj

buzz3791 avatar Jul 20 '23 19:07 buzz3791

@dgoffredo Any ideas on why this issue is occuring? As far as I can tell, there are no DataDog .h nor .cpp files that are providing definitions of these *_error_category symbols.

buzz3791 avatar Jul 21 '23 18:07 buzz3791

I haven't done a build on Windows, but I think that you will need opentracing-cpp's library in addition to dd-opentracing-cpp's.

The idea is that opentracing-cpp is a library that defines some interfaces (abstract classes), vocabulary types (e.g. errors, variants), and utilities (such as the plugin loader). A plugin is then another library, like dd-opentracing-cpp, that implements the interfaces and provides a hook for the plugin loader to load.

Even if you're not using the plugin loader, you will need both libraries in order to build an application using dd-opentracing-cpp.

For some non-Windows examples, see compiled-in or dynamic-loading. As part of both docker image setups, they call scripts/install_dependencies.sh, which installs the opentracing-cpp library.

dgoffredo avatar Jul 24 '23 17:07 dgoffredo

@buzz3791 Were you able to fix this issue? I'm having the same issue right now. I'm including the opentracing-cpp library as suggested by dgoffredo, but I'm still getting the error.

raulbojalil avatar Feb 19 '24 14:02 raulbojalil

Hi, @raulbojalil.

If @buzz3791 didn't find a solution that you can use, then please open up a Datadog Support ticket here. It will likely get escalated to my team, and then we can spend some time on Windows.

Note that dd-opentracing-cpp is no longer under active development. If you have the option of using a non-OpenTracing solution, then consider dd-trace-cpp instead.

If you want another vendor-agnostic solution, then you can look into opentelemetry-cpp. The Datadog Agent can act as an OTLP collector.

dgoffredo avatar Feb 19 '24 15:02 dgoffredo