I downloaded a c++ project and was able to compile it using a makefile generated by cmake.
However when I try to add my own series of .h files in one of the .hh files of the project I start to get a million of errors, one of them being:
error: using-declaration for non-member at class scope using std::cout;
When the .h file that contains
using std::cout
is used elsewhere it works, but when added to this project it gives this error.
What can be the problem?
using std::cout;
using std::endl;
class TextManager : public FileManager {
public:
TextManager (const char * filename);
void scanFile (Image &image, Scene &scene);
void scanObjectModel (Image &image, Scene &scene);
void getImageData (Image &image);
void getMaterialData (Scene &scene);
void getLightData (Scene &scene);
void getSphereData (Scene &scene);
void getPlaneData (Scene &scene);
void getTriangleData (Scene &scene);
int getLineValue (int size);
void getLineValue2 (float (&lineNumbers) [10], Scene &scene, int &lineNumbersIndex);
void getVerticesValues (int initPos, Scene &scene);
private:
std::string line;
float fractionaryTenPowers [6];
};
Problem solved. Was the lack of a bracket to close the declaration of one of the classes that was causing it.
The error means you've done this:
struct Foo {
using std::cout;
...
};
That's not valid C++, in a class body you can only add a using-declaration for members of base classes, not arbitrary names.
You can only add using std::cout
at namespace scope or inside a function body.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With