Uploaded image for project: 'Qpid'
  1. Qpid
  2. QPID-6140

[C++ Messaging] UI Gotchya in Hello World example

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.30
    • 0.31
    • C++ Examples
    • None
    • Fedora 19, trunk build

    Description

      Modifying hello_world.cpp to add a simple property to a message

                  Message message("Hello world");
                  message.getProperties()["id"] = 1;
      

      fails:

      Linking CXX executable hello_world
      /usr/bin/ld: CMakeFiles/hello_world.dir/hello_world.o: undefined reference to symbol '_ZN4qpid5types7VariantC1ERKS1_'
      /usr/bin/ld: note: '_ZN4qpid5types7VariantC1ERKS1_' is defined in DSO /home/chug/git/qpid/build/src/libqpidtypes.so.1 so try adding it to the linker command line
      /home/chug/git/qpid/build/src/libqpidtypes.so.1: could not read symbols: Invalid operation
      collect2: error: ld returned 1 exit status
      make[2]: *** [examples/messaging/hello_world] Error 1
      make[1]: *** [examples/messaging/CMakeFiles/hello_world.dir/all] Error 2
      make: *** [all] Error 2
      *** Failure: Exit code 2 ***
      

      What? What's with qpid::types::Variant? The user is adding a property as specified in the Messaging API spec.

      To fix this a user must find hello_world in the cmake file and add 'qpidtypes' as a link library, rerun cmake, and then rebuild. Strictly speaking qpidtypes isn't needed for the simplest hello_world case. That said, qpidtypes is linked to qpidmessaging and must be available for hello_world to run.

      Adding qpidtypes to hello_world's target_link_libraries will help new users experiment with Qpid Messaging more fluently.

      Attachments

        Activity

          People

            Unassigned Unassigned
            chug Charles E. Rolke
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: