Thread overview
STL not present?
Jun 26, 2009
David
Jun 29, 2009
Bertel Brander
Jul 01, 2009
David
June 26, 2009
Dmc can't compile this program in the source file pmc.cpp.  How do I access the stl?

#include <iostream.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

void main(){
 string s="abs";  //dmc fails to compile this line
 cout<<s<<endl;
exit(0);
//end main
}
June 29, 2009
David skrev:
> Dmc can't compile this program in the source file pmc.cpp.  How do
> I access the stl?
> 
> #include <iostream.h>
> #include <stdio.h>
> #include <stdlib.h>
> #include <string.h>
> 
> void main(){
>  string s="abs";  //dmc fails to compile this line
>  cout<<s<<endl;
> exit(0);
> //end main
> }

You have to include string (without .h), iostream has
no .h eigther.
And you need to tell the compiler to use the namespace std

#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string>

using namespace std;

int main()
{
   string s="abs";  //dmc fails to compile this line
   cout<<s<<endl;
   exit(0);
}
July 01, 2009
Thank you. I had tried many variations of '.h' and 'using' statements, but none of them worked until I changed the sc.ini file to include the stlport files as first item in both INCLUDE and LIB keywords. Walter Bright has been very helpful to me in getting this sorted out.