Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 1 | ||||||
| 2 | 3 | 4 | 5 | 6 | 7 | 8 |
| 9 | 10 | 11 | 12 | 13 | 14 | 15 |
| 16 | 17 | 18 | 19 | 20 | 21 | 22 |
| 23 | 24 | 25 | 26 | 27 | 28 | 29 |
| 30 |
Tags
- agile
- Italy
- Programming
- MySQL
- ubuntu
- AI
- history
- Malaysia
- hadoop
- leadership
- comic agile
- Software Engineering
- essay
- programming_book
- QT
- Artificial Intelligence
- Book
- program
- django
- Python
- Book review
- Kuala Lumpur
- management
- hbase
- RFID
- web
- Linux
- France
- erlang
- Java
Archives
- Today
- Total
include guard 본문
출처: http://yesarang.tistory.com/64
In file included from hdr2.h:1,
from tips1.cpp:2:
hdr1.h:1: error: redefinition of ‘class DummyBase’
hdr1.h:1: error: previous definition of ‘class DummyBase’
// hdr1.h
class DummyBase {
private:
int _i;
public:
DummyBase(int i): _i(i) {}
int Get() { return _i; }
void Set(int i) { _i = i; }
};
// hdr2.h
#include "hdr1.h"
class Dummy: DummyBase {
public:
Dummy(int i): DummyBase(i) {}
int operator() () { return Get(); }
int operator() (int multi) { return Get() * multi; }
};
// tips1.cpp
#include "hdr1.h"
#include "hdr2.h"
int main()
{
DummyBase db(200);
Dummy d(100);
}
$ g++ tips1.cppIn file included from hdr2.h:1,
from tips1.cpp:2:
hdr1.h:1: error: redefinition of ‘class DummyBase’
hdr1.h:1: error: previous definition of ‘class DummyBase’
Comments