You need header guards on that header file. It is presumably being included twice.
Modify the header, adding these lines to the beginning and end.
#ifndef STUDENT_H #define STUDENT_H // Put the entire contents of your header here... #endif
The define doesn’t need to be STUDENT_H
… it just needs to be unique.
With these directives added, the compiler will ignore all contents of the header file if it has already been parsed.
Alternatively, while it is not standard C++, all major compilers will allow you to put a single
#pragma once
as the first line of the header to prevent it from being parsed multiple times.
Related Posts:
- Why am I getting this redefinition of class error?
- Why am I getting this redefinition of class error?
- Expression must have class type
- c++ “Incomplete type not allowed” error accessing class reference information (Circular dependency with forward declaration)
- Why is enum class preferred over plain enum?
- C++ Linked List Node with class
- (->) arrow operator and (.) dot operator , class pointer
- Separating class code into a header and cpp file
- how to define -std=c++11 as default in g++
- Pointer to incomplete class type is not allowed
- no default constructor exists for class
- Getting error “a nonstatic member reference must be relative to a specific object” while both member are in the same class
- Error “C++ requires a type specifier for all declarations whilst defining methods”
- What are the differences between struct and class in C++?
- error C2011: ” : ‘class’ type redefinition
- The compiler is complaining about my default parameters?
- C++ Linked List Node with class
- Getting error: ISO C++ forbids declaration of with no type
- “used without template parameters”
- expected constructor, destructor, or type conversion before ‘(’ token
- C++ Class ‘undeclared identifier”
- c++ “Incomplete type not allowed” error accessing class reference information (Circular dependency with forward declaration)
- Base class undefined
- Warning: non-static data member initializers only available with -std=c++11 or -std=gnu++11?
- What is the meaning of a C++ Wrapper Class?
- Does C++11 have C#-style properties?
- G++ undefined reference to class::function
- Creating an instance of class
- expected primary-expression before ‘]’ token
- error C2039: ‘string’ : is not a member of ‘std’, header file problem
- istream and ostream problem – C++
- Struct with template variables in C++
- error: no member function declared in class
- Here is some error with my .h file which show [Error] unterminated #ifndef when I include my class template in it
- Error: invalid use of member in static member function
- What exactly is the difference between “pass by reference” in C and in C++?
- What is `CString`?
- Difference between != and =! with an example(in C++)
- Unresolved external symbol in object files
- How do sizeof(arr) / sizeof(arr[0]) work?
- rand() between 0 and 1
- how to implement Interfaces in C++?
- What exactly is nullptr?
- How to make a SIMPLE C++ Makefile
- finding dll for “The specified module could not be found”
- Undefined reference to vtable
- How to get current time and date in C++?
- Class name does not name a type in C++
- Identifier not found error on function call
- Is there a decent wait function in C++?
- streambuf::xsgetn and state flags
- C++ table alignment – cout and iomanip
- Debug assertion failed. C++ vector subscript out of range
- Using the fstream getline() function inside a class
- Missing vc_runtimeminimum_x86.msi and installation won’t work
- I’m getting an error “invalid use of incomplete type ‘class map’
- “Error: expression must have a pointer type” when using the “this” keyword
- This declaration has no storage class or type specifier in C++
- error: expected unqualified-id before ‘if’
- The #include
exists, but I get an error: identifier “cout” is undefined. Why? - Understanding “corrupted size vs. prev_size” glibc error
- Is the practice of returning a C++ reference variable evil?
- How to convert C++ Code to C
- how to convert C# to C++
- What are helper functions in C++?
- How to fix ‘std::logic_error’ what(): basic_string::_M_construct null not valid error?
- C++ String Variable Declaration
- How to fix ‘std::logic_error’ what(): basic_string::_M_construct null not valid error?
- Why is my HelloWorld function not declared in this scope?
- What is the difference between include_directories and target_include_directories in CMake?
- Undefined reference to constructor
- How to initialize a vector of pointers
- C++: Using ifstream with getline();
- How to add element to C++ array?
- Passing as const and by reference – Worth it?
- expression did not evaluate to a constant- c++
- Win32 Console Application
- What does the fpermissive flag do?
- Convert char array to single int?
- https://stackoverflow.com/questions/3865946/error-generic-array-creation
- C++ variable has initializer but incomplete type?
- How to print a string in C++
- How to check if input is numeric in C++
- C++ Big Integer
- How do I create a random alpha-numeric string in C++?
- Learning to work with audio in C++
- C++ Void Function with File Stream Error
- sorting in std::map where key is a std::string
- System not declared in scope?
- What is predicate in C++?
- no debugging symbols found when using gdb
- C++ Array of pointers: delete or delete []?
- Is null reference possible?
- Negative RGB Values
- DEV C ++ Error: expected declaration before ‘}’ token
- “cannot be used as a function error”
- error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup
- Displaying contents of a vector container in C++
- How to use bitmask?
- -Error reading characters of string