[zeromq-dev] Issue with Zmq.hpp - string is not a member of std

Rajesh Khan rajeshkhan808 at gmail.com
Wed Jul 3 18:08:55 CEST 2013


I just downloaded ZMQ from http://www.zeromq.org/intro:get-the-software as
a windows source. And I successfully built it.I then downloaded the Zmq.hpp
C++ binding from https://github.com/zeromq/cppzmq and placed it in the
zeromq-3.2.3\include folder. I am using VS2010 to test my first example
which is:

#include <zmq.hpp>
#include <string>
#include <iostream>
//#include <windows.h>

using namespace std;
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;
}

In my VS2010 I included the additional include directories  to point to
zeromq-3.2.3\include and zeromq-3.2.3\src and I get the following errors
when attempting to build the project

Error    1    error C2039: 'string' : is not a member of 'std'
C:\zeromq-3.2.3\include\zmq.hpp    506    1    ZeroMqTest
Error    2    error C2146: syntax error : missing ';' before identifier
'monaddr'    C:\zeromq-3.2.3\include\zmq.hpp    506    1    ZeroMqTest
Error    3    error C4430: missing type specifier - int assumed. Note: C++
does not support default-int    C:\zeromq-3.2.3\include\zmq.hpp    506
1    ZeroMqTest
Error    4    error C4430: missing type specifier - int assumed. Note: C++
does not support default-int    C:\zeromq-3.2.3\include\zmq.hpp    506
1    ZeroMqTest
Error    5    error C2065: 'monaddr' : undeclared identifier
C:\zeromq-3.2.3\include\zmq.hpp    369    1    ZeroMqTest
Error    6    error C2039: 'string' : is not a member of 'std'
C:\zeromq-3.2.3\include\zmq.hpp    369    1    ZeroMqTest
Error    7    error C3861: 'string': identifier not found
C:\zeromq-3.2.3\include\zmq.hpp    369    1    ZeroMqTest
Error    8    error C2065: 'monaddr' : undeclared identifier
C:\zeromq-3.2.3\include\zmq.hpp    415    1    ZeroMqTest
Error    9    error C2228: left of '.c_str' must have class/struct/union
C:\zeromq-3.2.3\include\zmq.hpp    415    1    ZeroMqTest

Any suggestions on what I might be doing wrong
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20130703/74d86321/attachment.htm>


More information about the zeromq-dev mailing list