How to fix NanoPB MyProtocol.proto: Option "(nanopb)" unknown.

Problem:

When trying to compile a project using NanoPB, you see a warning like

nanopb_import_fix.txt
MyProtocol.proto:11:27: Option "(nanopb)" unknown. Ensure that your proto definition file imports the proto which defines the option.

Solution

At the top of the .proto file mentioned in the warning message, just after syntax = "proto3"; add the following line:

example.txt
import "nanopb.proto";

After that, the error should be gone.


Check out similar posts by category: NanoPB