I'm just learning C++. I'm following a YouTube video, but I'm stuck at this stage. Below is my files.
// main.cpp
#include <iostream>
#include "Person.h"
int main()
{
Person foo;
foo.set_age(25);
std::cout << foo.get_age() << std::endl;
return 0;
}
// Person.h
#ifndef PERSON_H
#define PERSON_H
#pragma once
class Person
{
public:
void set_age(int a);
int get_age();
private:
int age;
};
#endif
// Person.cpp
#include "Person.h"
void Person::set_age(int a)
{
age = a;
}
int Person::get_age()
{
return age;
}
I just set up the development environment in vscode and installed code runner.
Whenever I click the Run button here
It says
launch: program '.....main.exe' does not exist
Is there a tool like php composer
that automatically manages it?
Moved the contents of the .cpp file to the .h file.
It worked fine. But I would like to separate the two files for management.