Ошибка в консоли:
Код: Выделить всё
Executing task: C/C++: g++.exe build active file
Starting build...
cmd /c chcp 65001>nul && C:\msys64\ucrt64\bin\g++.exe -fdiagnostics-color=always -g "C:\Users\GLM21\Desktop\Mailfood - proiect\main.cpp" -o "C:\Users\GLM21\Desktop\Mailfood - proiect\main.exe"
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\GLM21\AppData\Local\Temp\ccvOXQCl.o: in function `main':
C:/Users/GLM21/Desktop/Mailfood - proiect/main.cpp:10:(.text+0x23d): undefined reference to `Client::getClient() const'
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/Users/GLM21/Desktop/Mailfood - proiect/main.cpp:11:(.text+0x249): undefined reference to `User::CreateAccount()'
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:/Users/GLM21/Desktop/Mailfood - proiect/main.cpp:12:(.text+0x255): undefined reference to `User::Login()'
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: C:\Users\GLM21\AppData\Local\Temp\ccvOXQCl.o: in function `Client::Client(std::__cxx11::basic_string const&, std::__cxx11::basic_string const&, std::__cxx11::basic_string const&, std::__cxx11::basic_string const&, std::__cxx11::basic_string const&, std::__cxx11::basic_string const&)':
C:/Users/GLM21/Desktop/Mailfood - proiect/Client.h:9:(.text$_ZN6ClientC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES7_S7_S7_S7_S7_[_ZN6ClientC1ERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES7_S7_S7_S7_S7_]+0x23): undefined reference to `User::User()'
collect2.exe: error: ld returned 1 exit status
Build finished with error(s).
* The terminal process terminated with exit code: -1.
* Terminal will be reused by tasks, press any key to close it.
Код: Выделить всё
//main.cpp
#include
#include "Client.h"
using namespace std;
int main()
{
Client client("user123", "password", "John", "Doe", "123-456-7890", "123 Main St");
client.getClient();
client.CreateAccount();
client.Login();
return 0;
}
Код: Выделить всё
//User.h
#ifndef USER_H
#define USER_H
#include
class User {
public:
User();
User(const std::string&, const std::string&, const std::string&, const std::string&, const std::string&, const std::string&);
void Login();
void CreateAccount();
private:
std::string username;
std::string password;
std::string Name;
std::string LastName;
std::string PhoneNumber;
std::string Address;
};
#endif
Код: Выделить всё
//User.cpp
#include "User.h"
#include
#include
User::User(const std::string &username ,const std::string &password,const std::string &Name, const std::string &LastName, const std::string &PhoneNumber, const std::string &Adress )
:username(username),password(password), Name(Name), LastName(LastName), PhoneNumber(PhoneNumber), Address(Adress) {}
void User::CreateAccount()
{
std::coutpassword == password)
{
std::cout
Подробнее здесь: [url]https://stackoverflow.com/questions/78531507/main-exe-does-not-exist[/url]