0

header file basic question:

//call.cpp #include "add.h" #include<iostream> using namespace std; int main() { cout<<addd(2,3); return 0; } //add.cpp #include "add.h" #include<iostream> using namespace std; int addd(int a,int b) return a+b; //add.h #ifndef ADD_H_ #define ADD_H_ using namespace std; int addd(int a,int b); #endif // ADD_H_ when i compile cal.cpp it give undefined behaviour of addd() please help where i have done wrong

21st Oct 2018, 5:14 AM
Bahubali
Bahubali - avatar
6 Respostas
+ 1
I think code playground doesnt support header files..U should use cxxdroid app,it supports .h files plus its fully offline,u can practice as much you like,it has over 80 standard libraries ....
21st Oct 2018, 6:21 AM
Mensch
Mensch - avatar
+ 1
see under build target files in project tab, did add.cpp included in there ? if not try to add it.
21st Oct 2018, 6:52 AM
Taste
Taste - avatar
0
I am running it on code blocks
21st Oct 2018, 6:22 AM
Bahubali
Bahubali - avatar
0
its been a long time, i' m sorry if i wrong but probably your add.cpp was not compiled make sure you compile all the required files by looking at build logs
21st Oct 2018, 6:46 AM
Taste
Taste - avatar
0
actually if I run it in terminal it works fine but in code blocks it is giving errors
21st Oct 2018, 6:48 AM
Bahubali
Bahubali - avatar
0
thanks u so much it helps
21st Oct 2018, 7:07 AM
Bahubali
Bahubali - avatar