Eclipse 没有在 Windows (C++) 中编译.exe

Eclipse is not compiling an .exe in Windows (C++)

本文关键字:编译 exe C++ Windows Eclipse      更新时间:2023-10-16

我对此做了很多研究,但我无法弄清楚。我所在的团队都编写了各自的代码,现在,我们的一名团队成员正在努力将所有代码编译为一个文件。我的代码不允许他编译.exe。我遇到了同样的问题。这一切都在代码::块中对我有用;但是,我们正在使用 Eclipse。我们使用MinGW作为编译器,我将PE64 Windows解析器设置为二进制解析器。

我已经用 C++17 文件系统库替换了 Boost 文件系统库,不幸的是,结果是一样的。在我的故障排除过程中,我创建了一个hello,world程序,其中包含我正在使用的所有库。在这种情况下,未创建可执行文件。然后我删除了我正在使用的所有库。在该实例中,创建了一个可执行文件。我怀疑在某些方面找不到libcurl-x64.dll,这就是不会构建可执行文件的原因。我已经在包含文件夹中查找了重复的文件名。没有一个存在。我的构建日志如下:

19:34:27 **** Rebuild of configuration Debug for project Ethical-Hacking-with-Computer-Viruses-Using-C++ ****
Info: Internal Builder is used for build
g++ -std=c++17 "-IC:\libraries5\xlnt-master\include" "-IC:\libraries5\curl-7.70.0-win64-mingw\include" -O2 -g3 -Wall -c -fmessage-length=0 -o main.o "..\main.cpp" 
g++ "-LC:\thirdparty" -static -l -o Ethical-Hacking-with-Computer-Viruses-Using-C++.exe main.o 
g++: error: Ethical-Hacking-with-Computer-Viruses-Using-C++.exe: No such file or directory
19:34:29 Build Finished. 0 errors, 0 warnings. (took 2s.26ms)

我将非常感谢在创建可执行文件方面的任何帮助。谢谢。

编辑:按照朱利安的要求,我已经上传了我的制作文件。

https://www.dropbox.com/s/3c11vnccjah3frx/makefile?dl=0

使用 GNU Make 时,我在 Eclipse 中的完整构建日志是:

21:09:58 **** Build of configuration Debug for project Ethical-Hacking-with-Computer-Viruses-Using-C++ ****
make all 
Building file: ../main.cpp
Invoking: GCC C++ Compiler
g++ -std=c++17 -I"C:libraries5xlnt-masterinclude" -I"C:libraries5curl-7.70.0-win64-mingwinclude" -O2 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"main.d" -MT"main.o" -o "main.o" "../main.cpp"
Finished building: ../main.cpp

Building target: Ethical-Hacking-with-Computer-Viruses-Using-C++.exe
Invoking: MinGW C++ Linker
g++ -L"C:thirdparty" -static -l -o "Ethical-Hacking-with-Computer-Viruses-Using-C++.exe"  ./main.o   
g++.exe: error: Ethical-Hacking-with-Computer-Viruses-Using-C++.exe: No such file or directory
makefile:44: recipe for target 'Ethical-Hacking-with-Computer-Viruses-Using-C++.exe' failed
make: *** [Ethical-Hacking-with-Computer-Viruses-Using-C++.exe] Error 1
"make all" terminated with exit code 2. Build might be incomplete.

如果遇到编译问题,还可以使用 WSL 终端。

安装并设置 Linux 终端后,运行以下命令

$sudo apt update
$sudo apt install g++
$sudo apt install gcc

将目录更改为 eclipse 工作目录并运行 g++ 命令。