+ 9
header file
how can we create a header file on our own in c/c++
11 Respuestas
+ 15
E.g.
class A
{
public: int a;
A() { a=0; }
};
// name this file as classA.h
// in another file:
#include <iostream>
#include "classA.h"
int main()
{
A obj;
std::cout << obj.a;
}
+ 9
Yes on a computer, but, not on SL
+ 8
notice the difference of the include syntax @hatsy posted.
#include <xxxxx> searches the header file in the include-path of your project settings
#include "xxxxx" searches the header file in the folder of your project
+ 8
so i just need to save the file by the extension oh .h then i can cuse the methods of my own .h file
+ 7
You will need to use headers and source file in a IDE.
Files cannot be linked on SL
Codeblocks
https://www.sololearn.com/discuss/608805/?ref=app
Visual studio
https://www.sololearn.com/discuss/410578/?ref=app
+ 7
ok
+ 7
Also you need to include the header into your .cpp file(s).
+ 6
how
+ 5
write the code of file u want to do and save it by using .h extension after copy paste it to library file and u can access header file made by u like
#include<myheader.h>
Or #include"myheader.h"
+ 5
#include "xxxxx.h"