I have delete previus topic because I came across few things. Again these are my files and their content
add.h:
#ifndef ADD_H_INCLUDED
#define ADD_H_INCLUDED
int add(int x, int y);
#endif // ADD_H_INCLUDED
add.cpp:
#include <iostream>
int add(int x, int y)
{
return x+y;
}
main. cpp:
#include <iostream>
#include "add.h"
using namespace std;
int main()
{
cout << "We add 3 and 5: " << add(3,5);
return 0;
}
Error is:
in line of main() cout << ... : undefined reference to 'add(int,int)' error: Id returned 1 exit status(I don't know if it's surely Id with I(big i) or l(lowercase L)).
I finally managed to get project manager on screen. My project is called exercise and here is structure of it in project manager:Sources(add.cpp, main.cpp), Headers(add.h), Others(). If anyone has any idea where bug lies pleas help me, I have to start my project as soon as possible.
EDIT: full build log
-------------- Build: Debug in exercise (compiler: GNU GCC Compiler)---------------
g++ -o bin/Debug/exercise obj/Debug/main.o
obj/Debug/main.o: In function `main':
/home/user/Namizje/CodeblocksProjects/exercise/main.cpp:7: undefined reference to `add(int, int)'
collect2: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 0 second(s))
2 error(s), 0 warning(s) (0 minute(s), 0 second(s))