+ 3
How to create function in separate files
Ok now we have learned we can create class in separate file but what about creating function in separate file. Like I mean mentioned the header file then use all the user defined function in any cpp file
11 Antworten
+ 9
Don't forget to include your custom header files in your main cpp file and link all cpp files in order to compile the whole thing
+ 6
You need the main function for a program.
+ 3
The same way, you do it with classes:
.h
void func(int);
.cpp
#include "a.h"
void func(int a)
{
std::cout << a;
}
+ 3
Thanks
+ 3
Ok I just tried but getting error in the cpp
Undefined reference to winmain
+ 3
Undefined reference to winmain usually means you don't have a main function.
+ 3
So how can we create function in separate files
+ 2
I don't develop much using windows but that's most likely because of a missing windows dependency
+ 2
I don't understand your point bro
+ 2
Any example I can get bro
+ 2
Thanks for help Anna I got it. I was not creating project I was doing that on single source files thanks