My code :
int _tmain(int argc, _TCHAR* argv[])
{
HINTERNET hInternet;
BOOL bResult;
hInternet = InternetOpen( (LPCTSTR) "NoAgent",
(DWORD) INTERNET_OPEN_TYPE_DIRECT,
(LPCTSTR) NULL,
(LPCTSTR) NULL,
(DWORD) INTERNET_FLAG_ASYNC);
if (hInternet == NULL)
{
DebugTest("hInternet == NULL");
}
DebugTest("Internet handle created!");
bResult = InternetCloseHandle((HINTERNET) hInternet);
if (bResult == NULL)
{
DebugTest("InternetCloseHandle((HINTERNET) hInternet) == NULL");
}
return 0;
}
Here is how DebugTest() defined :
VOID DebugTest(CHAR * lpzsErrorText)
{
if (MessageBox(NULL, lpzsErrorText, "Error", MB_ICONERROR | MB_OKCANCEL)==IDCANCEL)
{
}
}
VOID DebugTest(INT nText) //Overloaded
{
CHAR lpzsErrorText[32];
_itoa(nText, lpzsErrorText, 10);
if (MessageBox(NULL, lpzsErrorText, "Error", MB_ICONERROR | MB_OKCANCEL)==IDCANCEL)
{
}
}
The error given :
------ Build started: Project: Internet, Configuration: Debug Win32 ------
Compiling...
Internet.cpp
Linking...
stdafx.obj : error LNK2005: "void __cdecl DebugTest(char *)" (?DebugTest@@YAXPAD@Z) already defined in Internet.obj
C:\Documents and Settings\Ahmed Han\Belgelerim\Visual Studio 2005\Projects\Internet\Debug\Internet.exe : fatal error LNK1169: one or more multiply defined symbols found
Build log was saved at "file://c:\Documents and Settings\Ahmed Han\Belgelerim\Visual Studio 2005\Projects\Internet\Debug\BuildLog.htm"
Internet - 2 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I used the same code for some of my other programs too, but this is the first time it gives such an error.
Platform : WinXP Home
Compiler : VC++ 2005
Reason for error = ?