The problem is circular dependency. set.h includes set.cpp and set.cpp includes set.h.
Remember that including a file simply pastes its code. There is no need for set.cpp to know about set.h as they will be one file when compiling.
Also, you shouldn’t call set.cpp a cpp file. cpp files are ones that are meant to generate object files. The implementation of a template class must be recompiled for each separate type argument, so it must be in a header and cannot form a separate object. It’s okay to separate implementation from declaration, but do it in a file like set_implementation.h to avoid confusion.
Related Posts:
- Officially, what is typename for?
- Argument list for class template is missing
- What does “missing template argument” mean?
- What does “missing template argument” mean?
- Difference of keywords ‘typename’ and ‘class’ in templates?
- “Implicit instantiation of undefined template” when forward declaring template class
- “used without template parameters”
- C++ template constructor
- error C2106: ‘=’ : left operand must be l-value
- c++ –
- use of class template requires template argument list
- C++ Templates – LinkedList
- C++ template – error: expected initializer before ‘<' token
- template argument deduction/substitution failed, when using std::function and std::bind
- Class template inheritance C++
- got “cannot appear in a constant-expression” when using template
- In C++ what does template<> mean?
- non-member function cannot have cv-qualifier
- How can I add reflection to a C++ application?
- Unrecognizable template declaration/definition
- error C2244 unable to match function definition to an existing declaration
- invalid use of template name without an argument list
- Struct with template variables in C++
- Here is some error with my .h file which show [Error] unterminated #ifndef when I include my class template in it
- Template constructor in a class template – how to explicitly specify template argument for the 2nd parameter?
- C++ convert from 1 char to string?
- Pause Console in C++ program
- Passing an array by reference
- What does int argc, char *argv[] mean?
- Meaning of = delete after function declaration
- Using NULL in C++?
- c++ “Incomplete type not allowed” error accessing class reference information (Circular dependency with forward declaration)
- C++ Error: undefined reference to `main’
- 1.#QNAN error C++
- What is the array form of ‘delete’?
- Error: Expression must have integral or unscoped enum type
- Use new operator to initialise an array
- Remove secure warnings (_CRT_SECURE_NO_WARNINGS) from projects by default in Visual Studio
- Undefined Symbols for architecture x86_64: Compiling problems
- “No viable overloaded ‘=’ ” why?
- Check if a string is palindrome
- What is an ‘undeclared identifier’ error and how do I fix it?
- Initializing a two dimensional std::vector
- What does “<<" and ">>” mean in C++ for cout/cin?
- C ++ error: a expected initializer before [function name]
- invalid new-expression of abstract class type
- std::string to char*
- Returning multiple values from a C++ function
- Eclipse C++ : “Program “g++” not found in PATH”
- no default constructor exists for class
- Press Enter to Continue
- How to trim a std::string?
- Parsing a comma-delimited std::string
- Random number c++ in some range
- C++: std does not have member “string”
- Fatal error: ‘stdafx.h’ file not found
- How do I add the MinGW bin directory to my system path?
- What’s the syntax for declaring an array of function pointers without using a separate typedef?
- What is the difference between const_iterator and non-const iterator in the C++ STL?
- Sorting Linked List C++ with pointers
- Get Unix timestamp with C++
- Class prototyping
- How to dynamically allocate an array of pointers in C++?
- How do I compile C++ to JavaScript in a browser?
- Reading from .txt file into two dimensional array in c++
- C++ Error ‘nullptr was not declared in this scope’ in Eclipse IDE
- C++ Simple hangman game
- “The system cannot find the file specified” when running C++ program
- Remove First and Last Character C++
- C++ Convert string (or char*) to wstring (or wchar_t*)
- Program received signal SIGSEGV, Segmentation fault
- Integer to hex string in C++
- Comparison of C++ unit test frameworks
- What is the difference between .cc and .cpp file suffix?
- C++ error: object of abstract class type is not allowed: pure virtual function has no overrider
- Error: free(): invalid next size (fast):
- Fastest way to Convert String to Binary?
- Reading data from file into an array
- LINK : fatal error LNK1561: entry point must be defined ERROR IN VC++
- Trying to use int in getline
- c++ error c2015: too many characters in constant
- Splitting a C++ std::string using tokens, e.g. “;”
- How to print (using cout) a number in binary form?
- What is the job of autogen.sh when building a c++ package on Linux
- Using G++ to compile multiple .cpp and .h files
- LPCSTR, LPCTSTR and LPTSTR
- How to do std::string indexof in C++ that returns index of matching string?
- variable or field declared void
- Invalid conversion from ‘char’ to ‘const char *’
- How do I deal with “signed/unsigned mismatch” warnings (C4018)?
- Creating folders in C++
- How can I get a file’s size in C++?
- Why can’t I make a vector of references?
- What does “-Wall” in “g++ -Wall test.cpp -o test” do?
- How to determine the version of the C++ standard used by the compiler?
- Declare a bit in C++
- Difference between the int * i and int** i
- Download c++ in existing visual studio 2017
- istream and ostream problem – C++
- List iterator not dereferencable?