I have recently installed VS 2005 and loaded my VS 2003 project. I quickly realized that I needed/wanted to define "_CRT_SECURE_NO_DEPRECATE" bc I need to be up-and-running with a clean compile fairly soon.
After adding the underscore to many of my string related calls, my only remaining problem is with four existing _itoa() function calls. I get the following compile errors:
error C3861: '_itoa': identifier not found
Sure, it seems that I have just forgot to include stdlib.h, but of course this is not the case as this is old code.
What am I missing I have even created the simplest of VC++ Win32 test programs and added one _itoa() call - same results.
I have also tried using the ___itoa() version which compiles fine but fails to link with:
error LNK2019: unresolved external symbol __imp___itoa referenced in function...
Please help! Thanks in advance.

_itoa "identifier not found" once ported to VS 2005
Bob-12
Have you tried the secure _itoa_s function
I use it because of the "declared depreciated"
Breezy-WA
"which defaults to including the proper stdlib.h "
It does NOT default to include stdlib.h. Only stdio.h.
my stdafx.h:
#pragma
once#define
WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers#include
<stdio.h>#include <tchar.h>
#include
<stdlib.h>my test.cpp file:
#include
"stdafx.h"int
_tmain(int argc, _TCHAR* argv[]){
char buff[32];_itoa(2, buff, 36);
return 0;}
to paste, use Ctrl+V
Allan_M
Zackling
Yeah, blaming DirectX was a stretch. I have no idea what else might have changed stdlib.h (I know that I did not). The only other thing that I did differently from one machine to the other was I hit the MS Updates site, by clicking the link on the VS 2005 CD, and let MS make all "recommended" updates from the machine that had the corrupted version.
I am now moving on to the next challenge... thanks again for your help with this one.
- Aaron
mcgyver74
no, it really is _itoa()... I have created the simplest of test VC win32 programs, which defaults to including the proper stdlib.h (from stdafx.h), and added a do nothing function that calls:
_itoa( i, buffer, 36);
.. and this line fails with the above message.
I appologise for not showing more code; if I could figure out how to paste into this editor, I would.
datapvs
Well, I am not completely losing my mind - just yet anyway... I found the problem; although I don't claim to completely understand it. As I described, I recently installed VS 2005 and began porting a large program from VS 2003. I whittled my 1290 compiler "depricated" errors and warnings down to four _itoa() calls giving the above error message. This message didn't make any sense as I had verified that stdlib.h was included.
The problem seems to lie in an odd decrepancy from one "version" (not really) of stdlib.h to the next. As I have said, I installed VS 2005 on my work machine (broken compile) and then, as a test, on my home machine (which fixed the broken compile). I copied the working project from home and brought it back in to work and the compiler subsequently issued the same error message on a simple test project.
What I have since discovered by comparing the two versions of stdlib.h from my home install with the stdlib.h on my work computer is that there is a subtle difference in the number of underscores in the following three lines 489, 490, 491 from stdlib.h:
(the one that works has only one underscore on every _itoa_s)
_CRTIMP __checkReturn_opt errno_t
__cdecl _itoa_s(__in int _Value, __out_ecount_z(_Size) char * _DstBuf, __in size_t _Size, __in int _Radix);__DEFINE_CPP_OVERLOAD_SECURE_FUNC_1_1(errno_t, _itoa_s, __in
int, _Value, __out_ecount(_Size) char, _Dest, __in int, _Radix)__DEFINE_CPP_OVERLOAD_STANDARD_FUNC_1_1(
char *, __RETURN_POLICY_DST, _CRTIMP, _itoa, __in int, _Value, __out_z char, _Dest, __in int, _Radix)(the one that causes the compiler to issue the funny error message has three underscores)
_CRTIMP __checkReturn_opt errno_t
__cdecl ___itoa_s(__in int _Value, __out_ecount_z(_Size) char * _DstBuf, __in size_t _Size, __in int _Radix);__DEFINE_CPP_OVERLOAD_SECURE_FUNC_1_1(errno_t, ___itoa_s, __in
int, _Value, __out_ecount(_Size) char, _Dest, __in int, _Radix)__DEFINE_CPP_OVERLOAD_STANDARD_FUNC_1_1(
char *, __RETURN_POLICY_DST, _CRTIMP, ___itoa, __in int, _Value, __out_z char, _Dest, __in int, _Radix)My only idea as to what might have happened to stdlib.h, because both installs of VS 2005 came from the same set of CDs, is that after installing VS 2005 on my broken work computer, I installed the DirectX SDK (Dec 2005). This makes no sense to me, but I am just happy to be up and running again. If anybody has any thoughts on this subject, please let me know; at this point my curiousity is peaked.
Thanks again to all those who have participated in this process with me!
TequilaTR
Matt Bamberger
My real program, the one I am porting from VS 2003, was using four simple _itoa() calls (single underscore). Since running into this problem, I have tried two, three, and the _itoa_s() versions as described in a previous rant. The compiler messages seemed to take me down that path then left me with the linker error detailed previously.
I am going to take VS 2005 home with me today and install it from scratch and try this simple "test" program again without changing any project defaults. I will let you all know on Monday what I find. Thanks again for the support.
The following simple test source code is still causing me the problem reported above. It is a default VC++/Win32 project with the addition of an _itoa() function call. I copied my Test3.cpp from the top down to the end of main and left off the rest of the default code for brevity. Following that I include the stdafx.h file showing the inclusion of the necessary stdlib.h file. Following that I include the compiler error output.
// test3.cpp : Defines the entry point for the application.
//
#include
"stdafx.h"#include
"test3.h"#define
MAX_LOADSTRING 100// Global Variables:
HINSTANCE hInst;
// current instanceTCHAR szTitle[MAX_LOADSTRING];
// The title bar textTCHAR szWindowClass[MAX_LOADSTRING];
// the main window class name// Forward declarations of functions included in this code module:
ATOM MyRegisterClass(HINSTANCE hInstance);
BOOL InitInstance(HINSTANCE,
int);LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
INT_PTR CALLBACK About(HWND, UINT, WPARAM, LPARAM);
int
APIENTRY _tWinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow){
UNREFERENCED_PARAMETER(hPrevInstance);
UNREFERENCED_PARAMETER(lpCmdLine);
// TODO: Place code here.MSG msg;
HACCEL hAccelTable;
char buf[32]; // Here is the problem child..._itoa(2,buf,36);
// Initialize global strings
LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
LoadString(hInstance, IDC_TEST3, szWindowClass, MAX_LOADSTRING);
MyRegisterClass(hInstance);
// Perform application initialization: if (!InitInstance (hInstance, nCmdShow)){
return FALSE;}
hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_TEST3));
// Main message loop: while (GetMessage(&msg, NULL, 0, 0)){
if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)){
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
return (int) msg.wParam;}
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#pragma
once// Modify the following defines if you have to target a platform prior to the ones specified below.
// Refer to MSDN for the latest info on corresponding values for different platforms.
#ifndef
WINVER // Allow use of features specific to Windows XP or later.#define
WINVER 0x0501 // Change this to the appropriate value to target other versions of Windows.#endif
#ifndef
_WIN32_WINNT // Allow use of features specific to Windows XP or later.#define
_WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows.#endif
#ifndef
_WIN32_WINDOWS // Allow use of features specific to Windows 98 or later.#define
_WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later.#endif
#ifndef
_WIN32_IE // Allow use of features specific to IE 6.0 or later.#define
_WIN32_IE 0x0600 // Change this to the appropriate value to target other versions of IE.#endif
#define
WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers// Windows Header Files:
#include
<windows.h>// C RunTime Header Files
#include
<stdlib.h>#include
<malloc.h>#include
<memory.h>#include
<tchar.h>1>------ Build started: Project: test3, Configuration: Debug Win32 ------
1>Compiling...
1>test3.cpp
1>c:\documents and settings\antec\my documents\visual studio 2005\projects\test3\test3\test3.cpp(33) : error C3861: '_itoa': identifier not found
1>Build log was saved at "file://c:\Documents and Settings\Antec\My Documents\Visual Studio 2005\Projects\test3\test3\Debug\BuildLog.htm"
1>test3 - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
blsandhya
Are you sure you have _itoa with just one _ As far as I can see in first the log you have posted you have 2 _ . Not that this would help... if I try with 2 _ I get an error that __itoa does not exist, not that warning.
Can you post the full source Also, did you change anything in the project settings Did you try to make a console application (I see that this one you posted is a Windows application)
ges
dhoward789
We both have stdlib.h included and I have tried the exact same call to _itoa(2, buff, 36) as you show above with the same odd compiler result as I got before (not found). Am I the only person in the world with this problem
I apologize in advance if this gets long winded - until today, I thought I knew what I was doing - now I am just frustrated. Any help is very much appreciated!
When I look under Tools/Options/Projects and Solutions/VC++ Directories, I see that it is including:
$(VCInstallDir)PlatformSDK\lib
$(VCInstallDir)PlatformSDK\include
(as well as others)
Here are a few more clues:
1. When I try using _itoa_s() i get the same result.
2. When I hover the cursor over _itoa, I get nothing (no yellow box).
3. When I add another underscore (__itoa), I get a yellow box but it wants another underscore (see the following):
1>------ Build started: Project: test3, Configuration: Debug Win32 ------ 1>Compiling... 1>test3.cpp 1>c:\documents and settings\antec\my documents\visual studio 2005\projects\test3\test3\test3.cpp(33) : warning C4996: '__itoa' was declared deprecated 1> c:\program files\microsoft visual studio 8\vc\include\stdlib.h(820) : see declaration of '__itoa' 1> Message: 'The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: ___itoa. See online help for details.' 1>Compiling resources... 1>Compiling manifest to resources... 1>Linking... 1>test3.obj : error LNK2019: unresolved external symbol __imp____itoa referenced in function _wWinMain@16 1>C:\Documents and Settings\Antec\My Documents\Visual Studio 2005\Projects\test3\Debug\test3.exe : fatal error LNK1120: 1 unresolved externals 1>Build log was saved at "file://c:\Documents and Settings\Antec\My Documents\Visual Studio 2005\Projects\test3\test3\Debug\BuildLog.htm" 1>test3 - 2 error(s), 1 warning(s) ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========So I add another underscore (___itoa) as suggested by the compiler. Then it suggests that I use: ___itoa_s - so I do and finally I get no compile errors - only the following linker error:
1>------ Build started: Project: test3, Configuration: Debug Win32 ------ 1>Compiling... 1>test3.cpp 1>Linking... 1>test3.obj : error LNK2019: unresolved external symbol __imp_____itoa_s referenced in function "int __cdecl ___itoa_s<32>(int,char (&)[32],int)" ( $___itoa_s@$0CA@@@YAHHAAY0CA@DH@Z) 1>C:\Documents and Settings\Antec\My Documents\Visual Studio 2005\Projects\test3\Debug\test3.exe : fatal error LNK1120: 1 unresolved externals 1>Build log was saved at "file://c:\Documents and Settings\Antec\My Documents\Visual Studio 2005\Projects\test3\test3\Debug\BuildLog.htm" 1>test3 - 2 error(s), 0 warning(s) ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========Graham Williams
Could you post the full source listing for a minimal cpp file that gives you this error.