I decided to try and code a basic program but i keep getting this eror:
/tmp/cczXwiYT.o: In function main':
main.cpp:(.text+0xd8): undefined reference to
utils::checkInputs(std::__cxx11::basic_string, std::allocator >, std::__cxx11::basic_string, std::allocator >)'
collect2: error: ld returned 1 exit status
Im new to c++ (just saying)
I tried to change the type from void to int to boolean etc.
main.cpp
#include <iostream>
#include <string>
#include <fstream>
#include "utils.h"
int main(){
utils u;
std::string a = "a";
std::string b = "a";
u.checkInputs(a,b);
return 0;
}
utils.cpp
#include <iostream>
#include <string>
#include <fstream>
#include "utils.h"
using namespace std;
utils::utils(){};
void checkInputs(string userInput, string target){
cout << "hey i work" << endl;
}
utils.h
#ifndef UTILS_H
#define UTILS_H
#include <iostream>
#include <string>
#include <fstream>
using namespace std;
class utils
{
public:
utils();
void checkInputs(string userInput, string target);
};
#endif
Thanks for the help =)