Trying to see how multi-file projects work with structures but I can't figure out why I have an error. I have 2 files test.h
and test.cpp
. I get a compiler error for test.cpp
. It says error 'name' doesn't name a type.
test.h file:
#ifndef TEST_H_INCLUDED
#define TEST_H_INCLUDED
#include <string>
struct Name{
std::string first_name;
std::string last_name;
};
extern Name name;
#endif
test.cpp file:
#include "test.h"
#include<string>
using namespace std;
Name name;
name.first_name= "Jane";
Aucun commentaire:
Enregistrer un commentaire