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

843804
There is already a topic on this subject
http://forum.java.sun.com/thread.jsp?forum=57&thread=563889

Denis Krukovsky
http://dotuseful.sourceforge.net/
843804
I can't handel this classes. I didn't find out how to use them. Is there any other, maybe easier way to sort TreeNodes?
843804
Thanks for your feedback. What you need to do is
- create a Comparator for your nodes (I believe you know what it is?) or subclass org.dotuseful.ui.tree.SortedTreeNode and implement Comparable interface in it;
- substitute your TreeModel with org.dotuseful.ui.tree.AutomatedTreeModel;
- substitute your tree nodes with org.dotuseful.ui.tree.SortedTreeNode or its subclass, and optionally provide a Comparator for them.

Here is a sketch of a node class that you need
import org.dotuseful.ui.tree;
public class ABSortTreeNode extends SortedTreeNode implements Comparable
    public int compareTo(Object o) {
        MutableTreeNode node = (MutableTreeNode)o;
        return ((Comparable)getUserObject()).compareTo(node.getUserObject());
    }
}
So having this class, you only need to
- substitute your TreeModel with org.dotuseful.ui.tree.AutomatedTreeModel;
- substitute your tree nodes with ABSortTreeNode.

I believe this is pretty easy way to sort a tree. I would make my classes understandable for everyone, so please keep asking questions.

Denis Krukovsky
http://dotuseful.sourceforge.net/
843804
Hi,
The jtree nodes are sorted in jtree display.
But how to keep folders (non-leaf-nodes) and leaf-nodes sorted separately?
I�d like to have the leaf-nodes listed first under root and then all folders followed.
Any ideas? Do you have any samples related that?
Thank you for your help in advance.
843804
Hi,

Thank you for interest in dotuseful library. Good to have people who use our work.

I'm going to write an article about directory tree creation. Stay tuned on http://dotuseful.sourceforge.net/

For this time, what you need is to modify your Comparator or compareTo() method so your folders stay before your files.

Denis Krukovsky
http://dotuseful.sourceforge.net/
843805
This is not exactly what you are looking for but might give you an idea.

Hamed
/**
	 * @param root of tree
	 * @return sorted elements alphabetically
	 */
	public static DefaultMutableTreeNode sortTree(DefaultMutableTreeNode root) {
		for (int i = 0; i < root.getChildCount(); i++) {
			DefaultMutableTreeNode node = (DefaultMutableTreeNode) root
					.getChildAt(i);
			String nt = node.getUserObject().toString();
			for (int j=0; j<i; j++) {
				DefaultMutableTreeNode prevNode = (DefaultMutableTreeNode) root
				.getChildAt(j);
				String np = prevNode.getUserObject().toString();
				if (nt.compareToIgnoreCase(np)<0) {
					root.insert(node, j);
					root.insert(prevNode, i);
				}
			}
			if (node.getChildCount() > 0) {
				node = sortTree(node);
			}
		}
		return root;
	}
843805
This is not exactly what you are looking for but might give you an idea.
Thanks a lot for your code. It helped very much
843806
Thanks Hamed,

Well, I work in your code, and I post here.
  public static DefaultMutableTreeNode sortTree(DefaultMutableTreeNode root) {
        {
                 for (int i =0; i<root.getChildCount()-1; i++) {
                		DefaultMutableTreeNode node = (DefaultMutableTreeNode) root.getChildAt(i);
                        String nt = node.getUserObject().toString();

                        for (int j=i+1;j<=root.getChildCount()-1;j++)
                        {
                            	DefaultMutableTreeNode prevNode = (DefaultMutableTreeNode) root.getChildAt(j);
				                String np = prevNode.getUserObject().toString();

                            System.out.println(nt+" "+np);
                            if (nt.compareToIgnoreCase(np)>0) {

				                  	root.insert(node, j);
					                root.insert(prevNode, i);
				              }
                        }
                        if (node.getChildCount() > 0) {
				node = sortTree(node);
			}
                 }

                 return root;
        }
    }
and this code I used after include in jtree
  public  void jTreeSortingBegin()
    {
          dn = (DefaultMutableTreeNode)treeModel.getRoot();
          treeModel.reload();
          dn = sortTree(dn);
          treeModel.reload(dn);
    }
for exemple
  addObject(jTextField1.getText());
        jTreeSortingBegin();
843806
Thank you very much, Hamed, I only had to change your code a little, replacing
root.insert(prevNode, i);
with
break;
insert(prevNode) is not necessary as insert(node) will shift the rest of the nodes. Break is necessary to begin relocating the next child (in that case we'll be done with that one).

Edited by: Victor.E on May 27, 2009 2:38 AM
1 - 9

Post Details

Added on Sep 1 2020
11 comments
680 views