String as argument

Hi,

(Having done lots of work with C++ for DOS years ago, I have been pampered with PHP ever since, and relearning the basics is tough)

I am sure this is an obvious question . . .

1
2
3
4
5
6
7
8
9
10
#ifndef MY_COMMAND_LINE_OPTIONS_H
#define MY_COMMAND_LINE_OPTIONS_H
#include <string>
class my_command_line_options {
    public:
        my_command_line_options(int, char**);
    private:
        void Parse(int, char**, string);
};
#endif 


My compiler complains "string has not been declared" at
void Parse(int, char**, string);

Have I not used the #include correctly?
Is string the wrong arg type for some reason?

The 'Parse' function has been defined in my CPP file just the same way.
I am using the Ubuntu operating system, and g++ to compile.
All standard C++ classes are in the std namespace, so you need to write std::string.
Note also that std::strings are usually passed by ref: const std::string& for in params and std::string& for out params.
Last edited on
Thanks chaps.
I am enjoying the relearning process. There is something very satisfying about this language.
Topic archived. No new replies allowed.