[CMake] Undefined symbols when header file with code is included

Nicholas Kinar n.kinar at usask.ca
Fri Aug 27 16:16:24 EDT 2010


> My mistake; linking with code contained in a header file actually 
> works quite well in CMake.  Just as the error says, the problem was 
> due to an undefined symbol.  In the file my_util.h, I changed
>
> template <class T>
>         void load_matrix(std::string fileName, TNT::Array2D<double> *M)
>
> to
>
> void load_matrix(std::string fileName, TNT::Array2D<T> *M)
>
> I was then able to successfully compile and link my program.
>
> Nicholas

Oops, one further correction:

template <class T>
         void load_matrix(std::string fileName, TNT::Array2D<double> *M)

to

template <class T>
         void load_matrix(std::string fileName, TNT::Array2D<T> *M)


Nicholas






More information about the CMake mailing list