I have the following 3 files, main.cpp and then a class defintion including a header file for the class:
main.cpp:
#include <iostream>
#include "data_vars_class.hpp"
int main () {
DataVars dataVars();
return 0;
}
data_vars_class.hpp:
#include <string>
#include <vector>
class DataVars
{
private:
std::vector<std::string> csv_card_names;
public:
DataVars();
void getCSVData();
};
data_vars_class.cpp:
#include <iostream>
#include <vector>
#include <string>
#include "data_vars_class.hpp"
DataVars::DataVars()
{
std::cout << "constructor?";
getCSVData();
}
void DataVars::getCSVData()
{
std::cout << "Getting csv data!";
}
The problem is when I build and execute the code, I just get an empty terminal. I know that both data_vars_class.hpp and data_vars_class.cpp are being included with the build, this is my build command in Geany:
g++ main.cpp data_vars_class.cpp -o a.out
How come i'm not seeing the cout output in the terminal, like in the constructor shouldnt i see "constructor?" in the terminal?
Thanks