Header files in dev-C++

后端 未结 5 1841
难免孤独
难免孤独 2021-01-21 00:07

I\'m trying to add an header file to dev-C++ but when I compile it it doesn\'t work. Here are my exact steps (for my example, I\'m trying to get mysql.h to work):

5条回答
  •  难免孤独
    2021-01-21 00:21

    Its very simple ...

    Just make Your header file and save it as .h extension.

    Then use #include "file_name.h" instead of using include

    Example- This is my header file.

    #include
         using namespace std;
    
         namespace Ritesh
             {
                 int a;
                 int b;
                 void sum();
             }
         void Ritesh::sum()
             {
                 cout<

    Then use of it-

    #include
    #include "Ritesh.h"
       using namespace std;
       using namespace Ritesh;
       int main()
           {
               a=4;b=6;
               sum();
           }
    

    Output- Output of program

提交回复
热议问题