replica nfl jerseysreplica nfl jerseyssoccer jerseyreplica nfl jerseys forums.silverfrost.com :: View topic - SCC: Standard Template Library
forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

SCC: Standard Template Library

 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support
View previous topic :: View next topic  
Author Message
jjgermis



Joined: 21 Jun 2006
Posts: 404
Location: N�rnberg, Germany

PostPosted: Mon Oct 24, 2011 2:44 pm    Post subject: SCC: Standard Template Library Reply with quote

I have a small C++ example program and thought I can compile it with SCC. Unfortunately it seems that the STL library is unknown to SCC. Is this correct?

Code:
#include <iostream.h>
#include <string.h>
#include <vector.h>
#include <fstream.h>
#include <math.h>
#include <time.h>
#include <iomanip.h>

string LOCATION;
int Imax, Imin, dI, dtheta;

int main(int argc, char * argv[])
{
  int n=0;
  for (n=0; n<argc; n++)
  {
    printf(argv[n]);
    printf("\n");
  }

    string tmp;
    tmp = argv[2];  // Imax
    from_string<int>(Imax, tmp, std::dec);
    tmp = argv[3];  // Imin
    from_string<int>(Imin, tmp, std::dec);
    tmp = argv[4];  // dI
    from_string<int>(dI, tmp, std::dec);
    tmp = argv[5];  // detheta
    from_string<int>(dtheta, tmp, std::dec);

   return 0;

}
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 8210
Location: Salford, UK

PostPosted: Mon Oct 24, 2011 7:34 pm    Post subject: Reply with quote

As far as I know SCC can handle templates but the standard library is not provided for you.

There is a good chance that you will be able download the source for the library from http://www.sgi.com/tech/stl/vector and build it for yourself.
Back to top
View user's profile Send private message AIM Address
jjgermis



Joined: 21 Jun 2006
Posts: 404
Location: N�rnberg, Germany

PostPosted: Wed Oct 26, 2011 1:30 pm    Post subject: Reply with quote

Thanks Paul.

It is possible to download the files. Several files starts with stl_... and can be copied without any difficulties into the Silverfrost include directory. However, several files (ALGOBASE.H, DEFALLOC.H, DEQUE.H, ...) need to be overwrited. I tried several possibilities and it did not work.

Questions:
1.) Can I overwrite the the exisiting files in the include directory with that downloaded from the STL site?

2.) For a Fortran project I can specify include paths in the project options. This option is not available for SCC.

3.) What do you exactly mean by building the library for myself. Should I make a dll, lib or add the whole STL library as an include.
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 8210
Location: Salford, UK

PostPosted: Thu Oct 27, 2011 7:48 am    Post subject: Reply with quote

1) I would compare the two versions. If they are consistent (i.e. the common parts are identical) then I would use the download. Otherwise I would keep copies of the old files and use the downloads on a trial and error basis.

2) You don't need to add include files to the project. If you do (and there is no INCLUDE folder offered) then you can add them if you wish but you will need to "Exclude" them from the build process via the file properties dialog.

3) I would try building a DLL using only the parts I need.
Back to top
View user's profile Send private message AIM Address
jjgermis



Joined: 21 Jun 2006
Posts: 404
Location: N�rnberg, Germany

PostPosted: Thu Oct 27, 2011 12:13 pm    Post subject: Reply with quote

My colleague informed me on a previous thread where similar difficulties were encountered. Based on this information the code I tested will not work.

However, I would like to give you the background to the idea. Our FEA software has an option to specify a user control program that is executed after each timestep in a transient analysis. This allows the user to change/vary certain parameters during a simulation. I was hoping that I can introduce Silverfrost to them by encouraging them to get the Personal Edition - and finally a licence.
Back to top
View user's profile Send private message
jjgermis



Joined: 21 Jun 2006
Posts: 404
Location: N�rnberg, Germany

PostPosted: Thu Oct 27, 2011 4:01 pm    Post subject: Reply with quote

The control programs we use are no rocket science. However, using the examples as provided by the FEA software can not be compiled by SCC. Since I would really like the guys to start with Silverfrost ans especially FTN95 I changed the code using "old style" C to convert the command line arguments to float.

Code:
#include <stdio.h>

int str2int(char * str_int)
{
  int i;
  if(EOF == sscanf(str_int, "%d", &i))
  {
    //error
  }
  return i;
}

float str2float(char * str_float)
{
  float f;
  if(EOF == sscanf(str_float, "%f", &f))
  {
    //error
  }
  return f;
}   
   
int main(int argc, char * argv[])
{
  int i;
  float f;
 
  if (argc != 5)
  {
    printf("usage: %s",argv[0]);
  }
  else
  {
    for (i=1; i < 5; i++){
      f = str2float(argv[i]);
      printf("%f\n",f);
    }
  }
}
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> Support All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group