PDA

View Full Version : error C2894: templates cannot be declared to have 'C' linkage


Bettynet
February 9th, 2006, 01:14 AM
Hi there!! I have been using ARToolkit library to help me in my AR proyect, and I was doing fine till yesterday. I'm working with Microsoft Visual c++ 6.0. I want to do PCA to a matrix, so I included matrix.h in my code. Since then I have the following error:

c:\archivos de programa\microsoft visual studio\vc98\include\math.h(514) : error C2894: templates cannot be declared to have 'C' linkage

I'm not very skillful yet, and don't know what to do. I've searched the web and this forum for an answer but couldn't find any. Can anyone help? Thanks in advance :)

dreamatworksnow
April 17th, 2007, 06:29 PM
suppose you have c .h file like a.h with contents
#incude<math.h>

now you are trying to use c lib/code in your c++ project as

#ifdef__cplusplus
extern "C"
{
#endif
..
..
#include<a.h>
...
..
#ifdef __cplusplus
}
#endif

then you will get this error..

remedy:- simply put a.h file before the extern "c"

Let me know .. it is helpful or not