1
// File: Lab13Frac.h

#include <iostream>
using namespace std;
#ifndef "Lab13Frac.h"
#define "Lab13Frac.h"

// prototpes

#endif 
Jerry Coffin
  • 476,176
  • 80
  • 629
  • 1,111
booby
  • 21
  • 1
  • 3

2 Answers2

7

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
In silico
  • 51,091
  • 10
  • 150
  • 143
  • 1
    Depending on coding style, it's also possible to write (for example) `#ifndef _LAB13FRAC_H_ ... ` and sometimes `#endif // _LAB13FRAC_H_` – M. Williams Apr 28 '10 at 23:51
  • 2
    @Kotti: Except those identifiers are reserved for the compiler. (Any name starting with an underscore followed by another underscore or capital letter are reserved.) – GManNickG Apr 28 '10 at 23:52
  • 1
    @GMan Know about the double underscore, but it's the first time when I've heard about `_X....` being reserved. Could you point to some docs to read? – M. Williams Apr 28 '10 at 23:55
  • @Kotti, See C++0X FCD 17.6.3.3.2.1: Certain sets of names and function signatures are always reserved to the implementation: — Each name that contains a double underscore _ _ or begins with an underscore followed by an uppercase letter (2.12) is reserved to the implementation for any use. — Each name that begins with an underscore is reserved to the implementation for use as a name in the global namespace. – Nathan Ernst Apr 29 '10 at 00:01
  • @Kotti: http://stackoverflow.com/questions/228783/what-are-the-rules-about-using-an-underscore-in-a-c-identifier/228797#228797 – GManNickG Apr 29 '10 at 00:01
1

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 #endifing

Federico klez Culloca
  • 26,308
  • 17
  • 56
  • 95