So installieren Sie die C++ - Bindung für ZeroMQ auf Mac OS X?

Auf

g++ actualApp.cpp -lzmq 

Bekomme ich

actualApp.cpp:6:19: error: zmq.hpp: No such file or directory
actualApp.cpp: In function int main()’:
actualApp.cpp:13: error: zmq has not been declared
actualApp.cpp:13: error: expected `;' before context
actualApp.cpp:14: error: zmq has not been declared
actualApp.cpp:14: error: expected `;' before socket
actualApp.cpp:15: error: socket was not declared in this scope
actualApp.cpp:18: error: zmq has not been declared
actualApp.cpp:18: error: expected `;' before request
actualApp.cpp:21: error: request was not declared in this scope
actualApp.cpp:28: error: zmq has not been declared
actualApp.cpp:28: error: expected `;' before reply
actualApp.cpp:29: error: reply was not declared in this scope
actualApp.cpp: At global scope:
actualApp.cpp:33: error: expected constructor, destructor, or type conversion at end of input

für

//
// Hello World server in C++
// Binds REP socket to tcp://*:5555
// Expects "Hello" from client, replies with "World"
//
#include <zmq.hpp>
#include <string>
#include <iostream>
#include <unistd.h>

int main () {
    // Prepare our context and socket
    zmq::context_t context (1);
    zmq::socket_t socket (context, ZMQ_REP);
    socket.bind ("tcp://*:5555");

    while (true) {
        zmq::message_t request;

        // Wait for next request from client
        socket.recv (&request);
        std::cout << "Received Hello" << std::endl;

        // Do some 'work'
        sleep (1);

        // Send reply back to client
        zmq::message_t reply (5);
        memcpy ((void *) reply.data (), "World", 5);
        socket.send (reply);
    }
    return 0;
}

Habe ich installiert zeromq auf Mac OS X-wie diese - ./configure, make, make install.

Kann ich kompilieren Sie die C-Beispiele ohne Fehler mit der -lzmq Flagge.

Wie sollte ich diese C++ .hpp header von https://github.com/zeromq/cppzmq?

Wie kann man das kompilieren der c++ - code?
Ich habe das C wie das - gcc actualApp.c -lzmq
Ich war versucht, für c++ - g++ actualApp.cpp -lzmq

InformationsquelleAutor | 2013-04-24

Schreibe einen Kommentar