|
-
Jun 6th, 2001, 11:12 PM
#1
Thread Starter
Fanatic Member
No need to compile?
I have a class in a separate .h file that I never change. Is there a way to only compile this once and not have to do it again? Or is this automatically done for me and I made a pointless post? (Visual C++ 6)
Alcohol & calculus don't mix.
Never drink & derive.
-
Jun 7th, 2001, 02:22 AM
#2
Frenzied Member
depands on what compiler your using
i use vc++
when i compile a project
it skipps over everything i havent changed since last compile time
-
Jun 7th, 2001, 03:30 AM
#3
Monday Morning Lunatic
If you put it into a .h/.cpp combination then it will only compile it once. If it's in a header, it will compile it every time.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Jun 10th, 2001, 01:25 PM
#4
Lively Member
Make
The make program uses a makefile to compile. It only compiles what has changed. And to all of you who use Visual C++, Learn it the hard way! With GCC/G++!
-
Jun 10th, 2001, 01:33 PM
#5
Monday Morning Lunatic
Ah, but no 
If you #include "myheader.h" into mysource.cpp, then if myheader.h changes mysource.cpp is recompiled. If you have the class in myheader.h as myclass.h/myclass.cpp and you change myclass.cpp, only that file is recompiled and not mysource.cpp
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Jun 10th, 2001, 03:37 PM
#6
Thread Starter
Fanatic Member
I only have two files, we'll say class.h and source.cpp. If i change source.cpp and not class.h, will class.h still be compiled?
Alcohol & calculus don't mix.
Never drink & derive.
-
Jun 10th, 2001, 03:58 PM
#7
Monday Morning Lunatic
Indirectly, yes. Because class.h is included directly into source.cpp by the preprocessor, compiling source.cpp requires the contents of class.h to be compiled.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Jun 10th, 2001, 04:44 PM
#8
Thread Starter
Fanatic Member
Ok. Is there a way to not have to compile it?
Alcohol & calculus don't mix.
Never drink & derive.
-
Jun 10th, 2001, 04:47 PM
#9
Monday Morning Lunatic
Yes. The code sections of the .h file should be split into a .cpp file (the implementation of a class).
MyClass.h = contains definition of the class and its members
MyClass.cpp = contains implementation of the class, needs compiling
main.cpp = includes MyClass.h, if MyClass.h changes then main.cpp is recompiled. If MyClass.cpp changes then MyClass.cpp is recompiled but not main.cpp. If main.cpp is changed MyClass.cpp is not recompiled.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|