Я пытаюсь собрать файл C ++ в VSCODE, и я продолжаю получать эту ошибку. < /p>
"linker command failed with exit code 1 (use -v to see invocation)"
< /code>
Этот файл, который я пытаюсь скомпилировать, имеет файл заголовка, CPP и еще один CPP. Только нуждался в себе, и он не выполнял ошибки. M2 MacBook Pro работает 15,3 ОС < /p>
here's my header file :
#ifndef SocialMediaProfile_H
#define SocialMediaProfile_H
#include
class SocialMediaProfile
{
public:
// Constructors
SocialMediaProfile(const std::string& newUsername,const std::string& newPlatform,
int newFollowers, double newEngagmentRate);
// Getters and Setters
std::string getUsername() const;
std::string getPlatform() const;
int getFollowers() const;
double getEngagmentRate() const;
void setUsername(const std::string &newUsername);
void setPlatform(const std::string &newPlatform);
void setFollowers(int newFollewers);
void setEngagementRate(double newEngagementRate);
void printDetails() const;
private:
std::string username;
std::string platform;
int followers;
double engagementRate;
};
#endif
Cpp file one:
#include "SocialMediaProfile.h"
#include
// For other headers, refer to the separate compilation file.
using namespace std;
SocialMediaProfile::SocialMediaProfile(const std::string &newUsername,
const std::string &newPlatform, int newFollowers,
double newEngagmentRate) :
username(newUsername), platform(newPlatform),
followers(newFollowers), engagementRate(newEngagmentRate){}
// Getters and Setters
string SocialMediaProfile::getUsername() const
{
return username;
}
string SocialMediaProfile::getPlatform() const
{
return platform;
}
int SocialMediaProfile::getFollowers() const
{
return followers;
}
double SocialMediaProfile::getEngagmentRate() const
{
return engagementRate;
}
void SocialMediaProfile::setUsername(const string &newUsername)
{
username = newUsername;
}
void SocialMediaProfile::setPlatform(const string &newPlatform)
{
platform = newPlatform;
}
void SocialMediaProfile::setFollowers(int newFollewers)
{
followers = newFollewers;
}
void SocialMediaProfile::setEngagementRate(double newEngagementRate)
{
engagementRate = newEngagementRate;
}
void SocialMediaProfile::printDetails() const
{
cout
Подробнее здесь: https://stackoverflow.com/questions/794 ... e-v-to-see
Vscode c ++ error linker, «Команда линкера с удалинием с кодом выхода 1 (используйте -v для просмотра vocation)» [Duplic ⇐ C++
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение