[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
C++ / g++ question
This is a little OT but I have a question for any C++ people who might be
listening:
I have a program that uses two classes : a matrix class and a vector
class (ie that I wrote). I use templates to implement this so that my
vectors/matrices can be use several data types ( eg int, float, double )
as their fields.
I have it split up like this:
vector.h
matrix.h
vector.cpp
matrix.cpp
main.cpp
g++ -o matrix vector.cpp matrix.cpp main.cpp
bombs with error messages from ld (no errors from the compiler). However,
if I put
#include "vector.cpp"
#include "matrix.cpp
in the top of main.cpp, then
g++ -o matrix main.cpp
works as advertised
AFAIK, #including .cpp files is not "standard practice". Or is it ? Am I
missing something ?
CHeers,
--
Donovan
- References:
- Kappfinder
- From: Donovan Rebbechi <elflord@pegasus.rutgers.edu>