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

Rajesh Khan rajeshkhan808 at gmail.com
Wed Jul 3 18:26:28 CEST 2013


after adding libzmq_d.lib to the input dependency the problem fixed. Thanks



On Wed, Jul 3, 2013 at 12:24 PM, Rajesh Khan <rajeshkhan808 at gmail.com>wrote:

> This is how I have my headers now
> #include <string>
> #include <iostream>
> #include <zmq.hpp>
> I am still  using the same zmq.hpp file.
> Now I am getting the following error
>
> Error    1    error LNK2019: unresolved external symbol
> __imp__zmq_msg_init referenced in function "public: __thiscall
> zmq::message_t::message_t(void)" (??0message_t at zmq@@QAE at XZ)
> c:\Users\User\documents\visual studio
> 2010\Projects\ZeroMqTest\ZeroMqTest\main.obj    ZeroMqTest
> Error    2    error LNK2019: unresolved external symbol __imp__zmq_errno
> referenced in function "public: __thiscall zmq::error_t::error_t(void)"
> (??0error_t at zmq@@QAE at XZ)    c:\Users\User\documents\visual studio
> 2010\Projects\ZeroMqTest\ZeroMqTest\main.obj    ZeroMqTest
> Error    3    error LNK2019: unresolved external symbol
> __imp__zmq_strerror referenced in function "public: virtual char const *
> __thiscall zmq::error_t::what(void)const " (?what at error_t@zmq@@UBEPBDXZ)
> c:\Users\User\documents\visual studio
> 2010\Projects\ZeroMqTest\ZeroMqTest\main.obj    ZeroMqTest
> Error    4    error LNK2019: unresolved external symbol
> __imp__zmq_msg_init_size referenced in function "public: __thiscall
> zmq::message_t::message_t(unsigned int)" (??0message_t at zmq@@QAE at I@Z)
> c:\Users\User\documents\visual studio
> 2010\Projects\ZeroMqTest\ZeroMqTest\main.obj    ZeroMqTest
> Error    5    error LNK2019: unresolved external symbol
> __imp__zmq_msg_close referenced in function "public: __thiscall
> zmq::message_t::~message_t(void)" (??1message_t at zmq@@QAE at XZ)
> c:\Users\User\documents\visual studio
> 2010\Projects\ZeroMqTest\ZeroMqTest\main.obj    ZeroMqTest
> Error    6    error LNK2019: unresolved external symbol
> __imp__zmq_msg_data referenced in function "public: void * __thiscall
> zmq::message_t::data(void)" (?data at message_t@zmq@@QAEPAXXZ)
> c:\Users\User\documents\visual studio
> 2010\Projects\ZeroMqTest\ZeroMqTest\main.obj    ZeroMqTest
> Error    7    error LNK2019: unresolved external symbol __imp__zmq_init
> referenced in function "public: __thiscall zmq::context_t::context_t(int)"
> (??0context_t at zmq@@QAE at H@Z)    c:\Users\User\documents\visual studio
> 2010\Projects\ZeroMqTest\ZeroMqTest\main.obj    ZeroMqTest
> Error    8    error LNK2019: unresolved external symbol __imp__zmq_term
> referenced in function "public: void __thiscall
> zmq::context_t::close(void)" (?close at context_t@zmq@@QAEXXZ)
> c:\Users\User\documents\visual studio
> 2010\Projects\ZeroMqTest\ZeroMqTest\main.obj    ZeroMqTest
> Error    9    error LNK2019: unresolved external symbol __imp__zmq_socket
> referenced in function "public: __thiscall zmq::socket_t::socket_t(class
> zmq::context_t &,int)" (??0socket_t at zmq@@QAE at AAVcontext_t@1 at H@Z)
> c:\Users\User\documents\visual studio
> 2010\Projects\ZeroMqTest\ZeroMqTest\main.obj    ZeroMqTest
> Error    10    error LNK2019: unresolved external symbol __imp__zmq_close
> referenced in function "public: void __thiscall zmq::socket_t::close(void)"
> (?close at socket_t@zmq@@QAEXXZ)    c:\Users\User\documents\visual studio
> 2010\Projects\ZeroMqTest\ZeroMqTest\main.obj    ZeroMqTest
> Error    11    error LNK2019: unresolved external symbol __imp__zmq_bind
> referenced in function "public: void __thiscall zmq::socket_t::bind(char
> const *)" (?bind at socket_t@zmq@@QAEXPBD at Z)
> c:\Users\User\documents\visual studio
> 2010\Projects\ZeroMqTest\ZeroMqTest\main.obj    ZeroMqTest
> Error    12    error LNK2019: unresolved external symbol
> __imp__zmq_msg_send referenced in function "public: bool __thiscall
> zmq::socket_t::send(class zmq::message_t &,int)" (?send at socket_t@zmq@
> @QAE_NAAVmessage_t at 2@H at Z)    c:\Users\User\documents\visual studio
> 2010\Projects\ZeroMqTest\ZeroMqTest\main.obj    ZeroMqTest
> Error    13    error LNK2019: unresolved external symbol
> __imp__zmq_msg_recv referenced in function "public: bool __thiscall
> zmq::socket_t::recv(class zmq::message_t *,int)" (?recv at socket_t@zmq@
> @QAE_NPAVmessage_t at 2@H at Z)    c:\Users\User\documents\visual studio
> 2010\Projects\ZeroMqTest\ZeroMqTest\main.obj    ZeroMqTest
> Error    14    error LNK1120: 13 unresolved externals
> c:\users\user\documents\visual studio
> 2010\Projects\ZeroMqTest\Debug\ZeroMqTest.exe    ZeroMqTest
>
>
>
> On Wed, Jul 3, 2013 at 12:17 PM, <Richard_Newton at waters.com> wrote:
>
>>  Hi,
>>
>> Pull request *https://github.com/zeromq/cppzmq/pull/15*<https://github.com/zeromq/cppzmq/pull/15>
>>  was merge that broke this, there is a pull request pending, *
>> https://github.com/zeromq/cppzmq/pull/22*<https://github.com/zeromq/cppzmq/pull/22>,
>> that fixes this but the C++ bindings tend to be very slow at merging
>> requests.
>>
>> You can either add a #include <string> to zmq.hpp for now or #include
>> <string> before you #include <zmq.hpp> in your source code.
>>
>> Ric.
>>
>>
>> [image: Inactive hide details for "Rajesh Khan" ---03/07/2013 05:09:17
>> PM---I just downloaded ZMQ from http://www.zeromq.org/intro:get-]"Rajesh
>> Khan" ---03/07/2013 05:09:17 PM---I just downloaded ZMQ from
>> http://www.zeromq.org/intro:get-the-software as a windows source. And I s
>>
>> From: "Rajesh Khan" <rajeshkhan808 at gmail.com>
>> To: zeromq-dev at lists.zeromq.org
>> Date: 03/07/2013 05:09 PM
>> Subject: [zeromq-dev] Issue with Zmq.hpp - string is not a member of std
>> Sent by: zeromq-dev-bounces at lists.zeromq.org
>> ------------------------------
>>
>>
>>
>> I just downloaded ZMQ from *http://www.zeromq.org/intro:get-the-software*<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*<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
>> _______________________________________________
>> zeromq-dev mailing list
>> zeromq-dev at lists.zeromq.org
>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>>
>> ===========================================================
>> The information in this email is confidential, and is intended solely for the addressee(s).
>> Access to this email by anyone else is unauthorized and therefore prohibited.  If you are
>> not the intended recipient you are notified that disclosing, copying, distributing or taking
>> any action in reliance on the contents of this information is strictly prohibited and may be unlawful.
>> ===========================================================
>>
>>
>> _______________________________________________
>> 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/20130703/5c369d38/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: graycol.gif
Type: image/gif
Size: 105 bytes
Desc: not available
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20130703/5c369d38/attachment.gif>


More information about the zeromq-dev mailing list