Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
I am getting this error :-
error LNK2019: unresolved external symbol "public: class ATL::CStringT<char,class StrTraitMFC_DLL<char,class ATL::ChTraitsCRT<char> > > __thiscall CFILicenseSettings::GetCodeStartup1(void)" (?GetCodeStartup1@CFILicenseSettings@@QAE?AV?$CStringT@DV?$StrTraitMFC_DLL@DV?$ChTraitsCRT@D@ATL@@@@@ATL@@XZ) referenced in function __catch$?ValidateLicense@CFIServerDlg@@AAE_NXZ$0	
 
The function is defines as follows
 
CString CFILicenseSettings::GetCodeStartup1()
{
 
	BYTE* bCode  = new BYTE[28];
	int * pnSize = new int(28);
 
	GetCodeIn1 (bCode, pnSize );
 
	int y;
 
	RC4_Init(m_byX, strlen((char*)m_byX));
 
	for (y = 0; y <  *pnSize ; y++)
	{
		m_MainLFString[y]  = bCode[y] ^ RC4_Output();
	}
 
	m_MainLFString[y] = '\0';
 
	//strcpy(m_szMainLFString.GetBuffer(m_szMainLFString.GetLength()),m_MainLFString); 

	m_szMainLFString = m_MainLFString;
 
	delete [] bCode;
	delete pnSize;
 
	return m_szMainLFString;
	
 }
 
To use CString i have also added header file atlstr.h file in my project too
Can you please help me to remove this error
Posted 30-Nov-12 3:32am
Comments
Eugen Podsypalnikov at 30-Nov-12 8:51am
   
Are the (FIServerDlg.cpp and FILicenseSettings.cpp) files in the same project ? :)
Tarun Batra at 30-Nov-12 8:52am
   
yes sir
Eugen Podsypalnikov at 30-Nov-12 8:55am
   
...and how it (the function) is declared in its header ? :)
Tarun Batra at 30-Nov-12 8:59am
   
It is declared as CString GetCodeStartup1(); in FILicenseSettings.h
Eugen Podsypalnikov at 30-Nov-12 9:01am
   
Has the pragma (set it):
#pragma error
any compiling effect inside the function's body ? :)
Tarun Batra at 30-Nov-12 9:05am
   
No sir
Eugen Podsypalnikov at 30-Nov-12 9:07am
   
=> the function is invisible for the compiler.
Have you some
#ifdef
or
#if
in the FILicenseSettings.cpp, above the function ? :)
Tarun Batra at 30-Nov-12 9:12am
   
not at all sir
Eugen Podsypalnikov at 30-Nov-12 9:15am
   
Can you see "Yes" in the entry "Excluded From Build"
in the general properties of the FILicenseSettings.cpp
(context menu for the file in the project tree) ? :)
Tarun Batra at 30-Nov-12 9:19am
   
Sir i can see "NO" in "Excluded From Build"
Eugen Podsypalnikov at 30-Nov-12 9:21am
   
Can you compile the file from its context menu
(and see the output of #pargma error) ? :)
Eugen Podsypalnikov at 30-Nov-12 9:27am
   
Can you see the function,
if you select "Open" in the file's context menu at the project tree ? :)
Tarun Batra at 30-Nov-12 9:35am
   
yes sir
Eugen Podsypalnikov at 30-Nov-12 9:38am
   
Have you the same linker error
if you comment its cpp-implementation ? :)
Tarun Batra at 30-Nov-12 9:40am
   
if i comment the call of my function CFILicenseSettings then my projects compile successfully
Eugen Podsypalnikov at 30-Nov-12 9:42am
   
Try comment the function itself in the FILicenseSettings.cpp,
not its call... :)
Tarun Batra at 30-Nov-12 9:44am
   
same error
Eugen Podsypalnikov at 30-Nov-12 9:47am
   
Now try to remove your comments (make any changes)
and to compile the file from its context menu in the project tree:
can you see any output (at the output window) ? :)
Tarun Batra at 30-Nov-12 9:49am
   
file compile succesfully
Eugen Podsypalnikov at 30-Nov-12 9:52am
   
Now try to make an error inside the function's body,
for example: write "hello world" instead of "return".
Then try again, please, to see the output :)
Tarun Batra at 30-Nov-12 9:54am
   
i did like this CString CFILicenseSettings::GetCodeStartup1()
{
 
BYTE* bCode = new BYTE[28];
int * pnSize = new int(28);
 
//GetCodeIn1 (bCode, pnSize );
 
int y;
 
//RC4_Init(m_byX, strlen((char*)m_byX));
 
for (y = 0; y < *pnSize ; y++)
{
m_MainLFString[y] = bCode[y] ^ RC4_Output();
}
 
m_MainLFString[y] = '\0';
 
//strcpy(m_szMainLFString.GetBuffer(m_szMainLFString.GetLength()),m_MainLFString);
 
// m_szMainLFString = m_MainLFString;
 
delete [] bCode;
delete pnSize;
//
//return m_szMainLFString;
"hello world";
//
} i get the error Error 2 error C4716: 'CFILicenseSettings::GetCodeStartup1' : must return a value e:\timswebservermanager_lic\timswebservermanager\filicensesettings.cpp
Eugen Podsypalnikov at 30-Nov-12 9:58am
   
Hm... :)
Now the function is visible for the compiler
and invisible for the linker :)
Try to transport it (its correctly form):
CString CFILicenseSettings::GetCodeStartup1()
{
...
}
into the file of usage (FIServerDlg.cpp ?)
then - try again :)
Tarun Batra at 30-Nov-12 10:03am
   
can you please give me your mail id by mailing me on trn200190@gmail.com
CPallini at 30-Nov-12 9:08am
   
Did you specify 'Dynamic Link to ATL' (or Static Link to ATL') in your project settings?
Tarun Batra at 30-Nov-12 9:12am
   
ya sir i try'ed with that too
Richard MacCutchan at 30-Nov-12 9:21am
   
Did you add the relevant library in to your Linker properties?
Tarun Batra at 30-Nov-12 9:22am
   
which library do i have to add
nv3 at 30-Nov-12 9:28am
   
Got to the Properties Dialog of your project; click the General tab on the left and check that either "Use of MFC" or "Use of ATL" is clicked on. That adds the relevant libraries for you that Richard mentioned in his post.
Tarun Batra at 30-Nov-12 9:33am
   
sir use of mfc is set to "Use MFC in a shared DLL" and atl is set to "NOT USING ATL"
nv3 at 30-Nov-12 9:56am
   
Looks to me like the source file in which your GetCodeStartup1 function sits is not part of the compilation, so either not in the project or the file is deactivated in the project.
Richard MacCutchan at 30-Nov-12 11:17am
   
Well that is definitely wrong since your code is using the ATL::CStringT class, as is clear from the linker error message, and the fact that you have included atlstr.h into your source.
cariolihome at 30-Nov-12 18:18pm
   
Try to search in *.obj file 'GetCodeStartup1' string. It can help You understand which decorated name was created for this function.
Darkling85 at 17-Jun-13 8:30am
   
IMHO: You need to review your 'ValidateLicense' function, because unresolved external symbol is defined inside. You need to validate appropriate dependencies for the file that contains this function.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web01 | 2.8.150327.1 | Last Updated 30 Nov 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100