开发者

linking a .proto file using qmake

I have 4 files

message.proto udp.h udp.cpp main.cpp

message.proto is a google protocol buffer file. I am trying to write a protocol buffer and send and receive data using UDP. udp.h and udp.cpp are just classes to impl开发者_运维百科ement UDP.

I can write my own makefile and do the needful for this small example. Later I would require to integrate this code into my QT program. I am using qmake -project, qmake to generate the Makefile. I am using Ubuntu 9.10

Could some one tell me the changes I need to make in the .pro file or the Makefile generated by qmake to satisfy the dependencies.


Usually you just need to add the respective header and source files to the corresponding HEADERS and SOURCES variables in the .pro file, i.e.

SOURCES += udp.cpp message.pb.cc
HEADERS += udp.h message.pb.h

where I implicity assumed that message.pb.cc and message.pb.h are the files generated by protoc (the protocol buffer compiler). If you additionally want the generated makefile to run protoc for you, you can accomplish that with the system function (http://doc.trolltech.com/4.6/qmake-function-reference.html#system-command).

I hope that helps.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜