I am trying to update to the MinGW 64 bit C++ compiler within CodeBlocks on a Windows 7 system. (I have also tried this on a Windows 10 system with the same results).
To do this I have downloaded and installed the most recent version of CodeBlocks (v. 16.01) and the most recent version of MinGW64 using TDM-GCC Compiler Suite for Windows.
I then followed the instruction for installing this compiler in the CodeBlocks found on these two pages:
http://wiki.codeblocks.org/index.php?title=MinGW_installation
and
https://medium.com/@yzhong.cs/code-blocks-compile-64-bit-under-windows-with-mingw-w64-79101f5bbc02
I start with a console base project, and try to compile the default "Hello World" program that CodeBlocks creates. This program compiles and runs just fine when I use the default GNU GCC compiler (32 bit) that comes with the CodeBlocks installation. However, I get a compiler error when I try to compile this same code using the 64 bit compiler.
The compiler identifies an error on line 36 in crtdef.h.
This line reads:
__MINGW_EXTENSION typedef unsigned __int64 size_t;
The error message reads:
Error: '__MINGW_EXTENSION' does not name a type.
Several other similar "does not name a type" errors appear until the 50 error max is reached.
I do not know what crtdef.h is, or does, but I assume it is somehow part of <iostream>, since that is the only header included in the default "Hello World" program.
So, I am figuring that I have done something wrong in the installation of the 64 bit compiler, but I cannot figure out what that something might be. I have looked around this forum, and other places using Google search, but cannot find descriptions of a similar problem.
Any suggested solutions will be appreciated.
Thanks
http://wiki.codeblocks.org/index.php/FAQ-Compiling_(errors)#Q:_How_do_I_troubleshoot_a_compiler_problem.3F (http://wiki.codeblocks.org/index.php/FAQ-Compiling_(errors)#Q:_How_do_I_troubleshoot_a_compiler_problem.3F)
http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28general%29#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F (http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28general%29#Q:_How_do_I_report_a_compilation_problem_on_the_forums.3F)
Post a full rebuild log in code tags.
And, maybe I or someone else will see the problem.
Tim S.
Also, post the output of the following from the command line.
echo %PATH%
This is the output on my desktop PC.
C:\Program Files\Mozilla Firefox;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\TortoiseGit\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Apps32\Bakefile;C:\Program Files\IDM Computer Solutions\UltraEdit;C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\TShell\TShell\;C:\Apps\WATCOM\BINNT;C:\Apps\WATCOM\BINW;C:\Apps32\zip300xn;C:\Apps32\Bakefile;C:\Apps\misc;C:\Apps32\misc;C:\Users\stahta01\AppData\Local\M2OSW\pkg-explorer\WPKG_ROOT\bin;C:\Apps32\7za920;C:\Apps32\GnuWin32\bin;C:\Apps32\Apache-Subversion-1.9\bin;C:\Program Files\Git\cmd;C:\Program Files\CMake\bin;C:\Apps32\GnuWin\bin;C:\Users\stahta01\AppData\Local\Microsoft\WindowsApps;C:\Program Files\Mercurial;;C:\Program Files\Microsoft VS Code\bin
Tim S.
Thanks for the rapid response. I've now looked at this FAQ, and none of the circumstances it includes describes my problem.
The closest one is: Q: My simple C++ program throws up lots of errors - what is going on?
The suggestion is that the user is trying to compile a C++ program as a C program. But, that is not the case for me. The "Hello World" program has a cpp extension. And, as I stated, compiles and runs just fine in the 32 bit compiler.
So, I am pretty sure the problem lies in how I set up the new 64 bit compiler. I just do not know what the problem is.
Additional Suggestions/Questions:
My path is:
PATH=C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\system32\wbem;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Windows\System
32\WindowsPowerShell\v1.0;C:\Program Files (x86)\Common Files\Roxio Shared\DLLShared;c:\Program Files (x86)\Common Files\Ulead Systems\MPEG;C:\Program Files (x86)\QuickTime\QTSystem;c:\Program Files (x86)\Java\jre6\bin;C:\Program Files\Java\jdk1.6.0_21\bin;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files (x8
6)\QuickTime\QTSystem\;c:\ndigital\programs;C:\Program Files\MATLAB\MATLAB Compiler Runtime\v82\runtime\win64;C:\cygwin64\bin;C:\GnuWin32\include;C:\GnuWin32\bin;C:\Program Files\IBM\SPSS\Statistics\24\JRE\bin;C:\Program Files (x86)\gnuplot\bin;C:\TDM-GCC-64\bin;C:\Program Files (x86)\Skype\Phone\
My full rebuld log is:
-------------- Clean: Debug in test7 (compiler: MinGW 64 Bit)---------------
Cleaned "test7 - Debug"
-------------- Build: Debug in test7 (compiler: MinGW 64 Bit)---------------
x86_64-w64-mingw32-g++.exe -Wall -fexceptions -g -Wnon-virtual-dtor -Winit-self -Wunreachable-code -Wall -std=c++11 -ftemplate-backtrace-limit=0 -IC:\CodeBlocks\MinGW\include -IC:\GnuWin32\include -IC:\Eigen -Ic:\boost -c D:\test7\main.cpp -o obj\Debug\main.o
In file included from C:/TDM-GCC-64/x86_64-w64-mingw32/include/stddef.h:7:0,
from C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/stddef.h:1,
from C:\CodeBlocks\MinGW\include/wchar.h:26,
from C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++/cwchar:44,
from C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++/bits/postypes.h:40,
from C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++/iosfwd:40,
from C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++/ios:38,
from C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++/ostream:38,
from C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++/iostream:39,
from D:\test7\main.cpp:1:
C:/TDM-GCC-64/x86_64-w64-mingw32/include/crtdefs.h:35:1: error: '__MINGW_EXTENSION' does not name a type
__MINGW_EXTENSION typedef unsigned __int64 size_t;
^
C:/TDM-GCC-64/x86_64-w64-mingw32/include/crtdefs.h:45:1: error: '__MINGW_EXTENSION' does not name a type
__MINGW_EXTENSION typedef __int64 ssize_t;
^
C:/TDM-GCC-64/x86_64-w64-mingw32/include/crtdefs.h:52:9: error: 'size_t' does not name a type
typedef size_t rsize_t;
^
C:/TDM-GCC-64/x86_64-w64-mingw32/include/crtdefs.h:62:1: error: '__MINGW_EXTENSION' does not name a type
__MINGW_EXTENSION typedef __int64 intptr_t;
^
C:/TDM-GCC-64/x86_64-w64-mingw32/include/crtdefs.h:75:1: error: '__MINGW_EXTENSION' does not name a type
__MINGW_EXTENSION typedef unsigned __int64 uintptr_t;
^
C:/TDM-GCC-64/x86_64-w64-mingw32/include/crtdefs.h:88:1: error: '__MINGW_EXTENSION' does not name a type
__MINGW_EXTENSION typedef __int64 ptrdiff_t;
^
C:/TDM-GCC-64/x86_64-w64-mingw32/include/crtdefs.h:123:1: error: '__MINGW_EXTENSION' does not name a type
__MINGW_EXTENSION typedef __int64 __time64_t;
^
C:/TDM-GCC-64/x86_64-w64-mingw32/include/crtdefs.h:138:9: error: '__time64_t' does not name a type
typedef __time64_t time_t;
^
In file included from C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/stddef.h:1:0,
from C:\CodeBlocks\MinGW\include/wchar.h:26,
from C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++/cwchar:44,
from C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++/bits/postypes.h:40,
from C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++/iosfwd:40,
from C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++/ios:38,
from C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++/ostream:38,
from C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++/iostream:39,
from D:\test7\main.cpp:1:
C:/TDM-GCC-64/x86_64-w64-mingw32/include/stddef.h:26:18: error: 'uintptr_t' does not name a type
_CRTIMP extern uintptr_t __cdecl __threadhandle(void);
^
In file included from C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++/cwchar:44:0,
from C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++/bits/postypes.h:40,
from C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++/iosfwd:40,
from C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++/ios:38,
from C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++/ostream:38,
from C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++/iostream:39,
from D:\test7\main.cpp:1:
C:\CodeBlocks\MinGW\include/wchar.h:105:59: error: 'size_t' has not been declared
_CRTIMP int __cdecl __MINGW_NOTHROW _snwprintf (wchar_t*, size_t, const wchar_t*, ...);
^
C:\CodeBlocks\MinGW\include/wchar.h:108:60: error: 'size_t' has not been declared
_CRTIMP int __cdecl __MINGW_NOTHROW _vsnwprintf (wchar_t*, size_t, const wchar_t*, __VALIST);
^
C:\CodeBlocks\MinGW\include/wchar.h:146:50: error: 'size_t' has not been declared
int __cdecl __MINGW_NOTHROW snwprintf (wchar_t*, size_t, const wchar_t*, ...);
^
C:\CodeBlocks\MinGW\include/wchar.h:147:51: error: 'size_t' has not been declared
int __cdecl __MINGW_NOTHROW vsnwprintf (wchar_t*, size_t, const wchar_t*, __VALIST);
^
C:\CodeBlocks\MinGW\include/wchar.h:178:80: error: 'size_t' has not been declared
_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW _wfullpath (wchar_t*, const wchar_t*, size_t);
^
C:\CodeBlocks\MinGW\include/wchar.h:207:9: error: 'size_t' does not name a type
_CRTIMP size_t __cdecl __MINGW_NOTHROW wcsftime (wchar_t*, size_t, const wchar_t*, const struct tm*);
^
C:\CodeBlocks\MinGW\include/wchar.h:222:9: error: 'size_t' does not name a type
_CRTIMP size_t __cdecl __MINGW_NOTHROW wcscspn (const wchar_t*, const wchar_t*);
^
C:\CodeBlocks\MinGW\include/wchar.h:224:9: error: 'size_t' does not name a type
_CRTIMP size_t __cdecl __MINGW_NOTHROW wcslen (const wchar_t*);
^
C:\CodeBlocks\MinGW\include/wchar.h:225:77: error: 'size_t' has not been declared
_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcsncat (wchar_t*, const wchar_t*, size_t);
^
C:\CodeBlocks\MinGW\include/wchar.h:226:77: error: 'size_t' has not been declared
_CRTIMP int __cdecl __MINGW_NOTHROW wcsncmp(const wchar_t*, const wchar_t*, size_t);
^
C:\CodeBlocks\MinGW\include/wchar.h:227:76: error: 'size_t' has not been declared
_CRTIMP wchar_t* __cdecl __MINGW_NOTHROW wcsncpy(wchar_t*, const wchar_t*, size_t);
^
C:\CodeBlocks\MinGW\include/wchar.h:230:9: error: 'size_t' does not name a type
_CRTIMP size_t __cdecl __MINGW_NOTHROW wcsspn(const wchar_t*, const wchar_t*);
^
C:\CodeBlocks\MinGW\include/wchar.h:233:9: error: 'size_t' does not name a type
_CRTIMP size_t __cdecl __MINGW_NOTHROW wcsxfrm(wchar_t*, const wchar_t*, size_t);
^
C:\CodeBlocks\MinGW\include/wchar.h:298:1: error: 'size_t' does not name a type
size_t __cdecl __MINGW_NOTHROW mbrlen(const char * __restrict__, size_t,
^
C:\CodeBlocks\MinGW\include/wchar.h:300:1: error: 'size_t' does not name a type
size_t __cdecl __MINGW_NOTHROW mbrtowc(wchar_t * __restrict__, const char * __restrict__,
^
C:\CodeBlocks\MinGW\include/wchar.h:302:1: error: 'size_t' does not name a type
size_t __cdecl __MINGW_NOTHROW mbsrtowcs(wchar_t * __restrict__, const char ** __restrict__,
^
C:\CodeBlocks\MinGW\include/wchar.h:304:1: error: 'size_t' does not name a type
size_t __cdecl __MINGW_NOTHROW wcrtomb(char * __restrict__, wchar_t,
^
C:\CodeBlocks\MinGW\include/wchar.h:306:1: error: 'size_t' does not name a type
size_t __cdecl __MINGW_NOTHROW wcsrtombs(char * __restrict__, const wchar_t ** __restrict__,
^
C:\CodeBlocks\MinGW\include/wchar.h:320:62: error: 'size_t' has not been declared
wchar_t* __cdecl __MINGW_NOTHROW wmemset(wchar_t *, wchar_t, size_t);
^
C:\CodeBlocks\MinGW\include/wchar.h:321:67: error: 'size_t' has not been declared
wchar_t* __cdecl __MINGW_NOTHROW wmemchr(const wchar_t*, wchar_t, size_t);
^
C:\CodeBlocks\MinGW\include/wchar.h:322:46: error: 'size_t' has not been declared
int wmemcmp(const wchar_t*, const wchar_t *, size_t);
^
C:\CodeBlocks\MinGW\include/wchar.h:325:5: error: 'size_t' has not been declared
size_t);
^
C:\CodeBlocks\MinGW\include/wchar.h:326:73: error: 'size_t' has not been declared
wchar_t* __cdecl __MINGW_NOTHROW wmemmove(wchar_t* s1, const wchar_t *, size_t);
^
In file included from C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++/bits/postypes.h:40:0,
from C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++/iosfwd:40,
from C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++/ios:38,
from C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++/ostream:38,
from C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++/iostream:39,
from D:\test7\main.cpp:1:
C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++/cwchar:151:11: error: '::mbrlen' has not been declared
using ::mbrlen;
^
C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++/cwchar:152:11: error: '::mbrtowc' has not been declared
using ::mbrtowc;
^
C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++/cwchar:154:11: error: '::mbsrtowcs' has not been declared
using ::mbsrtowcs;
^
C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++/cwchar:158:11: error: '::swprintf' has not been declared
using ::swprintf;
^
C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++/cwchar:167:11: error: '::vswprintf' has not been declared
using ::vswprintf;
^
C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++/cwchar:176:11: error: '::wcrtomb' has not been declared
using ::wcrtomb;
^
C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++/cwchar:181:11: error: '::wcscspn' has not been declared
using ::wcscspn;
^
C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++/cwchar:182:11: error: '::wcsftime' has not been declared
using ::wcsftime;
^
C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++/cwchar:183:11: error: '::wcslen' has not been declared
using ::wcslen;
^
C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++/cwchar:187:11: error: '::wcsrtombs' has not been declared
using ::wcsrtombs;
^
C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++/cwchar:188:11: error: '::wcsspn' has not been declared
using ::wcsspn;
^
C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++/cwchar:196:11: error: '::wcsxfrm' has not been declared
using ::wcsxfrm;
^
In file included from C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++/ios:40:0,
from C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++/ostream:38,
from C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++/iostream:39,
from D:\test7\main.cpp:1:
C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++/bits/char_traits.h: In static member function 'static std::size_t std::char_traits<wchar_t>::length(const char_type*)':
C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++/bits/char_traits.h:334:26: error: 'wcslen' was not declared in this scope
{ return wcslen(__s); }
^
In file included from C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++/bits/char_traits.h:380:0,
from C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++/ios:40,
from C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++/ostream:38,
from C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++/iostream:39,
from D:\test7\main.cpp:1:
C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++/cstdint: At global scope:
C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++/cstdint:64:11: error: '::intptr_t' has not been declared
using ::intptr_t;
^
C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++/cstdint:82:11: error: '::uintptr_t' has not been declared
using ::uintptr_t;
^
In file included from C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++/bits/localefwd.h:42:0,
from C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++/ios:41,
from C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++/ostream:38,
from C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++/iostream:39,
from D:\test7\main.cpp:1:
C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++/cctype:87:11: error: '::isblank' has not been declared
using ::isblank;
^
In file included from C:\CodeBlocks\MinGW\include/pthread.h:66:0,
from C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++/x86_64-w64-mingw32/bits/gthr-default.h:34,
from C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++/x86_64-w64-mingw32/bits/gthr.h:148,
from C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++/ext/atomicity.h:35,
from C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++/bits/ios_base.h:39,
from C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++/ios:42,
from C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++/ostream:38,
from C:/TDM-GCC-64/lib/gcc/x86_64-w64-mingw32/5.1.0/include/c++/iostream:39,
from D:\test7\main.cpp:1:
C:\CodeBlocks\MinGW\include/process.h:64:9: error: 'intptr_t' does not name a type
_CRTIMP intptr_t __cdecl __MINGW_NOTHROW _execl (const char*, const char*, ...);
^
C:\CodeBlocks\MinGW\include/process.h:65:9: error: 'intptr_t' does not name a type
Process terminated with status 1 (0 minute(s), 1 second(s))
50 error(s), 0 warning(s) (0 minute(s), 1 second(s))
Stop mixing the compiler includes!
Edit3: This means you should *not* use headers from the 32 bit mingw gcc when building 64 bit mingw gcc programs.
-IC:\CodeBlocks\MinGW\include
The above is very wrong!
Edit: Learn to use code tags!
Edit2: These may also be wrong!
-IC:\GnuWin32\include -IC:\Eigen -Ic:\boost
Tim S.
I forgot all about the compiler includes that would have been copied over when I copied the default compiler as step 1 in associating with a new compiler.
A stupid mistake on my part, but sometimes those are the hardest to solve.
Thanks for your help.
And, just a suggestion for those who write the CodeBlocks guides, you might want to include a warning about this in future version.