i sort of asked this before, but i used what i was told to try to get my program to work:
Its probably because I am noob at C++, but I am having trouble using #ifndef
due to the problem that my classes contain the same .h files. both s.h and t.h and main.cpp need the struct defined in r.h
i have
#include "s.h"
#include "t.h"
#ifndef r
#include "r.h"
#endlif
in my main cpp file
and in each of my s.h and t.h files, there is a
#ifndef r
#include "r.h"
#endlif
// and then its class
as well, but the compiler is giving me errors about expected nested-name-specifier before "namespace"
, unqualified id before using namespace std;
, expected ';' before "namespace"
in the r.h file even though all i have in the r.h file is:
#include <iostream>
using namespace std;
struct r{
// code
};
are the problems caused by the main cpp not importing certain libraries or something else? how do i fix it?