// File: Lab13Frac.h
#include <iostream>
using namespace std;
#ifndef "Lab13Frac.h"
#define "Lab13Frac.h"
// prototp开发者_StackOverflowes
#endif
The identifier should not be in quotes. Also, it should be in all caps by convention.
// File: Lab13Frac.h
#ifndef LAB13FRAC_H
#define LAB13FRAC_H
#include <iostream>
using namespace std;
// The above line is not recommended in header files
// because it may cause namespace collisions.
// See http://www.parashift.com/c++-faq-lite/coding-standards.html#faq-27.5
// Prototypes
#endif
Here's how I would do that
// File: Lab13Frac.h
#ifndef LAB13FRAC_H
#define LAB13FRAC_H
#include <iostream>
using namespace std; //You shouldn't do this anyway...
// prototpes
#endif //LAB13FRAC_H
You can't use a string as an identifier, use a literal as if it is a variable name.
Also, you should put a comment next to #endif
to tell who reads what you are #endif
ing
精彩评论