1 2 Previous Next 23 Replies Latest reply on Oct 8, 2008 9:20 PM by 807575

    Compilation error, When moving from 32-bit to 64-bit code

    807575
      Hello,
      I m getting Compilation error, This program already compiled on 32 bit, but getting compilation error on 64 bit.

      CC -V
      CC: Sun C++ 5.9 SunOS_sparc Patch 124863-01 2007/07/25




      make
      Making dependencies...
      cc -g -D__EXTENSIONS__ -D_SVID_GETTOD -I../h -I/app/oracle/product/9.2_32/precomp/public -I. -xcg92 `getconf LFS_CFLAGS | head -1` -D UT_TRACE_FUNCTION -Dbool=int -g -D -I. -m64 -xarch=sparcvis -H -w -E 2>&1 >/dev/null Bitmap.cc BitmapData.cc BitmapInputTxnStream.cc BitmapOutputStream.cc UnexpectedException.cc FieldData.cc FieldDataCollection.cc FieldDefinition.cc FieldDefinitionCollection.cc OutputFixedStream.cc ParsingEngine.cc Schema.cc Statistics.cc String.cc TraceStream.cc TxnStream.cc c_api.cc SocketImpl.cc Socket.cc ServerSocket.cc UnixSocket.cc Thread.cc test.cc | grep -v License | grep -v command | ../dvl.bin/mkdep >.depends
      Dependencies updated...
      CC -g -D__EXTENSIONS__ -D_SVID_GETTOD -I../h -I/app/oracle/product/9.2_32/precomp/public -I. -xcg92 `getconf LFS_CFLAGS | head -1` -D UT_TRACE_FUNCTION -Dbool=int -g -D -I. -m64 -xarch=sparcvis -c Bitmap.cc
      "/opt/SUNWspro/prod/include/CC/Cstd/./limits", line 1046: Error: Multiple declaration for std::numeric_limits<int>.
      "/opt/SUNWspro/prod/include/CC/Cstd/./ostream", line 192: Error: Multiple declaration for std::ostream::operator<<(int).
      "/opt/SUNWspro/prod/include/CC/Cstd/./ostream", line 351: Where: While specializing "std::ostream ".
      "/opt/SUNWspro/prod/include/CC/Cstd/./ostream", line 351: Where: Specialized in non-template code.
      "/opt/SUNWspro/prod/include/CC/Cstd/./ostream", line 192: Error: Multiple declaration for std::wostream::operator<<(int).
      "/opt/SUNWspro/prod/include/CC/Cstd/./ostream", line 354: Where: While specializing "std::wostream ".
      "/opt/SUNWspro/prod/include/CC/Cstd/./ostream", line 354: Where: Specialized in non-template code.
      "/opt/SUNWspro/prod/include/CC/Cstd/./istream", line 104: Error: Multiple declaration for std::istream::operator>>(int&).
      "/opt/SUNWspro/prod/include/CC/Cstd/./istream", line 373: Where: While specializing "std::istream ".
      "/opt/SUNWspro/prod/include/CC/Cstd/./istream", line 373: Where: Specialized in non-template code.
      "/opt/SUNWspro/prod/include/CC/rw7/rw/defs.h", line 316: Error: A typedef name cannot be used in an elaborated type specifier..
      "/opt/SUNWspro/prod/include/CC/rw7/rw/defs.h", line 317: Error: A typedef name cannot be used in an elaborated type specifier..
      "/opt/SUNWspro/prod/include/CC/rw7/rw/defs.h", line 318: Error: A typedef name cannot be used in an elaborated type specifier..
      "RuntimeException.h", line 131: Error: Function RuntimeException::~RuntimeException() can throw only the exceptions thrown by the function std::exception::~exception() it overrides.
      "RuntimeException.h", line 97: Error: Could not find std::exception::exception(const char*) to initialize base class.
      "RuntimeException.h", line 121: Error: xmsg is not a member of std::exception.
      "Bitmap.cc", line 62: Error: Cannot return int(Bitmap::*)()const from a function that should return int.
      11 Error(s) detected.
      make: *** [Bitmap.o] Error 11

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

      In Makefile CFLAGS setting are as follows,

      ###
      ### Setup common symbols for .depends
      SRC = $(TEST_SRC)
      INCLUDES = $(TEST_INC)

      # clean objects, executeable, generated .pc -> .c
      CLEAN = -r *.o $(PGM_EXEC) Templates.DB/* SunWS_cache/*


      include $(ROOT)/h/common.mak


      # The system include directory must be specifically included first because some of the
      # ghost includes use system include file names (e.g., generic.h)

      # Modified these section to compile on TVLAPP1HAG

      CFLAGS += -D $(STDOUT_TRACE)
      CFLAGS += -Dbool=int -g -D$(MAINLINE) $(OUR_COLLECTION)

      #CFLAGS += -compat -Qoption ccfe -abirel=4.1
      #CFLAGS += -Qoption ccfe -abirel=4.1
      CFLAGS += -I. -m64 -xarch=sparcvis
      #CFLAGS += -I. -mt

      # Add the flag for multi-threaded apps

      LDFLAGS += -lsocket -lnsl -lthread

      # declare an empty macro for compiler directive flags, to be command-line
      # driven (ie, for -D directives)
      CCFLAGS=

      CCFLAGS += -DRW_NO_CPP_RECURSION

      #
      # The following manipulation of CC and overriding the .cc.o suffix
      # dependency is removed here to use what is supplied by default int
      # the h/common.mak file.
      #XX = CC
      #CC = CC

      #COMPILE = $(CC) -o $*.o $(CFLAGS) $(CCFLAGS) -c $*.cc

      #.cc.o:
      # $(COMPILE)

      Please Help
        • 1. Re: Compilation error, When moving from 32-bit to 64-bit code
          807575
          On the CC command line, redefining 'bool' to be 'int' (via -Dbool=int) will cause compilation and link failures. You cannot redefine C++ reserved words and expect a useful result.

          The command line also shows
          -D -I.
          which cannot be correct. Either the -D should not be there, or the command line as shown is not accurate.

          Finally, why are you using the -xcg92 option? This option is obsolete and should not be used with any recent compiler. (Refer to the C++ Users Guide Appendix A, for an explanation of this and other options.)
          • 2. Re: Compilation error, When moving from 32-bit to 64-bit code
            807575
            I have done the required changes, but still getting error

            make
            Making dependencies...
            cc -g -D__EXTENSIONS__ -D_SVID_GETTOD -I../h -I/app/oracle/product/9.2_32/precomp/public -I. `getconf LFS_CFLAGS | head -1` -D UT_TRACE_FUNCTION -I. -m64 -xarch=sparcvis -H -w -E 2>&1 >/dev/null Bitmap.cc BitmapData.cc BitmapInputTxnStream.cc BitmapOutputStream.cc UnexpectedException.cc FieldData.cc FieldDataCollection.cc FieldDefinition.cc FieldDefinitionCollection.cc OutputFixedStream.cc ParsingEngine.cc Schema.cc Statistics.cc String.cc TraceStream.cc TxnStream.cc c_api.cc SocketImpl.cc Socket.cc ServerSocket.cc UnixSocket.cc Thread.cc test.cc | grep -v License | grep -v command | ../dvl.bin/mkdep >.depends
            Dependencies updated...
            CC -g -D__EXTENSIONS__ -D_SVID_GETTOD -I../h -I/app/oracle/product/9.2_32/precomp/public -I. `getconf LFS_CFLAGS | head -1` -D UT_TRACE_FUNCTION -I. -m64 -xarch=sparcvis -c Bitmap.cc
            "/opt/SUNWspro/prod/include/CC/rw7/rw/defs.h", line 316: Error: A typedef name cannot be used in an elaborated type specifier..
            "/opt/SUNWspro/prod/include/CC/rw7/rw/defs.h", line 317: Error: A typedef name cannot be used in an elaborated type specifier..
            "/opt/SUNWspro/prod/include/CC/rw7/rw/defs.h", line 318: Error: A typedef name cannot be used in an elaborated type specifier..
            "RuntimeException.h", line 131: Error: Function RuntimeException::~RuntimeException() can throw only the exceptions thrown by the function std::exception::~exception() it overrides.
            "RuntimeException.h", line 97: Error: Could not find std::exception::exception(const char*) to initialize base class.
            "RuntimeException.h", line 121: Error: xmsg is not a member of std::exception.
            "Bitmap.cc", line 62: Error: Cannot return int(Bitmap::*)()const from a function that should return int.
            7 Error(s) detected.
            make: *** [Bitmap.o] Error 7
            • 3. Re: Compilation error, When moving from 32-bit to 64-bit code
              807575
              Hello,
              Still I m getting these error's
              Making dependencies...
              cc -g -D__EXTENSIONS__ -D_SVID_GETTOD -I../h -I/app/oracle/product/9.2_32/precomp/public -I. `getconf LFS_CFLAGS | head -1` -D UT_TRACE_FUNCTION -I. -m64 -xarch=v9 -library=iostream,no%Cstd -H -w -E 2>&1 >/dev/null Bitmap.cc BitmapData.cc BitmapInputTxnStream.cc BitmapOutputStream.cc UnexpectedException.cc FieldData.cc FieldDataCollection.cc FieldDefinition.cc FieldDefinitionCollection.cc OutputFixedStream.cc ParsingEngine.cc Schema.cc Statistics.cc String.cc TraceStream.cc TxnStream.cc c_api.cc SocketImpl.cc Socket.cc ServerSocket.cc UnixSocket.cc Thread.cc test.cc | grep -v License | grep -v command | ../dvl.bin/mkdep >.depends
              Dependencies updated...
              CC -g -D__EXTENSIONS__ -D_SVID_GETTOD -I../h -I/app/oracle/product/9.2_32/precomp/public -I. `getconf LFS_CFLAGS | head -1` -D UT_TRACE_FUNCTION -I. -m64 -xarch=v9 -library=iostream,no%Cstd -c Bitmap.cc
              CC: Warning: -xarch=v9 is deprecated, use -m64 to create 64-bit programs
              "RuntimeException.h", line 131: Error: Function RuntimeException::~RuntimeException() can throw only the exceptions thrown by the function std::exception::~exception() it overrides.
              "RuntimeException.h", line 97: Error: Could not find std::exception::exception(const char*) to initialize base class.
              "RuntimeException.h", line 121: Error: xmsg is not a member of std::exception.
              "Bitmap.cc", line 62: Error: Cannot return int(Bitmap::*)()const from a function that should return int.
              4 Error(s) detected.
              make: *** [Bitmap.o] Error 4

              Thanks
              • 4. Re: Compilation error, When moving from 32-bit to 64-bit code
                807575
                It looks like you are trying to use the standard exception class from libCstd while excluding the standard library from from the compilation. That won't work.

                The reference to "xmsg" might be from very old code that was intended to be compiled with C++ 4.2, or with a later compiler in -compat=4 mode.

                The -compat=4 option is not available in 64-bit mode, so your problems might be due to taking pre-standard C++ code and trying to compile it in standard mode. You probably need to migrate your code to standard C++.

                I would do this:

                1. Remove -library=iostream,no%Cstd from the command line.
                2. Compile the code (you will have to recompile all the C++ code).
                3. FIx the code that generates errors by referencing the C++ Migration Guide
                [http://docs.sun.com/app/docs/doc/819-3689]

                The Migration Guide lists every problem you can run into when migrating old code to standard C++, with examples of how to fix the code.
                • 5. Re: Compilation error, When moving from 32-bit to 64-bit code
                  807575
                  Hello,
                  Still I am not able to solve the error. please help me.. Please see the below code...
                  ----------------------------------------------------------------------------------------------------------------------------------------------------------------
                  Error:
                  s3dvap983:/export/home/pshirode/rel_v95/cc_lib > make
                  Making dependencies...
                  cc -g -D__EXTENSIONS__ -D_SVID_GETTOD -I../h -I/app/oracle/product/9.2_32/precomp/public -I. `getconf LFS_CFLAGS | head -1` -D UT_TRACE_FUNCTION -g -D -I. -m64 -xarch=sparcvis -H -w -E 2>&1 >/dev/null Bitmap.cc BitmapData.cc BitmapInputTxnStream.cc BitmapOutputStream.cc UnexpectedException.cc FieldData.cc FieldDataCollection.cc FieldDefinition.cc FieldDefinitionCollection.cc OutputFixedStream.cc ParsingEngine.cc Schema.cc Statistics.cc String.cc TraceStream.cc TxnStream.cc c_api.cc SocketImpl.cc Socket.cc ServerSocket.cc UnixSocket.cc Thread.cc test.cc | grep -v License | grep -v command | ../dvl.bin/mkdep >.depends
                  Dependencies updated...
                  CC -g -D__EXTENSIONS__ -D_SVID_GETTOD -I../h -I/app/oracle/product/9.2_32/precomp/public -I. `getconf LFS_CFLAGS | head -1` -D UT_TRACE_FUNCTION -g -D -I. -m64 -xarch=sparcvis -c Bitmap.cc
                  "/opt/SUNWspro/prod/include/CC/rw7/rw/defs.h", line 316: Error: A typedef name cannot be used in an elaborated type specifier..
                  "/opt/SUNWspro/prod/include/CC/rw7/rw/defs.h", line 317: Error: A typedef name cannot be used in an elaborated type specifier..
                  "/opt/SUNWspro/prod/include/CC/rw7/rw/defs.h", line 318: Error: A typedef name cannot be used in an elaborated type specifier..
                  "RuntimeException.h", line 137: Error: Function RuntimeException::~RuntimeException() can throw only the exceptions thrown by the function std::exception::~exception() it overrides.
                  "RuntimeException.h", line 103: Error: Could not find std::exception::exception(const char*) to initialize base class.
                  "RuntimeException.h", line 127: Error: xmsg is not a member of std::exception.
                  "Bitmap.cc", line 62: Error: Cannot return int(Bitmap::*)()const from a function that should return int.
                  7 Error(s) detected.
                  make: *** [Bitmap.o] Error 7
                  ----------------------------------------------------------------------------------------------------------------------------------------------------------------
                  96 class RuntimeException : public xmsg {
                  97 public:
                  98
                  99 /**
                  100 * Create an exception with a simple error message
                  101 * @param message The error message
                  102 */
                  103 RuntimeException(const char* msg) : xmsg(msg) {}
                  104
                  105 /**
                  106 * Create an exception with an error code, fileinfo, and message. This will
                  107 * produce an error message that looks like:
                  108 * in File:%s at line#: %d \n %error_message%
                  109 *
                  110 * @param error An integer error code. The catch block can use the error()
                  111 * method to examine this value
                  112 * @param fileinfo The location in a source file where the error occured
                  113 * @param msg The error message
                  114 * @see RuntimeException.error
                  115 */
                  116 RuntimeException(int p_error, const Fileinfo& f, const char* msg)
                  117 {
                  118 error = perror;
                  119 strstream buffer;
                  120 buffer << "in File:"
                  121 << f.filename()
                  122 << " at line#:"
                  123 << f.lineno() << endl << msg
                  124 << ends; // required for this strstream library, other versions
                  125 // like Borland the stream is always null terminated
                  126
                  127 xmsg::xmsg(buffer.str());
                  128 delete buffer.str(); // added by db 03-Jul-98 accoprding to the
                  129 // ssbuf(3C++) man page - other implementations may
                  130 // use malloc/free but Solaris uses new/delete
                  131 }
                  132
                  133 /** @return the error code */
                  134 int error() {return _error;}
                  135
                  136 /** Clean up instance */
                  137 virtual ~RuntimeException() {}
                  138
                  139
                  140 protected:
                  141
                  142 /**
                  143 * Default constructor - not very useful to throw an exception without at
                  144 * least an error message, so this is reserved for only subclasses.
                  145 */
                  146 RuntimeException() : xmsg() {}
                  147
                  148 private:
                  149
                  150 /** the error code associated with the error */
                  151 int _error;
                  152 };
                  153
                  • 6. Re: Compilation error, When moving from 32-bit to 64-bit code
                    807575
                    You appear to be using the RW Tools.h++ library that comes with the compiler, but the CC command line does not explicitly show the required option. Probably the option comes from
                    `getconf LFS_CFLAGS | head -1`
                    I suspect that expands to -library=rwtools7 among possibly other options. Please run the command
                    getconf LFS_CFLAGS | head -1
                    (without the back quotes) and see what it does. You will need to run it in the same context as the makefile. Probably the simplest thing is to insert the command
                    echo `getconf LFS_CFLAGS`
                    in the place where the CC command is run.

                    The option -library=rwtools7 needs to be replaced by -library=rwtools7_std to use RW Tools with the C++ standard library.

                    The command line still has the sequence
                    -D -I. 
                    which is not correct, and could result in compilation failures. Either find out what is supposed to follow the -D, or remove the -D.
                    • 7. Re: Compilation error, When moving from 32-bit to 64-bit code
                      807575
                      Hello,
                      Still my problem is not solved..... Please help
                      now I m getting error while compiling is as follows,

                      s3dvap983:/export/home/pshirode/rel_v95/cc_lib > make
                      Making dependencies...
                      cc -g -D__EXTENSIONS__ -D_SVID_GETTOD -I../h -I/app/oracle/product/9.2_32/precomp/public -I. `getconf LFS_CFLAGS | head -1` -g -D -m64 -xarch=sparcvis -library=rwtools7_std -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -H -w -E 2>&1 >/dev/null Bitmap.cc BitmapData.cc BitmapInputTxnStream.cc BitmapOutputStream.cc UnexpectedException.cc FieldData.cc FieldDataCollection.cc FieldDefinition.cc FieldDefinitionCollection.cc OutputFixedStream.cc ParsingEngine.cc Schema.cc Statistics.cc String.cc TraceStream.cc TxnStream.cc c_api.cc SocketImpl.cc Socket.cc ServerSocket.cc UnixSocket.cc Thread.cc test.cc | grep -v License | grep -v command | ../dvl.bin/mkdep >.depends
                      Dependencies updated...
                      CC -g -D__EXTENSIONS__ -D_SVID_GETTOD -I../h -I/app/oracle/product/9.2_32/precomp/public -I. `getconf LFS_CFLAGS | head -1` -g -D -m64 -xarch=sparcvis -library=rwtools7_std -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -c Bitmap.cc
                      "RuntimeException.h", line 137: Error: Function RuntimeException::~RuntimeException() can throw only the exceptions thrown by the function std::exception::~exception() it overrides.
                      "RuntimeException.h", line 103: Error: Could not find std::exception::exception(const char*) to initialize base class.
                      "RuntimeException.h", line 127: Error: xmsg is not a member of std::exception.
                      "Bitmap.cc", line 62: Error: Cannot return int(Bitmap::*)()const from a function that should return int.
                      4 Error(s) detected.
                      make: *** [Bitmap.o] Error 4
                      • 8. Re: Compilation error, When moving from 32-bit to 64-bit code
                        807575
                        As I noted earlier, these error messages look like they come from using the option -library=rwtools7 instead of -library=rwtools7_std.

                        You need to find out what
                        getconf LFS_CFLAGS | head -1
                        expands to. Until you answer that question, I cannot provide any additional help.

                        Please also remove the empty -D option, or replace with whatever it is supposed to be.
                        • 9. Re: Compilation error, When moving from 32-bit to 64-bit code
                          807575
                          Hello,
                          s3dvap983:/export/home/pshirode/rel_v95/cc_lib > getconf LFS_CFLAGS | head -1
                          -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
                          --------------------------------------------------------------------------------------------------------------------------

                          Makefile flags are as follows,
                          CFLAGS += -g $(OUR_COLLECTION)

                          #CFLAGS += -compat -Qoption ccfe -abirel=4.1
                          #CFLAGS += -Qoption ccfe -abirel=4.1
                          CFLAGS += -m64 -xarch=sparcvis -library=rwtools7_std -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
                          #CFLAGS += -I. -m64 -xarch=sparcvis -library=rwtools7 -library=iostream
                          #CFLAGS += -I. -mt

                          # Add the flag for multi-threaded apps

                          LDFLAGS += -lsocket -lnsl -lthread

                          # declare an empty macro for compiler directive flags, to be command-line
                          # driven (ie, for -D directives)
                          CCFLAGS=

                          CCFLAGS += -DRW_NO_CPP_RECURSION




                          --------------------------------------------------------------------------------------------------------------------------
                          s3dvap983:/export/home/pshirode/rel_v95/cc_lib > make
                          Making dependencies...
                          cc -g -D__EXTENSIONS__ -D_SVID_GETTOD -I../h -I/app/oracle/product/9.2_32/precomp/public -I. `getconf LFS_CFLAGS | head -1` -g -m64 -xarch=sparcvis -library=rwtools7_std -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -H -w -E 2>&1 >/dev/null Bitmap.cc BitmapData.cc BitmapInputTxnStream.cc BitmapOutputStream.cc UnexpectedException.cc FieldData.cc FieldDataCollection.cc FieldDefinition.cc FieldDefinitionCollection.cc OutputFixedStream.cc ParsingEngine.cc Schema.cc Statistics.cc String.cc TraceStream.cc TxnStream.cc c_api.cc SocketImpl.cc Socket.cc ServerSocket.cc UnixSocket.cc Thread.cc test.cc | grep -v License | grep -v command | ../dvl.bin/mkdep >.depends
                          Dependencies updated...
                          CC -g -D__EXTENSIONS__ -D_SVID_GETTOD -I../h -I/app/oracle/product/9.2_32/precomp/public -I. `getconf LFS_CFLAGS | head -1` -g -m64 -xarch=sparcvis -library=rwtools7_std -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -c Bitmap.cc
                          "RuntimeException.h", line 137: Error: Function RuntimeException::~RuntimeException() can throw only the exceptions thrown by the function std::exception::~exception() it overrides.
                          "RuntimeException.h", line 103: Error: Could not find std::exception::exception(const char*) to initialize base class.
                          "RuntimeException.h", line 127: Error: xmsg is not a member of std::exception.
                          "Bitmap.cc", line 62: Error: Cannot return int(Bitmap::*)()const from a function that should return int.
                          4 Error(s) detected.
                          make: *** [Bitmap.o] Error 4
                          • 10. Re: Compilation error, When moving from 32-bit to 64-bit code
                            807575
                            OK, now we have eliminated problems with possibly inconsistent compiler options. I can explain some of the errors and give you an idea of what you need to do to fix the source code in your application.

                            "RuntimeException.h", line 137: Error: Function RuntimeException::~RuntimeException() can throw only the exceptions thrown by the function std::exception::~exception() it overrides.
                            Apparently class RuntimeException is derived from std::exception. A basic C++ rule is that an overriding virtual function cannot be declared to throw any exceptions that are not allowed by the base class function. The destructor for std::exception is declared not to throw any exceptions:
                             virtual ~exception( ) throw( ) { } 
                            Recall that absence of a throw clause means a function is allowed to throw any exception. The RuntimeException destructor must therefore have an empty throw clause:
                            ~RuntimeException() throw ( ) { ... } 
                            "RuntimeException.h", line 103: Error: Could not find std::exception::exception(const char*) to initialize base class.
                            The std::exception class does not have a constructor (other than the copy constructor)
                            that accepts an argument. You will have to modify the code not to pass an argument to the constructor.


                            "RuntimeException.h", line 127: Error: xmsg is not a member of std::exception.
                            As the error message says, there is no xmsg member of std::exception. You will have to figure out what the code is attempting to do, and write it in terms of what is available in the standard exception classes.


                            "Bitmap.cc", line 62: Error: Cannot return int(Bitmap::*)()const from a function that should return int.
                            I can't tell what the coding error is here, but it involves only the code in Bitmap.cc. It appears a function that surrounds line 62 in the file attempts to return a pointer to a member function of class Bitmap, when the function is declared to return int. If the error is not obvious, post the code for this function.
                            • 11. Re: Compilation error, When moving from 32-bit to 64-bit code
                              807575
                              OK, now we have eliminated problems with possibly inconsistent compiler options. I can explain some of the errors and give you an idea of what you need to do to fix the source code in your application.

                              "RuntimeException.h", line 137: Error: Function RuntimeException::~RuntimeException() can throw only the exceptions thrown by the function std::exception::~exception() it overrides.
                              Apparently class RuntimeException is derived from std::exception. A basic C++ rule is that an overriding virtual function cannot be declared to throw any exceptions that are not allowed by the base class function. The destructor for std::exception is declared not to throw any exceptions:
                               virtual ~exception( ) throw( ) { } 
                              Recall that absence of a throw clause means a function is allowed to throw any exception. The RuntimeException destructor must therefore have an empty throw clause:
                              ~RuntimeException() throw ( ) { ... } 
                              "RuntimeException.h", line 103: Error: Could not find std::exception::exception(const char*) to initialize base class.
                              The std::exception class does not have a constructor (other than the copy constructor)
                              that accepts an argument. You will have to modify the code not to pass an argument to the constructor.
                              ...

                              "RuntimeException.h", line 127: Error: xmsg is not a member of std::exception.
                              As the error message says, there is no xmsg member of std::exception. You will have to figure out what the code is attempting to do, and re-write it in terms of what is available in the standard exception classes.
                              ...


                              "Bitmap.cc", line 62: Error: Cannot return int(Bitmap::*)()const from a function that should return int.
                              I can't tell what the coding error is here, but it involves only the code in Bitmap.cc. It appears a function that su line 62 in the file is attempting to return a pointer to a member function of class Bitmap when the function is declared to return int. If the error is not obvious, post the code for this function.
                              • 12. Re: Compilation error, When moving from 32-bit to 64-bit code
                                807575
                                Some messages seem to have temporarily disappeared, but are now back. Sorry for the repetition, but I composed answers 3 times while trying to work around missing messages.

                                "RuntimeException.h", line 137: Error: Function RuntimeException::~RuntimeException() can throw only the exceptions thrown by the function std::exception::~exception() it overrides.
                                Apparently class RuntimeException is derived from std::exception. A basic C++ rule is that an overriding virtual function cannot be declared to throw any exceptions that are not allowed by the base class function. The destructor for std::exception is declared not to throw any exceptions:
                                 virtual ~exception( ) throw( ) { } 
                                Recall that absence of a throw clause means a function is allowed to throw any exception. The RuntimeException destructor must therefore have an empty throw clause:
                                ~RuntimeException() throw ( ) { ... } 
                                "RuntimeException.h", line 103: Error: Could not find std::exception::exception(const char*) to initialize base class.
                                The std::exception class does not have a constructor (other than the copy constructor) that accepts an argument. You will have to modify the code not to pass an argument to the constructor.
                                ---

                                "RuntimeException.h", line 127: Error: xmsg is not a member of std::exception.
                                As the error message says, there is no xmsg member of std::exception. You will have to figure out what the code is attempting to do, and re-write it in terms of what is available in the standard exception classes.

                                My guess is that the previous two errors are due to using a pre-standard exception class that had a char* member xmsg that contained text of an error message, and a constructor that took a char* argument. If so, you can store the message in class RuntimeException instead of in std::exception.
                                ---

                                "Bitmap.cc", line 62: Error: Cannot return int(Bitmap::*)()const from a function that should return int.
                                I can't tell what the coding error is here, but it involves only the code in Bitmap.cc. It appears a function that surrounds line 62 in the file is attempting to return a pointer to a member function of class Bitmap, when the function is declared to return int. If the error is not obvious, post the code for this function.
                                • 13. Re: Compilation error, When moving from 32-bit to 64-bit code
                                  807575
                                  Hello,
                                  Here is code for Bitmap.cc

                                  59 int Bitmap::count() const {
                                  60 for (int i=0, count=0; i<size(); i++)
                                  61 if (isSet(i)) count++;
                                  62 return count;
                                  63 }


                                  And in Bitmap.h, Bitmap class is declared as,

                                  class Bitmap
                                  {
                                  public:
                                  Bitmap(); // construct an empty bitmap - use add() to init
                                  Bitmap(String p_value); // construct the bitmap with the specified value
                                  void add(String p_value);// add another set of bits to the bit map
                                  void add() {add(String('\0',8));} // add another set of bits to the bit map
                                  void set(int x); // set the xth bit
                                  void next(); // advance to the next bit that is set
                                  void reset(); // reset the next() iterator (done automatically
                                  // the constructor)
                                  friend ostream& operator<<(ostream& os, Bitmap* b);
                                  friend ostream& operator<<(ostream& os, Bitmap& b);

                                  String value() const {return _value;}
                                  int currentBit() const; // the bit# the 'next' iterator refers to
                                  int count() const; // return the number of set bits
                                  bool eof() const; // true when the next iterator has found the
                                  // last set bit

                                  // helper functions for the iterator - made public just in case they might
                                  // be reused
                                  int whichByte(int bitNumber) const; // convert bit# to byte#
                                  int whichBit (int bitNumber) const; // convert bit# to offset in a byte(0..7)
                                  bool isSet (int bitNumber) const; // is the nth bit set?
                                  int size() const; // # of bits the bit map has

                                  private:
                                  String _value;           // the bitmap - must be binary data, and can be of
                                  // infinite length
                                  int _currentBit;         // used by the next iterator to point to the next
                                  // bit that is set
                                  };
                                  ____________________________________________________________________________

                                  Still I m getting these error,

                                  s3dvap983:/export/home/pshirode/rel_v95/cc_lib > make
                                  Dependencies updated...
                                  CC -g -D__EXTENSIONS__ -D_SVID_GETTOD -I../h -I/app/oracle/product/9.2_32/precomp/public -I. `getconf LFS_CFLAGS | head -1` -g -m64 -xarch=sparcvis -library=rwtools7_std -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -c Bitmap.cc
                                  "RuntimeException.h", line 127: Error: Could not find a match for std::exception::exception(RuntimeException, char*) needed in RuntimeException::RuntimeException(int, const Fileinfo&, const char*).
                                  "Bitmap.cc", line 62: Error: Cannot return int(Bitmap::*)()const from a function that should return int.
                                  2 Error(s) detected.
                                  make: *** [Bitmap.o] Error 2
                                  --------------------------------------------------------------------------------------------------------------------------------------------

                                  Please help
                                  • 14. Re: Compilation error, When moving from 32-bit to 64-bit code
                                    807575
                                    int Bitmap::count() const {
                                        for (int i=0, count=0; i<size(); i++)
                                            if (isSet(i)) count++;
                                        return count;
                                    } 
                                    The count in the for loop refers to the function name. it does not declare a new variable.
                                    There is no way to declare two variables in the header of a for loop.

                                    Giving a local variable the same name as its function can only lead to confusion, so I suggest choosing a different name. Here is code that will work:
                                    int Bitmap::count() const {
                                        int cnt = 0;
                                        for (int i=0; i<size(); i++)
                                            if (isSet(i)) cnt++;
                                        return cnt;
                                    }
                                    But calling the non-inline function size() every time through the loop seems like a poor idea, since its return value does not change. I would do this:
                                    int Bitmap::count() const {
                                        int cnt = 0;
                                        int sz = size();
                                        for (int i=0; i<sz; i++)
                                            if (isSet(i)) cnt++;
                                        return cnt;
                                    }
                                    We have already discussed the error "RuntimeException.h", line 127.
                                    1 2 Previous Next