I have 4 files (2 headers, and 2 code files).
FileA.cpp, FileA.h, FileB.cpp, FileB.h
FileA.cpp:
#include "FileA.h"
int main()
{
hello();
return 0;
}
void hello()
{
//code here
}
FileA.h:
#ifndef FILEA_H_
#define FILEA_H_
#include "FileB.h"
void hello();
#endif /* FILEA_H_ */
FileB.cpp:
#include "FileB.h"
void world()
{
//more code;
}
FileB.h:
#ifndef FILEB_H_
#define FILEB_H_
int wat;
void world();
#endif /* FILEB_H_ */
when I try to compile(with eclipse), I get " multiple definition of `wat' "
And I don't know why, it seems as it should work just fine.
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…