Link to home
Start Free TrialLog in
Avatar of Troudeloup
Troudeloup

asked on

#include <mycode>

#include <windows.h>


is useful.


i have lots of function i want to use, but i don't want to having to copy them all over my codes that use them,

how do I #include  to use them?

they are only functions like this:



#include <iostream>
#include <windows.h>
#include <fstream>
#include <string>

using namespace std;

void mousemove( HWND hwnd1, int a, int b  );

int main ()
{
   return 0;
}


void mousemove( HWND hwnd1, int a, int b  )
{
      POINT p;
      p.x = a;
      p.y = b;
      ClientToScreen( hwnd1, &p );
      SetCursorPos( p.x, p.y );
      
}


SOLUTION
Avatar of Deepu Abraham
Deepu Abraham
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Troudeloup
Troudeloup

ASKER

so I type

g++ -o main.exe main.cpp 1.cpp 2.cpp 3.cpp   // and so on to compile them?



#include "n.h"



I include this line in  n.cpp and main.cpp?

or every cpp involved?
also, if I use window.h in more than one cpp, would more than one window.h get includes?

i don't want to increase the compiled file size unnecesarrily.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
#include "n.h"


and in n.cpp itself?



but i didn't create n.h,  does it mean the compiler would generate .h from .cpp involved automatically?