本版版主招募中

 
标题: 菜鸟求助:如何在cybwin编译Sun ultra 30 station下的程序?
matriz
LU新生
Rank: 1



UID 96225
精华 0
积分 1
帖子 1
活跃指数 1
LU金币 2 个
LU金条 0 个
阅读权限 10
注册 2007-9-18
 
发表于 2007-9-18 16:49  资料  个人空间  短消息  加为好友 
菜鸟求助:如何在cybwin编译Sun ultra 30 station下的程序?

最近因课题需要,问老外要了个程序,他说是在Sun ultra 30 station下编译通过,并运行的,可是我在Sun Solaris 10 下编译说有语法错误,老是通不过,在cybwin中编译就更多错误了!麻烦各位高手看看!

Sun Solaris 10 下的错误:
top.cc:126: iso c++ forbids initialization in array new
top.cc文件:
#ifndef TOP_H
#include "top.h"
#endif

static ifstream File;
struct Tree_Struct {
      int No;
      double Time;
      int P; };     
static struct Tree_Struct Nodes[MAX_DEPTH][MAX_NODES];      
static int Node[MAX_DEPTH];
static int Parent[MAX_DEPTH];
static int I;
static char S[MAX_SYMBOLS];

static int CheckChar(char c)
    { if (c=='A' || c=='C' || c=='G'  || c=='T' || c=='-' || c=='U') return 1;
      else return 0; }
      
static void Read (int Depth)
     { char c;
       int j;      
       if (File.eof()) return;
       while (!File.eof())
             { File>>c;                     
               if (c=='(') { I=0;
                             Read(Depth+1); }                        
               else if (c==')') { S[I]='\0';
                                  j=0;
                                  if (S[0]!=':') { Nodes[Depth][Node[Depth]].No=abs(atoi(S));
                                                   for (j=0;j<MAX_SYMBOLS;j++)
                                                       if (S[j]==':') break; }
                                  Nodes[Depth][Node[Depth]].Time=fabs((double) atoi(S+j+1));
                                  for (j=0;j<MAX_SYMBOLS;j++)
                                      if (S[j]=='.') break;
                                  Nodes[Depth][Node[Depth]].Time+=(double) atoi(S+j+1)/100000;                           
                                  Nodes[Depth][Node[Depth]].P=Parent[Depth];                                 
                                  Parent[Depth+1]++;
                                  Node[Depth]++;
                                  I=0;                                 
                                  break; }
                    else if (c==',') { S[I]='\0';
                                       j=0;
                                       if (S[0]!=':') { Nodes[Depth][Node[Depth]].No=abs(atoi(S));
                                                        for (j=0;j<MAX_SYMBOLS;j++)
                                                            if (S[j]==':') break; }                                               
                                       Nodes[Depth][Node[Depth]].Time=fabs((double) atoi(S+j+1));                                       
                                       for (j=0;j<MAX_SYMBOLS;j++)
                                           if (S[j]=='.') break;                                    
                                       Nodes[Depth][Node[Depth]].Time+=(double) atoi(S+j+1)/100000;                                                            
                                       Nodes[Depth][Node[Depth]].P=Parent[Depth];
                                       Node[Depth]++;
                                       Parent[Depth+1]++;
                                       I=0;}
                         else { S[I]=c;
                                I++; }}            
       }



TreeTopology::TreeTopology (char *treefile, char *seqfile)
              { register int i,j;
                int flag,Temp;            
                double Freq[4];
                int CurrentNumber;
                ifstream fs;
                ofstream f;      
                int N[MAX_DEPTH];
               
                Gaps=85;
                Conservatism=95;
  
                for (i=0;i<MAX_DEPTH;i++)
                    { Node=0;
                      Parent=0;               
                      for (j=0;j<MAX_NODES;j++)
                          { Nodes[j].No=0;
                            Nodes[j].Time=0;
                            Nodes[j].P=-1; }}
                Nodes[0][0].P=0;            
                File.open(treefile,ios::in);
                if (File.fail())
                   { cerr << "Unable to open the tree file\n";
                     return ; }
                Read(0);           
                File.close();      

                MaxNodes=0;                       
                Depth=0;
               
                for (i=1;i<MAX_DEPTH;i++)
                    { Temp=0;
                      flag=0;
                      for (j=0;j<MAX_NODES;j++)
                      if (Nodes[j].P!=-1)
                         { Temp++;
                           flag=1; }                  
                      N=Temp;           
                      if (flag) Depth++;}               
                  
                fs.open(seqfile,ios::in);
                if (fs.fail())
                   { cerr << "Unable to open the sequence file\n";
                     return; }
      
                char c;
                c=fs.get();
                while(!CheckChar(c))
                     c=fs.get();
                     
                Length=0;
                while(CheckChar(c))
                     { Length++;
                       c=fs.get(); }   
                                             
                N[0]=1;            
               
                Tree=new struct Leaves[Depth+1];                                                
                for (i=0;i<=Depth;i++)
                    { register int Nodes=N;
                      Tree.Nodes=Nodes;
                      if (MaxNodes<Nodes) MaxNodes=Nodes;
                      Tree.Times=new double[Nodes];
                      Tree.Parent=new int [Nodes];
                      Tree.Number=new int [Nodes];
                      Tree.Strands=new Strand[Nodes](Length); }     %就是这里报错!!!
                     
                for (i=0;i<=Depth;i++)
                    for (j=0;j<Tree.Nodes;j++)
                        { Tree.Times[j]=Nodes[j].Time;
                          Tree.Parent[j]=Nodes[j].P;
                          Tree.Number[j]=Nodes[j].No; }      
                                 
                NumberOfSequences=0;
                SiteIndex=new int [Length];      

                while(!fs.eof())
                     { if (c=='\n') NumberOfSequences++;
                       c=fs.get(); }      
                fs.close();  
               
                char S[NumberOfSequences][Length];     
                fs.open(seqfile,ios::in);                       
                c=fs.get();
                for (i=0;i<NumberOfSequences;i++)
                    { while(!CheckChar(c))
                           c=fs.get();
                      for (j=0;j<Length;j++)
                          { if (!CheckChar(c))
                               { cerr<<"Bad character in the sequences file !\n";
                                 return; }
                      if (c=='U') S[j]='T';           
                      else S[j]=c;
                      c=fs.get(); }}                       
                fs.close();                     
                     
                for (i=0;i<Length;i++)
                    { CurrentNumber=NumberOfSequences;
                      for (j=0;j<4;j++)
                          Freq[j]=0;
                      for (j=0;j<NumberOfSequences;j++)
                          switch (S[j])
                          { case 'A' : Freq[0]++;
                                       break;
                            case 'C' : Freq[1]++;
                                       break;           
                            case 'G' : Freq[2]++;
                                       break;
                            case 'T' : Freq[3]++;
                                       break;
                            default : CurrentNumber--; }                                             
                      SiteIndex=0;                     
                      if ((Freq[0]+Freq[1]+Freq[2]+Freq[3])/NumberOfSequences>(double)Gaps/100) SiteIndex=1;
                      for (j=0;j<4;j++)
                          if (Freq[j]/CurrentNumber>(double)Conservatism/100) SiteIndex=0; }
                f.open("sequences.txt",ios:ut);
                for (i=0;i<=Depth;i++)
                    for (j=0;j<Tree.Nodes;j++)
                        { Temp=Nodes[j].No;            
                          if (Temp==0) f<<'X';
                          else for (int k=0;k<Length;k++)
                                   if (S[Temp-1][k]=='-') f<<'N';
                                   else f<<S[Temp-1][k];
                          f<<'\n'; }                                                  
                 }
                 
TreeTopology::~TreeTopology()
              { register int i;
                delete SiteIndex;
                for (i=0;i<=Depth;i++)
                    { delete Tree.Times;
                      delete Tree.Parent;
                      delete Tree.Number;
                      delete [] Tree.Strands;
                    }               
                delete [] Tree;   }

顶部
oraix
版主
Rank: 15Rank: 15Rank: 15Rank: 15Rank: 15


UID 69
精华 6
积分 298
帖子 472
活跃指数 89
LU金币 6385 个
LU金条 0 个
阅读权限 210
注册 2003-9-21
来自 中国
 
发表于 2007-9-18 23:28  资料  个人空间  主页 短消息  加为好友  QQ
是缺什么依赖的包 或者头文件, stand是什么?
还是在solaris平台上去编译吧,





::::uncle:::
:::oraix::::

oraix[at]hotmail.com

招聘WEB 2.0开发人员
顶部
 



当前时区 GMT+8, 现在时间是 2008-7-9 17:45
乐悠LoveUnix论坛-京ICP备05005823号

Thanks to Discuz!  © 2001-2007    Power by LoveUnix.net
Processed in 0.143620 second(s), 6 queries , Gzip enabled

清除 Cookies - 联系我们 - 乐悠LoveUnix - Archiver - WAP