LNK2001 errors = 4hrs of frustration

Started by
4 comments, last by Tesl 17 years, 5 months ago
OK I've been meddling with this all morning and can't seem to find where I screwed up, usually these are just typos but it just doesn't look that way. I have a renderer class that has a function for easly creating VERTEX's(a struct defined in the header). It seems to be this function that's causing me troulbes cause when I comment it out everything works perfectly. in the headers it's defined as VERTEX Create_Vertex(float,float,float,float,D3DCOLOR,float,float); in the code it's used like this ZDO.vert1 = Create_Vertex(pos.left, pos.top, 1.0, 1.0, col1, tex.left, tex.top); and I get these errors

--------------------Configuration: Map - Win32 Debug--------------------
Compiling...
graphicscore.cpp
game.cpp
c:\dxsdk\include\dinput.h: DIRECTINPUT_VERSION undefined. Defaulting to version 0x0800
winmain.cpp
c:\dxsdk\include\dinput.h: DIRECTINPUT_VERSION undefined. Defaulting to version 0x0800
Linking...
graphicscore.obj : error LNK2001: unresolved external symbol "public: struct VERTEX __thiscall CZolo_Graphics_Core::Create_Vertex(float,float,float,float,unsigned long,float,float)" (?Create_Vertex@CZolo_Graphics_Core@@QAE?AUVERTEX@@MMMMKMM@Z)
Debug/Map.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.

Map.exe - 2 error(s), 0 warning(s)

-----------------------------------------------The ZoloProject
Advertisement
Where do you define the function (i.e. implement the body of the function)

-me
I define it within the header, within the brackets pertaining to the class it'self.
-----------------------------------------------The ZoloProject
I'm an idiot I forgot to put the class scope before the function when defining it. deerr.
-----------------------------------------------The ZoloProject
That is where you declare it. He asked where its defined. Normally in a cpp file of the same name is where you implement (define) member functions for a header.

EDIT: There ya go :P
Quote:Original post by speedie
I'm an idiot I forgot to put the class scope before the function when defining it. deerr.


Haha, I can't count the number of times I've made that mistake :) Congrats on getting it fixed!
"Leave it to the computer programmers to shorten the "Year 2000 Millennium Bug" to "Y2K." Isn't that what caused this problem in the first place?"

This topic is closed to new replies.

Advertisement