bcl.proto not found???

293 views
Skip to first unread message

Johan Skog RS

unread,
Dec 22, 2022, 7:56:04 AM12/22/22
to Protocol Buffers
Hi all.
I have a proto file "MyStatusDto.proto" that is using bcl.proto for DateTime type. (the protobuf is in this case used for communication between a C++ and a C# app, and the proto file is generated from the C# contract class). But when I try to compile the proto file for cpp, the protoc complains about missing bcl.proto. What am I missing in order to get the import bcl to work?
//Johan

File MyStatusDto.proto:
syntax = "proto3";
import "protobuf-net/bcl.proto"; // schema for protobuf-net's handling of core .NET types

message  MyStatusDto  {
   bool Active = 1;
   int32 RecordCount = 2;
   .bcl.DateTime LastRecordedTimestamp = 3;
}

Command:
protoc --cpp_out=.  MyStatusDto.proto

Output:
protobuf-net/bcl.proto: File not found.
MyStatusDto.proto:3:1: Import "protobuf-net/bcl.proto" was not found or had errors.
MyStatusDto.proto:8:4: ".bcl.DateTime" is not defined.

hrx

unread,
Dec 24, 2022, 10:50:00 AM12/24/22
to Protocol Buffers

Go into your protoc "include" folder and create a folder called "protobuf-net" and then move a file called bcl.proto into that folder (You can get bcl.proto from: https://github.com/protobuf-net/protobuf-net/blob/main/src/Tools/bcl.proto copy all content from that into bcl.proto)
Reply all
Reply to author
Forward
0 new messages