Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Example doesn't compile (MacOS)

Open
#628 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
cpp
Domain
documentation

Research direction

Start by reproducing the linked zeromq.org C++ example in testprogram.cpp with the Homebrew libzmq 4.3.5 and cppzmq 4.10.0 versions and the shown compiler command. Compare the example's API usage with the installed headers; done means the published example compiles successfully on macOS.

Written by the indexing model from the issue text.

Description

The example program here:

#include <string>
#include <zmq.hpp>
int main()
{
   zmq::context_t ctx;
   zmq::socket_t sock(ctx, zmq::socket_type::push);
   sock.bind("inproc://test");
   const std::string_view m = "Hello, world";
   sock.send(zmq::buffer(m), zmq::send_flags::dontwait);
}

Doesn't seem to compile, due to multiple errors:

g++ -I/opt/homebrew/Cellar/cppzmq/4.10.0/include -I/opt/homebrew/Cellar/zeromq/4.3.5_1/include testprogram.cpp -L/opt/homebrew/Cellar/zeromq/4.3.5_1/lib -lzmq
testprogram.cpp:6:33: error: no member named 'socket_type' in namespace 'zmq'; did you mean 'socket_t'?
   zmq::socket_t sock(ctx, zmq::socket_type::push);
                           ~~~~~^~~~~~~~~~~
                                socket_t
/opt/homebrew/Cellar/cppzmq/4.10.0/include/zmq.hpp:2181:7: note: 'socket_t' declared here
class socket_t : public detail::socket_base
      ^
testprogram.cpp:6:46: error: no member named 'push' in 'zmq::socket_t'
   zmq::socket_t sock(ctx, zmq::socket_type::push);
                           ~~~~~~~~~~~~~~~~~~^
testprogram.cpp:9:35: error: no member named 'send_flags' in namespace 'zmq'
   sock.send(zmq::buffer(m), zmq::send_flags::dontwait);
                             ~~~~~^
testprogram.cpp:9:19: error: no member named 'buffer' in namespace 'zmq'
   sock.send(zmq::buffer(m), zmq::send_flags::dontwait);
             ~~~~~^
4 errors generated.

Platform details:

Platform: MacOS Ventura
Installed via: homebrew
zmq version: 4.3.5 (latest available)
cppzmq version: 4.10.0 (latest available)

Dominant language
C++
Stars
2.3k
Forks
799
Avg merge
2d 17h
Merged PRs (30d)
1

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from zeromq/cppzmq

All issues in zeromq/cppzmq

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.