I've tried it all by now, it's starting to feel like.
So, I've got this (which is in turn a header file included by the main header file, which is included by the main source):
#pragma once
#include "header.h"
// I included this part, as I supposed it might not have gathered
// the inclusion of <string> from within header.h at the early
// stages of compilation; the compiler still won't recognize it.
#ifndef __INCLUDED_STRING_LIB
#include <string>
#define __INCLUDED_STRING_LIB true
#endif
class Element {
private:
static long count; // Counts the number of created Elements
string name, desc; // Name / description texts (*fails here*)
long id;
// Etc...
header.h also has #pragma once declared, by the way.
I'm not all new to C++, but am new to using classes and separate source files (I've previously used these concepts in Java though).
So, what happens? The compiler fails, telling me
Quote: "error C2146: syntax error : missing ';' before identifier 'name'"
at the specified line (the one declaring the strings).
My conclusion is that it doesn't recognize the string class as a valid type identifier or whatever you call it.
I've tried messing about with this for the last hour, moving inclusion statements here and there between my files, but no luck.
I was thus hoping that someone more experienced could tell me what is wrong and, if possible, what to do about it.
Thanks,
Rudolpho