[Link Error: 2001] Selfmade Lib Problem
Mar 23, 2012 at 7:49pm UTC
We are trying to build a Editor for our Game Engine and so we made a lib from the Engine und link that in the Editor Proj.
The Path for the Lib and the Include Dir are remarked in the Proj. prop.
I tryed it with and without WinAPI but the Link Erro still remains.
OS: Windows 7 64Bit
Visual Studio 2010
Here is the code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
#include "pch.h"
Application* g_pApp = NULL;
INT WINAPI WinMain( __in HINSTANCE hInstance, __in_opt HINSTANCE hPrevInstance, __in LPSTR lpCmdLine, __in int nShowCmd )
{
BlocoApp blocoApp(&g_pApp);
// // create Qt App
// QApplication qt(argc, argv);
//
// // show splash screen
// QPixmap splashPicture("data\\SplashScreen.png");
// QSplashScreen splashScreen(splashPicture);
// splashScreen.show();
// start engine
Editor mainForm;
if (!g_pApp->Init(L"editor" , 1600, 900, true , NULL, mainForm.GetEngineHWND()))
{
g_pApp->Exit();
return 1;
}
// main loop
DXUTMainLoop();
g_pApp->Exit();
return 0;
}
The Compiler Error:
1>main.obj : error LNK2001: Nicht aufgelöstes externes Symbol "" public : bool __thiscall Application::Init(class std::basic_string<unsigned short ,struct std::char_traits<unsigned short >,class std::allocator<unsigned short > >,unsigned int ,unsigned int ,bool ,struct HINSTANCE__ *,struct HWND__ *)" (?Init@Application@@QAE_NV?$basic_string@GU?$char_traits@G@std@@V?$allocator@G@2@@std@@II_NPAUHINSTANCE__@@PAUHWND__@@@Z)" .
Thanks for any help :)
Mar 24, 2012 at 5:47pm UTC
No Ideas??
Lib is added with #pragama comment.
Only the functions which are not coded in the header produce the link errors.
Could it be that the way i add a new header and c++ is wrong?
Here is a small example:
1 2 3 4 5 6 7 8 9 10 11
#ifndef _ClassA_H
#define _ClassA_H
include<bloco.h>
class x
{
HRESULT Init( void * data);
};
#endif
The cpp File:
1 2 3 4 5 6
#include<bloco.h>
HRESULT x::Init(void * data)
{
return S_OK;
}
Mar 24, 2012 at 6:21pm UTC
Your Init prototype (if it is as in your example is wrong). You need to provide implementation for Init method with EXACTLY same arguments before it is used, otherwise you will get linker errors.
Topic archived. No new replies allowed.