zmq.hpp fails assertion when attempting to debug

风格不统一 提交于 2019-12-31 05:29:28

问题


Its been a while since I worked with c++ in visual studio, and due to this I can't tell when I am doing wrong when attempting to run a debug instance of zmq's hello world client.

After installing zmq 4.0.3 and downloading the zmq.hpp master branch from github I copy/pasted the hello world client from the zmq guide.

Using Visual Studio 2010

I navigated to the project properties and have included both the include folder containing zmq.h and the folder including zmq.hpp

I also included the lib folder under the linker->general->additional library dependencies, and I added the libzmq-v100-mt-gd-4_0_3.lib file to the linker->input->additional dependencies.

I have also included the libzmq-v100-mt-gd-4_0_3.dll in the Debug folder for the project.

After cleaning the project the code compiled fine when selecting Build->Build Solution and Build->Compile, but when I run a debug instance I get an assertion failed at line 276 resulting in an abort.

I don't understand why this is happening and could use some help figuring out what I need to fix to run the example.

UPDATE

I changed the c++ code to c code without changing anything else and I was able to compile and run without issue.

The assertion being failed is rc==0 at line 267 of the zmq.hpp file which is the second assertion in this code snippet.

inline explicit context_t (int io_threads_, int max_sockets_ = 1024)
{
    ptr = zmq_ctx_new ();
    if (ptr == NULL)
        throw error_t ();

    int rc = zmq_ctx_set (ptr, ZMQ_IO_THREADS, io_threads_);
    ZMQ_ASSERT (rc == 0);

    rc = zmq_ctx_set (ptr, ZMQ_MAX_SOCKETS, max_sockets_);
    ZMQ_ASSERT (rc == 0);
}

来源:https://stackoverflow.com/questions/22335467/zmq-hpp-fails-assertion-when-attempting-to-debug

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!