c++.stl - STL not present?
- David <deimerl eimexinc.com> Jun 26 2009
- Bertel Brander <bertel post4.tele.dk> Jun 29 2009
- David <deimerl eimexinc.com> Jul 01 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
}
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








David <deimerl eimexinc.com>