On Wed, Apr 17, 2002 at 03:35:57AM -0500, Kenneth Cabrera wrote:
> How do I compile a program that call a .h file, but the implementation
> is in a .c file?
> I say:
> I have a .h file: (only the functions headers)
> I have a .c (with the implementation of the headers)
> And a .cpp file with a #include "XXX.h" directive.
either the .c or .cpp has to go.. Which language are you compiling
For C, keep the .h and .c.. drop the .cpp
put you funtion definitions ("function headers") in the .h
include the .h in the .c. Implement your functions in the .c
then simply go
$ gcc -c somefile.c
this will spit out the .o file, which you can think link in with your
$ gcc -o myprog file1.o file2.o ...
If the .c contains your main() function, you can do it in one go with
$ gcc -o myprog somefile.c
> How do I make the .exe from the .cpp file?
> How do I compile and what options do I need to use?
Same goes for c++, but call the .c file .cpp, .c++ or .cc
Jean le Roux
Binary Entropy Catalyst