With the following files, I get the error multiple definition of 'a'
even though I only defined it once?
header.cpp
add (int x, int y) {
return x+y;
}
header.h
#if !defined(header)
#define header
int add (int x, int y);
int a;
#endif
main.cpp
#include <iostream>
#include "header.h"
#pragma once
using std::cout;
using std::endl;
int main() {
cout << "hi" << endl;
cout << a << endl;
}
The code is copied exactly