所以我仍然试图让我的破解graphics.h
lib工作。我非常接近修复所有奇怪的错误。
我已正确安装了一切。
我对未定义的错误有很多麻烦:
-------------- Build: Debug in LEVEL EDITORRRR (compiler: GNU GCC Compiler)---------------
mingw32-g++.exe -Wall -fexceptions -g -c "C:\Users\Moustachespy\Documents\LEVEL EDITORRRR\main.cpp" -o obj\Debug\main.o
mingw32-g++.exe -o "bin\Debug\LEVEL EDITORRRR.exe" obj\Debug\main.o "C:\Program Files (x86)\CodeBlocks\MinGW\lib\libbgi.a"
C:\Program Files (x86)\CodeBlocks\MinGW\lib\libbgi.a(winbgi.o):winbgi.cxx:(.text+0x133): undefined reference to `GetStockObject@4'
C:\Program Files (x86)\CodeBlocks\MinGW\lib\libbgi.a(winbgi.o):winbgi.cxx:(.text+0x28e): undefined reference to `GetStockObject@4'
C:\Program Files (x86)\CodeBlocks\MinGW\lib\libbgi.a(winbgi.o):winbgi.cxx:(.text+0x478): undefined reference to `GetStockObject@4'
C:\Program Files (x86)\CodeBlocks\MinGW\lib\libbgi.a(winbgi.o):winbgi.cxx:(.text+0x48e): undefined reference to `SelectObject@8'
C:\Program Files (x86)\CodeBlocks\MinGW\lib\libbgi.a(winbgi.o):winbgi.cxx:(.text+0x499): undefined reference to `DeleteObject@4'
C:\Program Files (x86)\CodeBlocks\MinGW\lib\libbgi.a(winbgi.o):winbgi.cxx:(.text+0x4a8): undefined reference to `GetStockObject@4'
C:\Program Files (x86)\CodeBlocks\MinGW\lib\libbgi.a(winbgi.o):winbgi.cxx:(.text+0x4be): undefined reference to `SelectObject@8'
C:\Program Files (x86)\CodeBlocks\MinGW\lib\libbgi.a(winbgi.o):winbgi.cxx:(.text+0x4c9): undefined reference to `DeleteObject@4'
C:\Program Files (x86)\CodeBlocks\MinGW\lib\libbgi.a(winbgi.o):winbgi.cxx:(.text+0x4ec): undefined reference to `SetTextColor@8'
C:\Program Files (x86)\CodeBlocks\MinGW\lib\libbgi.a(winbgi.o):winbgi.cxx:(.text+0x1875): undefined reference to `GetStockObject@4'
C:/Program Files (x86)/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/4.9.2/../../../../mingw32/bin/ld.exe: C:\Program Files (x86)\CodeBlocks\MinGW\lib\libbgi.a(winbgi.o): bad reloc address 0x0 in section `.data'
C:/Program Files (x86)/CodeBlocks/MinGW/bin/../lib/gcc/mingw32/4.9.2/../../../../mingw32/bin/ld.exe: final link failed: Invalid operation
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 11 second(s))
11 error(s), 0 warning(s) (0 minute(s), 11 second(s))
我该怎么办? 谷歌不会帮助我。 如果您还有其他需要,请告诉我,我会提供:D
我的代码:
#include <iostream>
#include <graphics.h>
using namespace std;
int main()
{
cout << "Hello world!" << endl;
initwindow(1000,1000);
return 0;
}
答案 0 :(得分:0)
您似乎没有链接到gdi32库,但是您要包含标题。
编辑: 我不知道Codeblocks是如何工作的。您的教练是否强迫您使用该编译器,因为您可以在https://www.visualstudio.com/downloads/download-visual-studio-vs免费下载和使用Microsoft Visual Studio 2015,它是一个更好的编译器,并在您的调试信息中提供更多详细信息。除了无法访问您的控制台程序设置和非常稀疏的调试信息之外,我唯一可以说的是确认您在入口点源文件中包含Windows.h并且如果您不限制使用哪个编译器去VS 2015它是使用c ++ V14的最新Visual Studio,将更加用户友好祝你好运..
答案 1 :(得分:0)
实际上你的程序适用于windows gui 32.你应该选择windows gui 32模板而不是控制台应用程序。