I am converting my code to use Unicode, and have a compile error that I can't figure out. Please help, and thanks very much ahead of time. I've searched the internet for a solution, but even Google doesn't have a search result for even the simplest search string: "_wstat64i32 undefined". And I've searched the MSDN website and got similar results.


MSVC++ Express Edition

Windows SDK is installed


error C2079: 'statBuferror' uses undefined struct 'stat_test::_wstat64i32'


-A simple windows console project

-Defined _UNICODE in the C/C++ Preprocessor Definitions

#include "stdafx.h"

#include <tchar.h>

#include <windows.h>

#include <conio.h>

#include <sys/types.h>

#include <sys/stat.h>

int _tmain(int argc, _TCHAR* argv[])


struct _tstat statBuf;

return 0;


What I've been able to figure out:

<tchar.h> converts _tstat to _wstat

<wchar.h> converts that to _wstat64i32

get "error C2079: 'statBuf' uses undefined struct 'stat_test::_wstat64i32'

Re: Visual C++ General _wstat64i32 undefined

charley lu

I have the same problem. Has the problem been solved

Re: Visual C++ General _wstat64i32 undefined

charley lu

use the following codes:

struct _stat statbuf;

int ret = _tstat(filename, &statbuf);
if (0 != ret) { // error
_tprintf(_TEXT("_tstat '%s' failed\n"), child);

Re: Visual C++ General _wstat64i32 undefined

Weidong Huang - MSFT

_tstat is not a struct definition but a function name. So you cannot use struct _tstat.

Re: Visual C++ General _wstat64i32 undefined


Thanks guys. That fixed the problem.

Its a bit confusing in the MSDN help, or to put it another way its not as clear as mud. Look at the function declaration that's provided there. "_stat" is both a function and a structure. I didn't notice this until you guys pointed it out.

int _stat(
const char *path,
struct _stat *buffer

It becomes obvious further down in the MSDN help.

int _wstat(
const wchar_t *path,
struct _stat *buffer

Anyways, I'm very happy now because this was the LAST compile bug I had, and your help let me finally compile my code!

Attention to detail is a valuable timesaving skill.