B
Bryan Parkoff
"Load" and "Load2" are bound to "Include" while "Main" accesses variable
from "Include". I can only modify one source code before C++ compiler can
be able to compile one source code at this time so it does not need to
recompile all unmodified source codes. If I add or modify one header code,
it causes C++ Compiler to recompile all unmodified source codes. Why do it
do this?
How can I tell C++ Compiler's option to stop deleting all *.obj before
recompiling? All *.obj should remain unmodified while only one header code
can be compiled to create one object before one object can be linked to all
unmodified objects.
Please look at my code below for an example. Please let me know if
there is a way.
Bryan Parkoff
// Include.h
#if !defined(INCLUDE_H)
#define INCLUDE_H
extern int Total;
extern int Number;
extern int Number2;
void Run(void);
#endif // !defined(INCLUDE_H)
// Include.cpp
#include "Include.h"
#include "Load.h"
#include "Load2.h"
int Total = 10;
int Number = 12345;
int Number2 = 67890;
void Run(void)
{
Num();
Num2();
}
// Load.h
#if !defined(LOAD_H)
#define LOAD_H
void Num(void);
#endif // !defined(LOAD_H)
// Load.cpp
#include "Load.h"
#include "Include.h"
void Num(void)
{
Number *= Total;
}
// Load2.h
#if !defined(LOAD2_H)
#define LOAD2_H
void Num2(void);
#endif // !defined(LOAD2_H)
// Load2.cpp
#include "Load2.h"
#include "Include.h"
void Num2(void)
{
Number2 *= Total;
}
// Main.cpp
#include <stdio.h>
#include "Include.h"
int main(void)
{
printf("Hello...%d %d\n", Number, Number2);
Run();
printf("Hello...%d %d\n", Number, Number2);
return 0;
}
from "Include". I can only modify one source code before C++ compiler can
be able to compile one source code at this time so it does not need to
recompile all unmodified source codes. If I add or modify one header code,
it causes C++ Compiler to recompile all unmodified source codes. Why do it
do this?
How can I tell C++ Compiler's option to stop deleting all *.obj before
recompiling? All *.obj should remain unmodified while only one header code
can be compiled to create one object before one object can be linked to all
unmodified objects.
Please look at my code below for an example. Please let me know if
there is a way.
Bryan Parkoff
// Include.h
#if !defined(INCLUDE_H)
#define INCLUDE_H
extern int Total;
extern int Number;
extern int Number2;
void Run(void);
#endif // !defined(INCLUDE_H)
// Include.cpp
#include "Include.h"
#include "Load.h"
#include "Load2.h"
int Total = 10;
int Number = 12345;
int Number2 = 67890;
void Run(void)
{
Num();
Num2();
}
// Load.h
#if !defined(LOAD_H)
#define LOAD_H
void Num(void);
#endif // !defined(LOAD_H)
// Load.cpp
#include "Load.h"
#include "Include.h"
void Num(void)
{
Number *= Total;
}
// Load2.h
#if !defined(LOAD2_H)
#define LOAD2_H
void Num2(void);
#endif // !defined(LOAD2_H)
// Load2.cpp
#include "Load2.h"
#include "Include.h"
void Num2(void)
{
Number2 *= Total;
}
// Main.cpp
#include <stdio.h>
#include "Include.h"
int main(void)
{
printf("Hello...%d %d\n", Number, Number2);
Run();
printf("Hello...%d %d\n", Number, Number2);
return 0;
}