What am i doing wrong.
Tadd.h
#ifndef ADD_H_GUARD
#define ADD_H_GUARD
int add(int a, int b);
#endif
Tadd.cpp
int add(int a, int b)
{
return a+ b;
}
Taddmain.cpp
#include <iostream>
#include "Tadd.h"
using namespace std;
int triple(int x)
{
return add(x, add(x,x));
}
int main()
{
int xi;
xi = triple(3);
cout<<xi;
cin.get();
}
I compile Tadd.cpp and Taddmain.cpp.
how do i make an exe file.
in geany. error on build.
g++ -Wall -o "Taddmain" "Taddmain.cpp" (in directory: /home/***/Programming/C codes)
/tmp/ccZzj327.o: In function `triple(int)':
Taddmain.cpp:(.text+0x86): undefined reference to `add(int, int)'
Taddmain.cpp:(.text+0x95): undefined reference to `add(int, int)'
collect2: ld returned 1 exit status
Compilation failed.
What do i need to do.