views:

21

answers:

1

Hi,

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 implement 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.

A: 

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.

Greg S
This comes automatically when i run the command qmake -projectAfter this i run qmake to get the Makefileon executing the makefile i get loads of errors. I am guessing the protoc library is not getting included. Can someone tell me where and how to include the protoc library in the makefile or pro file generated by qmake

related questions