I'am trying to compile a simple .cpp file using g++ on ubuntu.
Here are my three files:
main.cpp:
#include <iostream>
#include "math.h"
using namespace std;
int main()
{
int a(2);
b = func2(a);
return 0;
}
math.cpp:
#include "math.h"
int func2(int nombreRecu)
{
int valeur(nombreRecu + 2);
return valeur;
}
math.h:
#ifndef MATH_H_INCLUDED
#define MATH_H_INCLUDED
int func2(int nombreRecu);
#endif // MATH_H_INCLUDED
But when doing this command, g++ main.cpp, I get the error: Undefined reference to func2(int)