Setting up the basic C++ client to connect to RMQ.

947 views
Skip to first unread message

Dilip Bloch

unread,
Apr 22, 2015, 4:22:56 PM4/22/15
to rabbitm...@googlegroups.com
I've downloaded the RabbitMQ-C package and created a MSVC++ project using those examples.
I couldn't locate any linking libraries (.LIB ) for building the project
VC++ project compiles fine but has linking errors so any suggestions would be a great help.
Also are there any runtime DLLs that I can download?
 

Michael Klishin

unread,
Apr 22, 2015, 5:06:10 PM4/22/15
to rabbitm...@googlegroups.com, Dilip Bloch
On 22 April 2015 at 23:22:58, Dilip Bloch (dilipku...@gmail.com) wrote:
> VC++ project compiles fine but has linking errors so any suggestions
> would be a great help.

I doubt may will be able  to help you: you didn't mention what the errors are.

There's a (pretty opinionated) C++ library on top of librabbitmq-c from the same author:
https://github.com/alanxz/SimpleAmqpClient
--
MK

Staff Software Engineer, Pivotal/RabbitMQ


Dilip Bloch

unread,
Apr 22, 2015, 5:24:12 PM4/22/15
to rabbitm...@googlegroups.com, dilipku...@gmail.com
Thanks MK for your response.
 
The MSVC++ project compiles successfully but throws the following linking errors...
 

1>------ Build started: Project: LeapRabbitMQScanner, Configuration: Debug Win32 ------

1>LeapRabbitMQScanner.obj : error LNK2019: unresolved external symbol "void __cdecl die_on_error(int,char const *)" (?die_on_error@@YAXHPBD@Z) referenced in function _main

1>LeapRabbitMQScanner.obj : error LNK2019: unresolved external symbol _amqp_destroy_connection referenced in function _main

1>LeapRabbitMQScanner.obj : error LNK2019: unresolved external symbol _amqp_connection_close referenced in function _main

1>LeapRabbitMQScanner.obj : error LNK2019: unresolved external symbol _amqp_channel_close referenced in function _main

1>LeapRabbitMQScanner.obj : error LNK2019: unresolved external symbol _amqp_destroy_envelope referenced in function _main

1>LeapRabbitMQScanner.obj : error LNK2019: unresolved external symbol "void __cdecl amqp_dump(void const *,unsigned int)" (?amqp_dump@@YAXPBXI@Z) referenced in function _main

1>LeapRabbitMQScanner.obj : error LNK2019: unresolved external symbol _amqp_consume_message referenced in function _main

1>LeapRabbitMQScanner.obj : error LNK2019: unresolved external symbol _amqp_maybe_release_buffers referenced in function _main

1>LeapRabbitMQScanner.obj : error LNK2019: unresolved external symbol _amqp_basic_consume referenced in function _main

1>LeapRabbitMQScanner.obj : error LNK2001: unresolved external symbol __imp__amqp_empty_bytes

1>LeapRabbitMQScanner.obj : error LNK2001: unresolved external symbol __imp__amqp_empty_table

1>LeapRabbitMQScanner.obj : error LNK2019: unresolved external symbol _amqp_cstring_bytes referenced in function _main

1>LeapRabbitMQScanner.obj : error LNK2019: unresolved external symbol _amqp_get_rpc_reply referenced in function _main

1>LeapRabbitMQScanner.obj : error LNK2019: unresolved external symbol _amqp_channel_open referenced in function _main

1>LeapRabbitMQScanner.obj : error LNK2019: unresolved external symbol "void __cdecl die_on_amqp_error(struct amqp_rpc_reply_t_,char const *)" (?die_on_amqp_error@@YAXUamqp_rpc_reply_t_@@PBD@Z) referenced in function _main

1>LeapRabbitMQScanner.obj : error LNK2019: unresolved external symbol _amqp_login referenced in function _main

1>LeapRabbitMQScanner.obj : error LNK2019: unresolved external symbol _amqp_socket_open referenced in function _main

1>LeapRabbitMQScanner.obj : error LNK2019: unresolved external symbol "void __cdecl die(char const *,...)" (?die@@YAXPBDZZ) referenced in function _main

1>LeapRabbitMQScanner.obj : error LNK2019: unresolved external symbol _amqp_tcp_socket_new referenced in function _main

1>LeapRabbitMQScanner.obj : error LNK2019: unresolved external symbol _amqp_new_connection referenced in function _main

1>C:\Users\dseema\Documents\Visual Studio 2010\Projects\LeapRabbitMQScanner\Debug\LeapRabbitMQScanner.exe : fatal error LNK1120: 20 unresolved externals

Alan Antonuk

unread,
Apr 23, 2015, 12:16:15 AM4/23/15
to Dilip Bloch, rabbitm...@googlegroups.com
What did you do to try and build the rabbitmq library?

Given your'e trying to build for VS2010, you probably want to do something like:

cmake -G"Visual Studio 2010" C:\path\to\rabbitmq-c sources
cmake --build --config Release .

See the CMake docs for the various flags you can pass to cmake.

The various die/die_on_error/die_one_amqp_error are a part of the example code (https://github.com/alanxz/rabbitmq-c/blob/master/examples/utils.h). If you only link against the library those will always be missing. (Nothing stops you from adding those to your project though).

-Alan

--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.
To post to this group, send email to rabbitm...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Dilip Bloch

unread,
Apr 23, 2015, 1:06:07 PM4/23/15
to rabbitm...@googlegroups.com, dilipku...@gmail.com
Thanks Alan for your time.
I am using the MSVC2010 VC++ environment and working on the example project (supplied by you) to make it compile and run to publish / subscribe messages to/from RMQ.
I've assumed that there will be libraries (.lib or .dll) that will be part of the download package and understood that I've to use CMake to create them and use.
 
I am using a Windows-7, 64-bit , MSVC2010 machine and executed the CMake command that's been suggested and got this error.
 
c:\cmake-3.1.3-win32-x86\bin> cmake -G "Visual Studio 2010" C:\Dilip\LEAP\Scanners\rabbitmq-c-0.6.0
CMake Error: Could not create named generator Visual Studio 2010
 
I tried to use CMake-GUI and here is the error message
--------------------------------------------------------------------------------
The C compiler identification is MSVC 16.0.40219.1

Check for working C compiler using: Visual Studio 10 2010

CMake Error: The source directory "OUTPUT_VARIABLE" does not exist.
Specify --help for usage, or press the help button on the CMake GUI.

CMake Error: Internal CMake error, TryCompile configure of cmake failed

Check for working C compiler using: Visual Studio 10 2010 -- broken

CMake Error at C:/Dilip/LEAP/Scanners/cmake-3.1.3-win32-x86/share/cmake-3.1/Modules/CMakeTestCCompiler.cmake:61 (message):
The C compiler "c:/Program Files (x86)/Microsoft Visual Studio
10.0/VC/bin/cl.exe" is not able to compile a simple test program.

  It fails with the following output:

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
CMakeLists.txt:3 (project)

Configuring incomplete, errors occurred!

See also "/CMakeFiles/CMakeOutput.log".

See also "/CMakeFiles/CMakeError.log".

-------------------------------------------------------------------------

Is there any basic configuration that I've been missing?
 
Your help would be greatly appreciated.
--Dilip
 

Alan Antonuk

unread,
Apr 23, 2015, 1:56:51 PM4/23/15
to Dilip Bloch, rabbitm...@googlegroups.com
At this point I don't distribute binaries (there are just too many combinations of platforms/compilers/base-libraries to satisfy everyone).

The project files get generated in the directory that you run cmake in.  It looks like you're running CMake in the CMake installation directory which probably won't let you write to it.  Try creating a subdirectory where you unpacked the source (say build), and run CMake from there).

-Alan

Dilip Bloch

unread,
Apr 23, 2015, 5:09:53 PM4/23/15
to rabbitm...@googlegroups.com, dilipku...@gmail.com
Hi Alan,
I ran the cmake under the build directory and got some errors.
Could you please suggest if I have any configuration missing still.
 
Here is the error message from CMAKE
---------------------------------------------------------------------------------------
C:\Dilip\LEAP\Scanners\build\rabbitmq-c-0.6.0\build>cmake ..
-- Building for: Visual Studio 10 2010
-- The C compiler identification is MSVC 16.0.40219.1
-- Check for working C compiler using: Visual Studio 10 2010
-- Check for working C compiler using: Visual Studio 10 2010 -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Found C inline keyword: __inline
-- Looking for htonll
-- Looking for htonll - not found
-- Looking for clock_gettime in rt
-- Looking for clock_gettime in rt - not found
-- Could NOT find POPT (missing:  POPT_INCLUDE_DIR POPT_LIBRARY)
-- Could NOT find XMLTO (missing:  XMLTO_EXECUTABLE)
-- Could NOT find Doxygen (missing:  DOXYGEN_EXECUTABLE)
-- Looking for include file pthread.h
-- Looking for include file pthread.h - not found
-- Found Threads: TRUE
CMake Error at C:/Dilip/LEAP/Scanners/cmake-3.1.3-win32-x86/share/cmake-3.1/Modu
les/FindPackageHandleStandardArgs.cmake:138 (message):
  Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the
  system variable OPENSSL_ROOT_DIR (missing: OPENSSL_LIBRARIES
  OPENSSL_INCLUDE_DIR) (Required is at least version "0.9.8")

Call Stack (most recent call first):
  C:/Dilip/LEAP/Scanners/cmake-3.1.3-win32-x86/share/cmake-3.1/Modules/FindPacka
geHandleStandardArgs.cmake:374 (_FPHSA_FAILURE_MESSAGE)
  C:/Dilip/LEAP/Scanners/cmake-3.1.3-win32-x86/share/cmake-3.1/Modules/FindOpenS
SL.cmake:328 (find_package_handle_standard_args)
  CMakeLists.txt:242 (find_package)

-- Configuring incomplete, errors occurred!
See also "C:/Dilip/LEAP/Scanners/build/rabbitmq-c-0.6.0/build/CMakeFiles/CMakeOutput.log".
See also "C:/Dilip/LEAP/Scanners/build/rabbitmq-c-0.6.0/build/CMakeFiles/CMakeError.log".
C:\Dilip\LEAP\Scanners\build\rabbitmq-c-0.6.0\build>
C:\Dilip\LEAP\Scanners\build\rabbitmq-c-0.6.0\build>
---------------------------------------------------------------------------------------
Thanks,
--Dilip

Alan Antonuk

unread,
Apr 24, 2015, 1:24:09 PM4/24/15
to Dilip Bloch, rabbitm...@googlegroups.com
CMake is trying to find the OpenSSL header files and library. If you don't care about using TLS/SSL to talk to the broker, you can add -DENABLE_SSL_SUPPORT=False to the CMake command line.

AFAIK: CMake also includes a GUI on Win32, I think the executable is called cmake-gui.exe, it'll help expose some of the configuration options for you.

-Alan

Dilip Bloch

unread,
Apr 27, 2015, 12:40:39 PM4/27/15
to rabbitm...@googlegroups.com, dilipku...@gmail.com
Thanks Alan for the suggestion. That worked perfect.
 
--Dilip
Reply all
Reply to author
Forward
0 new messages