Replies: 2 comments 11 replies
-
What's your build system and what's your link options? |
Beta Was this translation helpful? Give feedback.
0 replies
-
hi, I am facing the same issue. can you let me know how you resolved it. |
Beta Was this translation helpful? Give feedback.
11 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello community,
I'm trying to compile my first code with the opentelemetry SDK, but I'm with the error below, has anyone been through this? Can you help?
usr/bin/ld: /tmp/ccC5ZrEp.o: in function
(anonymous namespace)::InitTracer()': helloworld_v1.cpp:(.text+0x236): undefined reference to
opentelemetry::v1::exporter::jaeger::JaegerExporter::JaegerExporter(opentelemetry::v1::exporter::jaeger::JaegerExporterOptions const&)'/usr/bin/ld: helloworld_v1.cpp:(.text+0x2f1): undefined reference to
opentelemetry::v1::sdk::resource::Resource::Create(opentelemetry::v1::sdk::common::AttributeMap const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' /usr/bin/ld: helloworld_v1.cpp:(.text+0x3ab): undefined reference to
opentelemetry::v1::sdk::trace::TracerProvider::TracerProvider(std::unique_ptr<opentelemetry::v1::sdk::trace::SpanProcessor, std::default_deleteopentelemetry::v1::sdk::trace::SpanProcessor >, opentelemetry::v1::sdk::resource::Resource, std::unique_ptr<opentelemetry::v1::sdk::trace::Sampler, std::default_deleteopentelemetry::v1::sdk::trace::Sampler >, std::unique_ptr<opentelemetry::v1::sdk::trace::IdGenerator, std::default_deleteopentelemetry::v1::sdk::trace::IdGenerator >)'/usr/bin/ld: helloworld_v1.cpp:(.text+0x4f8): undefined reference to
opentelemetry::v1::sdk::resource::Resource::Create(opentelemetry::v1::sdk::common::AttributeMap const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' /usr/bin/ld: helloworld_v1.cpp:(.text+0x516): undefined reference to
opentelemetry::v1::sdk::resource::Resource::GetAttributes() const'/usr/bin/ld: /tmp/ccC5ZrEp.o: in function
opentelemetry::v1::sdk::trace::RandomIdGenerator::RandomIdGenerator()': helloworld_v1.cpp:(.text._ZN13opentelemetry2v13sdk5trace17RandomIdGeneratorC2Ev[_ZN13opentelemetry2v13sdk5trace17RandomIdGeneratorC5Ev]+0x1f): undefined reference to
vtable for opentelemetry::v1::sdk::trace::RandomIdGenerator'collect2: error: ld returned 1 exit status
My code:
#include "opentelemetry/exporters/jaeger/jaeger_exporter.h"
#include "opentelemetry/sdk/trace/simple_processor.h"
#include "opentelemetry/sdk/trace/tracer_provider.h"
#include "opentelemetry/trace/provider.h"
#include
namespace trace = opentelemetry::trace;
namespace nostd = opentelemetry::nostd;
namespace trace_sdk = opentelemetry::sdk::trace;
namespace jaeger = opentelemetry::exporter::jaeger;
namespace
{
opentelemetry::exporter::jaeger::JaegerExporterOptions opts;
void InitTracer()
{
opts.transport_format = opentelemetry::exporter::jaeger::TransportFormat::kThriftHttp;
opts.endpoint = "localhost";
opts.server_port = 6831;
auto exporter = std::unique_ptr<trace_sdk::SpanExporter>(new jaeger::JaegerExporter(opts));
auto processor = std::unique_ptr<trace_sdk::SpanProcessor>(
new trace_sdk::SimpleSpanProcessor(std::move(exporter)));
auto provider =
nostd::shared_ptrtrace::TracerProvider(new trace_sdk::TracerProvider(std::move(processor)));
// Set the global trace provider
trace::Provider::SetTracerProvider(provider);
auto resource_attributes = opentelemetry::sdk::resource::ResourceAttributes
{
{"service.name", "hello world"},
{"deployment.environment", "desenv"}
};
auto resource = opentelemetry::sdk::resource::Resource::Create(resource_attributes);
auto received_attributes = resource.GetAttributes();
}
} // namespace
int main() {
std::cout << "Hello World!";
InitTracer();
return 0;
}
Beta Was this translation helpful? Give feedback.
All reactions