11 Replies - 4524 Views - Last Post: 29 June 2011 - 03:50 AM Rate Topic: -----

#1 anubhavs.rns  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 29-June 11

error LNK2019: unresolved external symbol

Posted 29 June 2011 - 12:35 AM

Hi,

When I am building my solution I am getting such errors as follows:


Error 7 error LNK2019: unresolved external symbol "public: void __cdecl CCameraUtility::ShowImage(wchar_t * const)" (?ShowImage@CCameraUtility@@QAAXQA_W@Z) referenced in function "private: void __cdecl CST_CAM_Brightness::VerifyImages (int,int)" (?VerifyImages@CST_CAM_Brightness@@AAAXHH@Z) ST_CAM_Brightness.obj

Error 9 error LNK2001: unresolved external symbol "public: int __cdecl CCameraUtility::GetImageFILEPREFIX(wchar_t *)" (?GetImageFILEPREFIX@CCameraUtility@@QAAHPA_W@Z) ST_CAM_VideoLighting.obj

Error 13 error LNK2001: unresolved external symbol "public: unsigned long __cdecl CCameraUtility::GetVideoFileNumber(int)" (?GetVideoFileNumber@CCameraUtility@@QAAKH@Z) ST_CAM_VidMaxLength.obj

Please help me out.....

Anubhav

This post has been edited by anubhavs.rns: 29 June 2011 - 12:36 AM


Is This A Good Question/Topic? 0
  • +

Replies To: error LNK2019: unresolved external symbol

#2 PlasticineGuy  Icon User is offline

  • mov dword[esp+eax],0
  • member icon

Reputation: 281
  • View blog
  • Posts: 1,436
  • Joined: 03-January 10

Re: error LNK2019: unresolved external symbol

Posted 29 June 2011 - 12:37 AM

We need your code for us to help.
Was This Post Helpful? 0
  • +
  • -

#3 anubhavs.rns  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 29-June 11

Re: error LNK2019: unresolved external symbol

Posted 29 June 2011 - 12:43 AM

Please find the code:

void CCameraUtility::ShowImage(TCHAR szImagePath[]) 
{		
		int nShowForSeconds = 5;
		PROCESS_INFORMATION piProcessInfo;
		memset(&piProcessInfo, 0, sizeof(piProcessInfo));
		
		
		if(CreateProcess(_T("pimg"), szImagePath, 0, 0, FALSE, 0, 0, 0,0, &piProcessInfo)  ==  false)
		{ 
			m_pFBBaseObject->LogError(ERROR_IMAGE_OPEN_FAILED);
			m_pFBBaseObject->m_nTCResult |= NO_RESULT;
			return;
		}
		m_pFBBaseObject->RefreshWindow();
		for(int i = 0; i < nShowForSeconds; i++)
		{		
			m_pFBBaseObject->RefreshWindow();
			Sleep(DELAY);
		}		
	
		HWND hWnd = GetForegroundWindow();
		WCHAR lpstr[BUFFER_128] = {'\0'};
		GetWindowText(hWnd, lpstr, BUFFER_128);
		
		if(0 == wcscmp(lpstr, _T("Pictures & Videos")))	//Caption 	
			SendMessage(hWnd, WM_CLOSE, 0, 0); 
	
}



Is it enough?Or if you need something more please let me know....

int CCameraUtility::GetImageFilePrefix(TCHAR* szPrefix)
{
	TCHAR szVal[25] = {'\0'};
	LONG lnReturn;
	HKEY hKeyR = NULL;
	DWORD dwType = REG_SZ;
	DWORD dwSize = (unsigned int)sizeof(szVal);

	if(RegOpenKeyEx(HKEY_CURRENT_USER, CURRENT_USER_SETTINGS, 0, 0, &hKeyR) != ERROR_SUCCESS)
	{
		m_pFBBaseObject->LogError(ERROR_REG_NOT_OPEN);
		return FAILURE;
	}

	lnReturn = RegQueryValueEx(hKeyR, _T("FilePrefix"), 0, &dwType, (LPBYTE)&szVal, &dwSize);

	if(lnReturn != ERROR_SUCCESS)
	{
		m_pFBBaseObject->LogError(ERROR_REGISTRY_READ_FAIL);
		RegCloseKey(hKeyR);
		return FAILURE;
	}
	wcscpy(szPrefix, szVal);
	RegCloseKey(hKeyR);
		
	return SUCCESS;
}

DWORD CCameraUtility::GetVideoFileNumber( int nCheckFlag)
	{
		DWORD dwVal		= 0;
		LONG returnStatus;
		HKEY hKeyR		= NULL;
		DWORD dwType    = REG_SZ;
		DWORD dwSize    = sizeof(dwVal);
		bool  status    = false;

		if (nCheckFlag == 1)
		{

		if(RegOpenKeyEx(HKEY_LOCAL_MACHINE, CURRENT_USER_SETTTINGS_2, 0, 0, &hKeyR) == ERROR_SUCCESS)
			{
				returnStatus = RegQueryValueEx(hKeyR, _T("CurrentVideo"), 0, &dwType, (LPBYTE)&dwVal, &dwSize);
				if(returnStatus == ERROR_SUCCESS)
				{
					status = true;
				}
				RegCloseKey(hKeyR);
			}
			if(!status)
		{
			m_pFBBaseObject->LogError(ERROR_REGISTRY_READ_FAIL);
			m_pFBBaseObject->m_nTCResult |= NO_RESULT;
		}
		return dwVal;

		}

		else
		{
			if(RegOpenKeyEx(HKEY_CURRENT_USER, CURRENT_USER_SETTINGS, 0, 0, &hKeyR) == ERROR_SUCCESS)
				{
					returnStatus = RegQueryValueEx(hKeyR, _T("FileNumber"), 0, &dwType, (LPBYTE)&dwVal, &dwSize);
				if(returnStatus == ERROR_SUCCESS)
					{
						status = true;
					}
				RegCloseKey(hKeyR);
		}
	if(!status)
	{
		m_pFBBaseObject->LogError(ERROR_REGISTRY_READ_FAIL);
		m_pFBBaseObject->m_nTCResult |= NO_RESULT;
	}
	return dwVal;

		}

	
	}


This post has been edited by no2pencil: 29 June 2011 - 12:48 AM
Reason for edit:: Added code tags

Was This Post Helpful? 0
  • +
  • -

#4 no2pencil  Icon User is offline

  • Toubabo Koomi
  • member icon

Reputation: 5247
  • View blog
  • Posts: 27,066
  • Joined: 10-May 07

Re: error LNK2019: unresolved external symbol

Posted 29 June 2011 - 12:48 AM

Your error references that the function __cdecl was referenced but not defined.

Can you provide the code with this function?
Was This Post Helpful? 0
  • +
  • -

#5 anubhavs.rns  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 29-June 11

Re: error LNK2019: unresolved external symbol

Posted 29 June 2011 - 12:51 AM

View Postno2pencil, on 29 June 2011 - 12:48 AM, said:

Your error references that the function __cdecl was referenced but not defined.

Can you provide the code with this function?


yes .....


here it is....

void CST_CAM_Brightness::VerifyImages(int nSup_Brightlev, int nCheckFlag )
{
	TCHAR szImagePath[BUFFER_256] = {'\0'};
	TCHAR szFileName[BUFFER_64] = {'\0'};
	WCHAR szFolderPath[BUFFER_256]= {'\0'};
	CString strFilePath(m_szMyPictures);
	int nPos = strFilePath.ReverseFind('\\');

	// Find the folder path
	CString strScrFolder = strFilePath.Left(nPos);
	_stprintf(szFolderPath, _T("%s"), strScrFolder);

	DWORD dwX = 10, dwY = 100, dwFileNumber = 0, dwCurrFileNumber = 0;
	
	dwCurrFileNumber = m_CamUtil.GetImageNumber(nCheckFlag);

	UpdateTCStatus(_T("Displaying images one after other..."));
	// Registry Manipulations are done according to device type.
	if (nCheckFlag == 1)
	{
		dwFileNumber = dwCurrFileNumber - (nSup_Brightlev-1); //Get the first image File Number
		for(int i = dwFileNumber; i <= (int)dwCurrFileNumber; i++)
			{
			if(dwFileNumber != 0)
				{
					//  To find name of the image, image prefix is concatenated with file number.
					_stprintf(szFileName, _T("%s%d.jpg"), m_szFilePrefix, i);
					_stprintf(szImagePath, _T("%s\\%s"), szFolderPath, szFileName);
					m_CamUtil.ShowImage(szImagePath);
				}
				
			else
			
			{
				LogError(ERROR_FILE_NUMBER_INVALID);
				m_nTCResult |= NO_RESULT;
				return;
			}

		}
	}

	else

	{
		dwFileNumber = dwCurrFileNumber - (nSup_Brightlev); //Get the first image File Number
	for(int i = dwFileNumber; i < (int)dwCurrFileNumber; i++)
	{
		if(dwFileNumber != 0)
		{
		//  To find name of the image, image prefix is concatenated with file number.
			if(dwFileNumber < dwX)
				_stprintf(szFileName, _T("%s00%d.jpg"), m_szFilePrefix, i);
			else if(dwFileNumber < dwY)
				_stprintf(szFileName, _T("%s0%d.jpg"), m_szFilePrefix, i);
			else if(dwFileNumber >= dwY)
				_stprintf(szFileName, _T("%s%d.jpg"), m_szFilePrefix, i);

		_stprintf(szImagePath, _T("%s\\%s"), szFolderPath, szFileName);
				m_CamUtil.ShowImage(szImagePath);
			}
		else
			{
				LogError(ERROR_FILE_NUMBER_INVALID);
				m_nTCResult |= NO_RESULT;
				return;
			}

		}

	}
	UpdateTCStatus(_T("Image display completed."));
}


This post has been edited by no2pencil: 29 June 2011 - 12:59 AM
Reason for edit:: Added code tags

Was This Post Helpful? 0
  • +
  • -

#6 no2pencil  Icon User is offline

  • Toubabo Koomi
  • member icon

Reputation: 5247
  • View blog
  • Posts: 27,066
  • Joined: 10-May 07

Re: error LNK2019: unresolved external symbol

Posted 29 June 2011 - 01:00 AM

Going forward, please use code tags when posting your code.
Was This Post Helpful? 0
  • +
  • -

#7 anubhavs.rns  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 29-June 11

Re: error LNK2019: unresolved external symbol

Posted 29 June 2011 - 02:15 AM

yes sure....
Can you tell me the solution of the problem or you want me to send the code with tags??
Was This Post Helpful? 0
  • +
  • -

#8 PlasticineGuy  Icon User is offline

  • mov dword[esp+eax],0
  • member icon

Reputation: 281
  • View blog
  • Posts: 1,436
  • Joined: 03-January 10

Re: error LNK2019: unresolved external symbol

Posted 29 June 2011 - 02:18 AM

You haven't defined the functions void CST_CAM_Brightness::VerifyImages (int,int), int CCameraUtility::GetImageFILEPREFIX(wchar_t *) or unsigned long CCameraUtility::GetVideoFileNumber(int).
Was This Post Helpful? 0
  • +
  • -

#9 anubhavs.rns  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 29-June 11

Re: error LNK2019: unresolved external symbol

Posted 29 June 2011 - 02:22 AM

All the above mentioned functions are defined....
Was This Post Helpful? 0
  • +
  • -

#10 PlasticineGuy  Icon User is offline

  • mov dword[esp+eax],0
  • member icon

Reputation: 281
  • View blog
  • Posts: 1,436
  • Joined: 03-January 10

Re: error LNK2019: unresolved external symbol

Posted 29 June 2011 - 02:25 AM

Where? Is the cpp file part of the project?
Is there any way you could post your *complete* code?
Was This Post Helpful? 0
  • +
  • -

#11 anubhavs.rns  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 29-June 11

Re: error LNK2019: unresolved external symbol

Posted 29 June 2011 - 02:31 AM

i cant as it is very big also it is confidential...

Is there anything as code is defined for these functions???
Can there be linking error???

or any file missing in the properties??
Was This Post Helpful? 0
  • +
  • -

#12 jimblumberg  Icon User is offline

  • member icon


Reputation: 4018
  • View blog
  • Posts: 12,400
  • Joined: 25-December 09

Re: error LNK2019: unresolved external symbol

Posted 29 June 2011 - 03:50 AM

The linker error: "unresolved external symbol" means that the compiler can not find the function or variable in any of the files in the project. So to fix the error you will need to insure that the implementation file that contains the function in question is indeed part of the project. Check the spelling, insure that the parameters are identical, insure that the return value is identical, this includes any const qualifiers if required.

The functions in question are:

Quote

void CCameraUtility::ShowImage(wchar_t * const)
int CCameraUtility::GetImageFILEPREFIX(wchar_t *)
unsigned long CCameraUtility::GetVideoFileNumber(int)



Jim
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1