1

I'm trying to receive information from an 0MQ Socket in C or C++, but therefore I have to include zmq.h. By downloading the 0MQ software from their website and including this file. Xcode gives the following error:

Undefined symbols for architecture x86_64: "_zmq_init", referenced from: _main in main.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)

When installing ZeroMQ using brew I get the same error. Is there anyone who know a workaround?

Hugo
  • 75
  • 3
  • I ended up just creating a side-by project in my Xcode workspace that built the 0MQ source. It wasn't terrible. Just download, ./configure, create the project (dylib or static, your choice), throw out everything but the .cpp and .hpp files from the src root, and build. Never tried brew, but I'm intrigued. – WhozCraig Aug 06 '14 at 01:39
  • Related: https://stackoverflow.com/q/12470117/6338725 – Rodrigo de Azevedo Apr 14 '18 at 06:37

1 Answers1

2

The problem here is that you aren't linking the ZMQ library correctly.

You need to build the library once you've downloaded it (they include all the make scripts you need). Once you have that, you will need to link them to the compiler. I'm not too familiar with XCode, but using gcc it would look something like this:

-L/path/to/zmq/library -lzmq

ZeroMQ is really beautiful though. I've used it on Linux/Windows. Hope you get it working!

mrfred
  • 613
  • 4
  • 15