0

I'm trying to use the code from this project from CodeProject:

http://www.codeproject.com/Articles/587629/A-Delaunay-triangulation-function-in-C

The problem is that the function which should be used in my project is:

WORD* BuildTriangleIndexList (void *pointList, float factor, int numberOfInputPoints, int numDimensions, int clockwise, int *numTriangleVertices)

which has a body inside the .cpp file, but no declaration in the header, so using the code as-is, I obviously get a compilation error complaining that it can't find the function.

So, I've tried to add the declaration to the header, and it compiles correctly, but the linker gave me:

Errore  1   error LNK2019: riferimento al simbolo esterno "unsigned short * __cdecl BuildTriangleIndexList(void *,float,int,int,int,int *)" (?BuildTriangleIndexList@@YAPAGPAXMHHHPAH@Z) non risolto nella funzione "protected: virtual void __thiscall TutorialApplication::createScene(void)" (?createScene@TutorialApplication@@MAEXXZ)  C:\Progetti\TestShader\TestShader\TutorialApplication.obj   TestShader

Thanks in advance.

starsplusplus
  • 1,232
  • 3
  • 19
  • 32
Kiske1
  • 408
  • 3
  • 15
  • 2
    Have you actually *defined* (i.e. implemented) the function in a source file that is compiled and linked in your project? – Some programmer dude Apr 09 '14 at 09:05
  • As Joachim pointed, you should add an header file and add the prototype of this function. Then, in your .cpp you include the header and the issue should be risolved. – Emi987 Apr 09 '14 at 09:10
  • As stated in the original post, I've added the prototype to the header, otherwise I can't even get it to compile... – Kiske1 Apr 09 '14 at 09:22

1 Answers1

1

The function definition is missing, either you link with a library that has the definition of the function or define on your own, no other alternative. Suspect that the call is in C, so, wrap the definition as: extern "C" { // delclaration as well as definition both } Another possibility is that is it is C++ member function of a class, make sure all overridden member functions have an implementation (function body), if not put as pure virtual (abstract)

Dr. Debasish Jana
  • 6,980
  • 4
  • 30
  • 69