You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

64位可执行程序编译报错求助:cc1plus.exe不支持64位模式

Fixing "cc1plus.exe: sorry, unimplemented: 64-bit mode not compiled in" in CodeBlocks

Hey there! I totally get how confusing this can be when you're starting out with C++ and compiler settings. Let's break down what's going on and how to fix it:

Why this error happens

The CodeBlocks version you're using probably comes with a 32-bit-only MinGW compiler pre-installed. Even though your Windows 10 system is 64-bit, the compiler itself doesn't have the code to generate 64-bit executables—so when you try to use the -m64 flag (or tick the 64-bit option in CodeBlocks), it throws that error. Without the flag, it defaults to 32-bit, which is why your code compiles fine.

Step-by-step fix

1. Install a 64-bit-capable MinGW-w64 compiler

You'll need to replace the default 32-bit MinGW with a MinGW-w64 build that supports 64-bit compilation. Look for official MinGW-w64 pre-built packages (make sure to pick the x86_64 architecture version—this targets 64-bit systems). When choosing, you can go with:

  • Thread model: posix (better for C++11+ thread support) or win32 (works well for most standard Windows apps)
  • Exception model: seh (recommended for 64-bit Windows, it's more efficient)

Extract the downloaded package to a folder on your system (like C:\mingw-w64—avoid spaces in the path to prevent unexpected issues).

2. Configure CodeBlocks to use the new compiler

Open CodeBlocks and follow these steps:

  • Go to Settings > Compiler
  • Switch to the Toolchain executables tab
  • Click the ... button next to "Compiler's installation directory" and select the mingw64 folder inside your MinGW-w64 installation (e.g., C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64)
  • Double-check the executable paths below (C Compiler should be gcc.exe, C++ Compiler should be g++.exe, etc.—they should auto-update if you picked the right directory)
  • Click OK to save the settings

3. Test the 64-bit compilation

Create a quick test program to verify everything works:

#include <iostream>
int main() {
    std::cout << "Size of pointer: " << sizeof(void*) << " bytes\n";
    return 0;
}
  • Tick the 64-bit option in CodeBlocks (the one you tried before)
  • Compile and run the program. If it outputs Size of pointer: 8 bytes, you're successfully compiling 64-bit executables!

Quick notes

  • Uninstall or remove the old 32-bit MinGW from your system if you can—this avoids path conflicts.
  • If you run into issues finding pre-built MinGW-w64 packages, you can also use MSYS2 to install it (just search for mingw-w64-x86_64-gcc in the MSYS2 package manager).

内容的提问来源于stack exchange,提问作者JohnDoe122

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.11 08:09:59