Compiler error

Hello guys
I'm trying to compile this code which is a header file.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#ifndef CUBEMAP_H_INCLUDED
#define CUBEMAP_H_INCLUDED
#include "Texture.h"
#include <string>
class CubeMap : Texture
{
public:

    CubeMap(string Directory, string Front, string Back, string Left, string Right, string Top, string Bottom);

    ~CubeMap();

    void Bind(GLenum TextureUnit);

private:

    std::string fileNames[6];
    GLuint m_textureObj;
};
#endif // CUBEMAP_H_INCLUDED 


but i get the following error:
|9|error: expected ')' before 'Directory'|
how can i resolve this?
It has been a while since I have done any c++ programming, but I think you have to put the namespace in front of the string in your parameter list just like you did in the private section.
" CubeMap(std::string Directory,....);"
Yeas it works
I have included the library but still did not work, why?
Thanks anyway, it was more useful than my teacher.
Because all names in the standard library is inside the std namespace and that's why you have to add the std:: prefix. It does this mainly to avoid that name clashes with your own code or with other libraries that you use.
But I include the string library, why it still does not work without the std?
Why including the library just is not enough?
Because as Peter87 said, everything in the standard library lives inside the std:: namespace. This is to avoid name clashes with your own code or other 3rd party libraries.

If you are not familiar with namespaces I suggest you read up on them:

http://www.cplusplus.com/doc/tutorial/namespaces/
ok thanks
Topic archived. No new replies allowed.