[zeromq-dev] zmq.hpp in guide source.

Евгений Пастернак pasternake at gmail.com
Wed Jun 24 00:57:27 CEST 2015


You have to dowload this file from
https://github.com/zeromq/cppzmq/blob/master/zmq.hpp and place it into
include dir
Ср, 24 июня 2015 г. в 4:50, Craig Anderson <craig at coot.net>:

>  Yes, source is
>
>
>
> //
> // Weather update server in C++
> // Binds PUB socket to tcp://*:5556
> // Publishes random weather updates
> //
> // Olivier Chamoux <olivier.chamoux at fr.thalesgroup.com>
> <olivier.chamoux at fr.thalesgroup.com>
> //
> #include <zmq.hpp>
> #include <stdio.h>
> #include <stdlib.h>
> #include <time.h>
>
> #define within(num) (int) ((float) num * random () / (RAND_MAX + 1.0))
>
> int main () {
>
> // Prepare our context and publisher
> zmq::context_t context (1);
> zmq::socket_t publisher (context, ZMQ_PUB);
> publisher.bind("tcp://*:5556");
> publisher.bind("ipc://weather.ipc");
>
> // Initialize random number generator
> srandom ((unsigned) time (NULL));
> while (1) {
>
> int zipcode, temperature, relhumidity;
>
> // Get values that will fool the boss
> zipcode = within (100000);
> temperature = within (215) - 80;
> relhumidity = within (50) + 10;
>
> // Send message to all subscribers
> zmq::message_t message(20);
> snprintf ((char *) message.data(), 20 ,
> "%05d %d %d", zipcode, temperature, relhumidity);
> publisher.send(message);
>
> }
> return 0;
> }
> ========================
>
>
> Hi Graig!
>
> Are you compiling example from ZeroMQ guide?
> Ср, 24 июня 2015 г. в 4:13, Craig Anderson <craig at coot.net>:
>
>> I am trying to build a win32 console application
>> in Visual Studio 2012.  I have a project using the example weather
>> server code.
>> I have installed from the 4.0.4 x86 installer.
>>
>> Here is the error?
>>
>>
>> c:\users\craig\documents\visual studio
>> 2012\projects\mapd\weather_server\weather_server.cpp(10): fatal error
>> C1083: Cannot open include file: 'zmq.hpp': No such file or directory
>>
>>
>>
>>   _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20150623/b54e7e2f/attachment.htm>


More information about the zeromq-dev mailing list