3 Replies Latest reply on Mar 29, 2006 4:03 AM by 807575

    Compiling C++ using Sun Studio 11

    807575
      Hi,

      I have downloaded and installed "IBM Message Service client for C/C++" (in Solaris 5.8) to publish messages to Websphere MQ Topics using C++ programs. The IBM installation comes with a compiled version of the sample programs and I am able to execute them successfully using Sun studio 11's C++ compiler. But when I try to compile these sample programs , it throws the following exception.

      mqm$ CC SampleConsumerCPP.cpp
      "SampleConsumerCPP.cpp", line 36: Error: Could not open include file<xms.hpp>.
      "SampleConsumerCPP.hpp", line 39: Error: Could not open include file<helperfunctions.h>.
      "SampleConsumerCPP.hpp", line 52: Error: xmsVOID is not defined.
      "SampleMsgListener.hpp", line 44: Error: xms is not defined.
      "SampleMsgListener.hpp", line 44: Error: MessageListener is not defined.
      "SampleMsgListener.hpp", line 55: Error: Type name expected instead of "xmsVOID".
      "SampleMsgListener.hpp", line 55: Error: "virtual" is not allowed here.
      "SampleMsgListener.hpp", line 55: Error: Identifier expected instead of "const".
      "SampleMsgListener.hpp", line 55: Error: Use ";" to terminate declarations.
      "SampleMsgListener.hpp", line 56: Error: Use ";" to terminate declarations.
      "SampleMsgListener.hpp", line 56: Error: "," expected instead of "displayMsg".
      "SampleMsgListener.hpp", line 62: Error: Use ";" to terminate declarations.
      "SampleMsgListener.hpp", line 62: Error: Type name expected instead of "xmsVOID".
      "SampleMsgListener.hpp", line 63: Error: Type name expected instead of "xmsINT".
      "SampleMsgListener.hpp", line 63: Error: Identifier expected instead of "const".
      "SampleMsgListener.hpp", line 63: Error: Multiple declaration for const.
      "SampleMsgListener.hpp", line 63: Error: Use ";" to terminate declarations.
      "SampleMsgListener.hpp", line 64: Error: Use ";" to terminate declarations.
      "SampleMsgListener.hpp", line 64: Error: Type name expected instead of "xmsVOID".
      "SampleMsgListener.hpp", line 65: Error: Type name expected instead of "xmsINT".
      "SampleMsgListener.hpp", line 65: Error: Identifier expected instead of "const".
      "SampleMsgListener.hpp", line 65: Error: Multiple declaration for const.
      "SampleMsgListener.hpp", line 65: Error: Use ";" to terminate declarations.
      "SampleMsgListener.hpp", line 67: Error: Use ";" to terminate declarations.
      "SampleMsgListener.hpp", line 73: Error: Type name expected instead of "xmsINT".
      Compilation aborted, too many Error messages.


      The compiler does not recognize the "make" command either.
      Find below my PATH settings.
      "/tools/java/j2sdk1.4.2_08/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/sbin:/data/sunstudio10/SUNWspro/bin:/opt/mqm/java/bin:/usr/openwin/bin:/data/mqapi/tools/cpp/include:/data/mqapi/tools/samples/common:/data/mqapi/lib"
      where /data/mqapi contains the XMS installation.



      Any pointers to solve this issue will be highly appreciated.

      Thanks,
      Meeraa
        • 1. Re: Compiling C++ using Sun Studio 11
          paul_floyd
          Hi,

          I have downloaded and installed "IBM Message Service
          client for C/C++" (in Solaris 5.8)
          ...
          mqm$ CC SampleConsumerCPP.cpp
          "SampleConsumerCPP.cpp", line 36: Error: Could not
          open include file<xms.hpp>.
          You probably don't want to be running CC on its own.
          The compiler does not recognize the "make" command
          either.
          Find below my PATH settings.
          "/tools/java/j2sdk1.4.2_08/bin:/usr/bin:/bin:/usr/sbin
          :/sbin:/usr/local/bin:/usr/local/sbin:/data/sunstudio1
          0/SUNWspro/bin:/opt/mqm/java/bin:/usr/openwin/bin:/dat
          a/mqapi/tools/cpp/include:/data/mqapi/tools/samples/co
          mmon:/data/mqapi/lib"
          where /data/mqapi contains the XMS installation.
          You need to set your path in your shell. Make sure that /usr/ccs/bin is in your PATH.

          Have you really installed Studio 11 in "/data/sunstudio10" - that looks a bit confuding to me!

          Paul
          • 2. Re: Compiling C++ using Sun Studio 11
            807575
            If you compile a source file as
            CC SampleConsumerCPP.cpp
            the compiler will not be able find the project header files because you didn't tell the compiler where to find them. Without the header files, references to data types, variables, and functions will not be understood, and you get a cascade of error messages.

            You will need to use the makefile to build the program, unless you want to deduce the commands that make will generate from the makefile, and type them out yourself. (Not recommended.)

            As Paul pointed out, you need to have /usr/ccs/bin on your path to access make, sccs, and other Unix programming tools.

            You might need to modify the makefile or provide command-line macros for it to work in your environment. The IBM documentation should explain what you need to do, if it is not obvious from looking at the makefile.
            • 3. Re: Compiling C++ using Sun Studio 11
              807575
              Thanks a lot for your suggestions. When I set /usr/ccs/bin in my PATH, I was able to compile the programs using the 'make' command.

              Meeraa