c++.stl - STL not present?
- David (12/12) Jun 26 2009 Dmc can't compile this program in the source file pmc.cpp. How do
- Bertel Brander (15/29) Jun 29 2009 You have to include string (without .h), iostream has
- David (5/5) Jul 01 2009 Thank you. I had tried many variations of '.h' and 'using'
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 }
Jun 26 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); }
Jun 29 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.
Jul 01 2009