The function definition in .cpp file should be compatible with its decleration in .h file so modify it as follows.

.cpp file:

#include"testclass.h"
Car& testclass::createCar(int x, int y)
{
  ....
}

Note that I modified <testclass.h> to "testclass.h". use the brackets only with the built in headers.

Follow the following line if you want to know why you should use "testclass.h" instead of <testclass.h> and which one of them you should use Link

Answer from asmmo on Stack Overflow
🌐
cppreference.com
en.cppreference.com › cpp › headers
C++ Standard Library headers - cppreference.com
April 26, 2025 - Source files that are not intended to also be valid ISO C should not use any of the C headers. With the exception of complex.h, each xxx.h header included in the C++ standard library places in the global namespace each name that the corresponding cxxx header would have placed in the std namespace. These headers are allowed to also declare the same names in the std namespace, and the corresponding cxxx headers are allowed to also declare the same names in the global namespace: including <cstdlib> definitely provides std::malloc and may also provide ::malloc.
🌐
Lsu
ld2014.scusa.lsu.edu › cppreference › en › cpp › header.html
C++ Standard Library header files - cppreference.com
From cppreference.com · < cpp · C++ Standard Library header files · The interface of C++ standard library is defined by the following collection of header files.
🌐
cppreference.com
en.cppreference.com › c › header
C Standard Library headers - cppreference.com
4.1.2 Standard headers · Categories: Pages using deprecated source tags · Pages using deprecated enclose attributes · Support us · Recent changes · FAQ · Offline version · What links here · Related changes · Upload file · Special pages · Printable version ·
🌐
SACO Evaluator
saco-evaluator.org.za › docs › cppreference › en › cpp › header.html
C++ Standard Library header files - cppreference.com
From cppreference.com · < cpp · C++ Standard Library header files · The interface of C++ standard library is defined by the following collection of header files · For some of the C standard library headers of the form xxx.h, the C++ standard library both includes an identically-named header and another header of the form cxxx (all meaningful cxxx headers are listed above).
🌐
University of Chicago
naipc.uchicago.edu › 2014 › ref › cppreference › en › cpp › header.html
C++ Standard Library header files - cppreference.com
From cppreference.com · < cpp · C++ Standard Library header files · The interface of C++ standard library is defined by the following collection of header files.
🌐
Cplusplus
cplusplus.com › reference
Standard C++ Library reference
Provides functionality to use an abstraction called streams specially designed to perform input and output operations on sequences of character, like files or strings. This functionality is provided through several related classes, as shown in the following relationship map, with the corresponding ...
🌐
Lsu
ld2014.scusa.lsu.edu › cppreference › en › c › header.html
C Standard Library header files - cppreference.com
C Standard Library header files · From cppreference.com · [edit] See also · Retrieved from "http://en.cppreference.com/mwiki/index.php?title=c/header&oldid=71951"
🌐
Patrickfasano
cppreference.patrickfasano.com › en › c › header.html
C Standard Library header files - cppreference.com
From cppreference.com · < c · C · The interface of C standard library is defined by the following collection of headers.
Find elsewhere
🌐
Dpvipracollege
dpvipracollege.ac.in › wp-content › uploads › 2023 › 01 › C-Plus-Plus-The-Complete-Reference-3rd-Ed.pdf pdf
C++: The Complete Reference Third Edition
The Form of a C Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ... The Library and Linking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ... Understanding the .C and .CPP File Extensions . . . . . . . .
🌐
IBM
ibm.com › docs › en › xl-c-and-cpp-aix › 13.1.0
Standard C++ Library Header Files - IBM Documentation
March 5, 2021 - The name of each of these C++ headers is of the form cname, where name is the string that results when the “.h” extension is removed from the name of the equivalent C Standard Library header. For example, the header files <stdlib.h> and <cstdlib> are both provided by the C++ Standard Library and are equivalent in function, with the exception that all declarations in <cstdlib> are located within the std namespace.
🌐
Cppreference
en.cppreference.com › w › cpp › header › new.html
Standard library header <new> - cppreference.com
April 12, 2024 - namespace std { class bad_array_new_length : public bad_alloc { public: // see description for the specification of the special member functions constexpr const char* what() const noexcept override; }; } Retrieved from "https://en.cppreference.com/mwiki/index.php?title=cpp/header/new&oldid=170819" Support us · Recent changes · FAQ · Offline version · What links here · Related changes · Upload file ·
🌐
Microsoft Learn
learn.microsoft.com › en-us › cpp › cpp › header-files-cpp
Header files (C++) | Microsoft Learn
We add an #include directive for "my_class.h" file in order to have the my_class declaration inserted at this point in the .cpp file, and we include <iostream> to pull in the declaration for std::cout. Note that quotes are used for header files in the same directory as the source file, and angle brackets are used for standard library headers.
🌐
Raquent
raquent.in › posts › answering-whats-your-favorite-cpp-feature
Answering "what's your favorite C++ feature" - Raquent.in
February 16, 2025 - constexpr inline std::string ParserError::get_brief() const { return std::visit( [](auto &&arg) { using T = std::decay_t<decltype(arg)>; if constexpr (std::is_same_v<T, MalformedSectionHeader>) return "malformed section header"; else if constexpr (std::is_same_v<T, ExpectedColonInHeaderAssignment>) return "missing colon in header assignment"; }, info_); } See also: constexpr virtual functions from C++20. std::optional is quite nice for handling nullish yet non-error states.
🌐
cppreference.com
en.cppreference.com › cpp › header › filesystem
Standard library header <filesystem> (C++17) - cppreference.com
November 27, 2023 - namespace std::filesystem { class path { public: using value_type = /* see description */; using string_type = basic_string<value_type>; static constexpr value_type preferred_separator = /* see description */; // enumeration format enum format; // constructors and destructor path() noexcept; path(const path& p); path(path&& p) noexcept; path(string_type&& source, format fmt = auto_format); template<class Source> path(const Source& source, format fmt = auto_format); template<class InputIt> path(InputIt first, InputIt last, format fmt = auto_format); template<class Source> path(const Source& sou
🌐
Cppreference
en.cppreference.com › w › cpp › header › utility.html
Standard library header <utility> - cppreference.com
November 24, 2024 - This header is part of the general utility library. #include <compare> #include <initializer_list> namespace std { // swap template<class T> constexpr void swap(T& a, T& b) noexcept(/* see description */); template<class T, size_t N> constexpr void swap(T (&a)[N], T (&b)[N]) noexcept(is_nothrow_swappable_v<T>); // exchange template<class T, class U = T> constexpr T exchange(T& obj, U&& new_val); // forward/move template<class T> constexpr T&& forward(remove_reference_t<T>& t) noexcept; template<class T> constexpr T&& forward(remove_reference_t<T>&& t) noexcept; template<class T, class U> const
🌐
Cppreference
en.cppreference.com › w › cpp › header › cctype.html
Standard library header <cctype> - cppreference.com
February 1, 2025 - This header was originally in the C standard library as <ctype.h>.