Sign in to follow this  

error LNK2019: unresolved external symbol - cant figure out...

This topic is 2955 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

What an annoying error, everything looks fine, no problems at compiling, I cant figure out why Im getting this error at linking... Im not using any libs, just windows.h and my own headers.. Since I have no idea of whats going on, Ill try resume my code so one can check for some stupid error Im doing... The error:
ModSim_main.obj : error LNK2019: unresolved external symbol "public: void 
__thiscall Scheduler::CriaProcesso(int,char *,struct PROC_DISTRIB)" 
(?CriaProcesso@Scheduler@@QAEXHPADUPROC_DISTRIB@@@Z) referenced in function 
_WinMain@16



So I have this header file where I put all my typedefs and structs, Im including it in all my class headers and in my main cpp( as you will see): ModSim_deftypes.h
#ifndef DEFTYPES_H
#define DEFTYPES_H

#define PROC_GERADOR	TRUE
#define PROC_ROTEADOR	FALSE

typedef BYTE DISTRIB_TYPE;
	#define DT_Normal		0x01
	#define DT_Exponencial	0x02
	#define DT_Uniforme		0x03

typedef struct{
	DISTRIB_TYPE	DistribType;
	INT				iValue;
	INT				iDesvio;
}PROC_DISTRIB;

//LCG structure:
typedef struct {
	UINT a;		//const multi
	UINT c;		//const adit
	UINT m;		//module
	UINT X;		//value of the actual seqence
	UINT seed;	//seed used to generate the seqence
	//UINT i;	//iterator
}LCG_DATA;

struct TMP_SAIDADEPROC{
...
};

#endif



Note the type PROC_DISTRIB, I thing is this symbol the problem.. My main cpp: ModSim_main.cpp

#ifdef UNICODE
	#undef UNICODE
#endif

//=================================================
//includes:
//===================================================================
#define	WIN32_LEAN_AND_MEAN

#include <windows.h>

#ifdef _DEBUG
	#include <crtdbg.h>
#endif

	//private includes:
#include "ModSim_deftypes.h"
#include "Scheduler.h"

//=============================================


...

//============================================================
//globals:
//=========================================================
	//wnd:
HWND hmainwnd;				//main app wnd
HRESULT hr;					//error handler

...

	//objects:
Scheduler ModelSched;
//================================================================================


//===========================================
//prototypes
//======================================
	//wnd:
LRESULT CALLBACK WndProc( HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam );
BOOL	CALLBACK AboutProc( HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam );
BOOL	CALLBACK NewProcProc( HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam );
//=====================================================



//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
//entrypoint
//XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
INT WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, INT nShowCmd ){

#ifdef _DEBUG
	_CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
#endif

	PROC_DISTRIB dtrbinfo = {0};
	ModelSched.uiTempoGlobal = 0;
	ModelSched.Run();

	ModelSched.CriaProcesso( TRUE, TEXT("coco"), dtrbinfo );

...



Notice the part "ModelSched.CriaProcesso( TRUE, TEXT("coco"), dtrbinfo );"( I puted those here for simplicity )", I can access every thing on that object, except for that function, I guess the problem is the parameter PROC_DISTRIB, but I cant figure out why or how solve it... My Scheduler header: Scheduler.h

#ifndef SCHEDULER_H
#define SCHEDULER_H

#define	WIN32_LEAN_AND_MEAN
#include <windows.h>

//private includes:
#include "ModSim_deftypes.h"
#include "Processo.h"

class Scheduler{

public:
	 Scheduler();
	~Scheduler();

	UINT uiTempoGlobal;

	Processo *pProcessoList;

//------

	VOID Run();		//loop

	VOID CriaProcesso( BOOL bProcGeradorp, TCHAR *szNamep, PROC_DISTRIB DistribInfop );
	VOID DeletaProcesso( UINT IDp );

};

#endif



The Scheduler.cpp:

#include "Scheduler.h"

Scheduler::Scheduler(){

	uiTempoGlobal = 0;

}

Scheduler::~Scheduler(){

...

}

VOID Scheduler::CriaProcesso( BOOL bProcGeradorp, TCHAR *szNamep, PROC_DISTRIB DistribInfop ){

	if( pProcessoList == NULL ){//if list is empy

		pProcessoList = new Processo( bProcGeradorp, szNamep, DistribInfop );
			pProcessoList->pNext = NULL;

	}else{//if list have been filled

		Processo *tmpp = pProcessoList;//tmp iterator

		while( tmpp->pNext != NULL ){
			tmpp = tmpp->pNext;
		}

		tmpp->pNext = new Processo( bProcGeradorp, szNamep, DistribInfop );
			tmpp->pNext->pNext = NULL;

	}

}

...




As you can see the class Scheduler contains a class Processo object, but I dont know if it is an info necessary, tell me if it is..

Share this post


Link to post
Share on other sites
I bet it has something to do with your #undef UNICODE.

edit: If your project defines UNICODE then I am almost 100% sure that's the problem. You have two .cpp files and they each get processed differently because of your #undef UNICODE being only in the ModSim_main.cpp file and not also in the Scheduler.cpp.

edit2: Actually, why *are* you doing #undef UNICODE in the first place? If you don't want Unicode you can change that in your project settings. I can see very little benefit to manually removing a compiler supplied symbol in your source code directly.

[Edited by - nobodynews on November 7, 2009 6:21:06 PM]

Share this post


Link to post
Share on other sites

This topic is 2955 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this