Thread overview | |||||
---|---|---|---|---|---|
|
June 26, 2009 STL not present? | ||||
---|---|---|---|---|
| ||||
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 Re: STL not present? | ||||
---|---|---|---|---|
| ||||
Posted in reply to David | 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 Re: STL not present? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Bertel Brander | 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. |
Copyright © 1999-2021 by the D Language Foundation