Using Other Message Types using import - "message" is not defined

2,323 views
Skip to first unread message

Tai

unread,
Aug 4, 2009, 6:14:24 AM8/4/09
to Protocol Buffers
Hi,

I have to proto files ADMObjectHandleMessage.proto and
AbstractADMAdapterMessage.proto:

ADMObjectHandleMessage.proto
==================================
package com.qnamic.base.agent;

message ADMObjectHandle {
optional string host = 1;
optional string agent = 2;
optional string path = 3;
required int64 admTopCreationTime = 4;
}

AbstractADMAdapterMessage.proto
==================================
package com.qnamic.planopt.base.query.adapter;
import "ADMObjectHandleMessage.proto";

message AbstractADMAdapter {
repeated ADMObjectHandle objectHandle = 1;
required bool adaptAll = 2;
required bool fillObjectHandle = 3;
}

But when trying to compile the last file I get this:
Buildfile: D:\development\workspace\Platform\dev\config\protocolbuffers
\build.xml
generate:
[exec] AbstractADMAdapterMessage.proto:5:14: "ADMObjectHandle" is
not defined.
[exec] Result: 1
BUILD SUCCESSFUL
Total time: 172 milliseconds

Tai

unread,
Aug 4, 2009, 10:31:34 AM8/4/09
to Protocol Buffers
Ok. I forgot to the type the full qualified name including package:
required com.qnamic.base.agent.ADMObjectHandle objectHandle = 1;

Tai

Kenton Varda

unread,
Aug 4, 2009, 12:39:43 PM8/4/09
to Tai, Protocol Buffers
BTW, the proto package name is meant to correspond to C++ namespaces, not Java packages.  I recommend using the java_package option to specify the Java package, then set the proto package to something shorter, like:

  package qnamic.base.agent;
  option java_package = "com.qnamic.base.agent";

But I suppose if you only use Java it won't make a big difference.
Reply all
Reply to author
Forward
0 new messages