2016-04-01 18 views
1

Protobuf kütüphanesini bağlarken bir sorunla karşı karşıyayım. C++ Protobuf Versiyon:C++ Protobuf Hata google :: protobuf :: internal :: kEmptyString Hata

/tmp/ccKgczB9.o:TickData.pb.cc:(.text+0x444): undefined reference to google::protobuf::internal::kEmptyString' /tmp/ccKgczB9.o:TickData.pb.cc:(.text+0x4a9): undefined reference to google::protobuf::internal::kEmptyString' /tmp/ccKgczB9.o:TickData.pb.cc:(.text+0x4c4): undefined reference to google::protobuf::internal::kEmptyString' /tmp/ccKgczB9.o:TickData.pb.cc:(.text+0x4de): undefined reference to google::protobuf::internal::kEmptyString' /tmp/ccKgczB9.o:TickData.pb.cc:(.text+0x502): undefined reference to google::protobuf::internal::kEmptyString' /tmp/ccKgczB9.o:TickData.pb.cc:(.text+0x53c): more undefined references to google::protobuf::internal::kEmptyString' follow /tmp/ccKgczB9.o:TickData.pb.cc:(.text$_ZN6google8protobuf8internal10WireFormat16VerifyUTF8StringEPKciNS2_9OperationE[__ZN6google8protobuf8internal10WireFormat16VerifyUTF8StringEPKciNS2_9OperationE]+0x1b): undefined reference to `google::protobuf::internal::WireFormat::VerifyUTF8StringFallback(char const*, int, google::protobuf::internal::WireFormat::Operation)' collect2: error: ld returned 1 exit status

Dil Kullanılan 2.6.1

Zaten aşağıdaki linklere şeyler denedim ama işe doesnt:

Can't compile example from google protocol buffers

ve

Undefined reference to google::protobuf::internal::empty_string_[abi:cxx11]

C++ 'da yeni. Ayrıca protobuf'u -std = C++ 11 kullanarak derlemeyi denedim ama yine de aynı hata.

Herhangi bir işaretçi size yardımcı olacaktır.

+0

c kullanılan derleyici komut satırı gösterin. (Benim tahminim, -lprotobuf' bayrağı eksik.) –

+0

g ++ -g -L "/cygdrive/d/Softwares/protobuf-2.6.1/src/.libs" ../proto/TickData.pb. cc main.cpp -std = C++ 11 -lprotobuf – Abhishek

cevap

0

Bir çıkış yolu buldum.

Önce g ++ için -c seçeneğini kullanmalı ve .o dosyalarını oluşturmalıyım. Sonra tekrar ayrı olarak -o seçeneği çalıştırılabilir üretmek için kullanmak zorunda kalacak.

aşağıda gösterildiği gibi:

g ++ -c -L/cygdrive/d/Alanı/CPP/Uygulama/.libs/../proto/TickData.pb.cc main.cpp -std = C++ 11 -lprotobuf

g ++ -g -Wall TickData.pb.o main.o -o MarketData.o -std = ++ 11 -lprotobuf

İlgili konular