Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Solaris 11.4 system header files prevent usage of stlport4 library

User_CG5RMSep 1 2020

Using this one line C++ program  with any Solaris Studio compiler, gives an error on Solaris 11.4 when using the -library=stlport4 option.

hello.cpp

#include <iostream>

int main()

{

    std::cout << "Hello world" << std::endl;

    return 0;

}

$ /opt/solarisstudio12.4/bin/CC -m64 hello.cpp -o hello -library=stlport4

"/opt/solarisstudio12.4/lib/compilers/include/CC/stlport4/stl/_stdio_file.h", line 161: Error: __pad is not a member of const __FILE.

"/opt/solarisstudio12.4/lib/compilers/include/CC/stlport4/stl/_stdio_file.h", line 163: Error: __pad is not a member of const __FILE.

"/opt/solarisstudio12.4/lib/compilers/include/CC/stlport4/stl/_stdio_file.h", line 165: Error: __pad is not a member of const __FILE.

"/opt/solarisstudio12.4/lib/compilers/include/CC/stlport4/stl/_stdio_file.h", line 165: Error: __pad is not a member of const __FILE.

"/opt/solarisstudio12.4/lib/compilers/include/CC/stlport4/stl/_stdio_file.h", line 167: Error: __pad is not a member of const __FILE.

"/opt/solarisstudio12.4/lib/compilers/include/CC/stlport4/stl/_stdio_file.h", line 170: Error: __pad is not a member of __FILE.

"/opt/solarisstudio12.4/lib/compilers/include/CC/stlport4/stl/_stdio_file.h", line 170: Error: __pad is not a member of __FILE.

"/opt/solarisstudio12.4/lib/compilers/include/CC/stlport4/stl/_stdio_file.h", line 172: Error: __pad is not a member of __FILE.

"/opt/solarisstudio12.4/lib/compilers/include/CC/stlport4/stl/_stdio_file.h", line 172: Error: __pad is not a member of __FILE.

Comments

Frank Kulash

Hi,

You need to initialize suma, like you initialize.x:

DECLARE

    x    NUMBER (10) := 1;

    z    NUMBER;

    suma NUMBER      := 0;

BEGIN

    WHILE x <= 3

    LOOP

        z := (x * 2) + 4;

        suma := suma + z;

        x := x + 1;

    END LOOP;

    DBMS_OUTPUT.PUT_LINE (suma || ' = final suma');

END;

/

NULL plus anything is NULL, so if suma is NULL when you reach this statement

suma := suma + z;

then it will be NULL after executing that statement.

Also, you're going through the loop an extra time.  Since x starts at 0, yu're starting the loop when x is 0, 1, 2 and 3, and incrementing the sum for x as 1, 2, 3 and 4.

(I see Galo caught the same thing while I was revising this message.)

Galo Balda

Another thing is that you're doing 4 iterations since x starts with 0

Frank Kulash

Hi,

You can do this in pure SQL, too:

SELECT  SUM ((2 * LEVEL) + 4)  AS suma

FROM    dual

CONNECT BY  LEVEL  <= 3

;

1 - 3

Post Details

Added on Sep 1 2020
11 comments
671 views