0

我有添加graphics.hwinbgim.h库,还有libbgi.aMinGW。它们都可以在这里找到。存档有文件夹,这些文件夹指示它们应该放在的目录/MinGW。我还添加-lbgi -lgdi32 -lcomdlg32 -luuid -loleaut32 -lole32了额外的链接选项,如以下链接中所述:http: //www.infobits.ro/medii-mingw-developer-studio3.php。(对不起,它是罗马尼亚语,但图像很容易理解)。
当我尝试运行以下代码时:

#include <graphics.h>
#include <iostream>

using namespace std;

int main() {
    int gdriver = DETECT, gmode;
    initgraph(&gdriver, &gmode, "");
    if (graphresult()) {
        cout<<"Tentativa nereusita ...";
    }
    else {
        cout<<"Everything is working!";
        setcolor(RED);
        moveto(0,0);
        lineto(getmaxx(),getmaxy());
    }
    cout<<endl<<"Press anything to close";
    getch();
    return 0;
}

我收到带有“未定义参考错误”的错误日志。错误日志是:

C:\OJI\MinGWStudio\MinGW\bin\..\lib\gcc-lib\mingw32\3.3.1\..\..\..\libbgi.a(winbgi.o)(.text+0xbd2):winbgi.cxx: undefined reference to `std::string::_Rep::_S_empty_rep_storage'
C:\OJI\MinGWStudio\MinGW\bin\..\lib\gcc-lib\mingw32\3.3.1\..\..\..\libbgi.a(winbgi.o)(.text+0x1b5e):winbgi.cxx: undefined reference to `std::string::_Rep::_S_empty_rep_storage'
C:\OJI\MinGWStudio\MinGW\bin\..\lib\gcc-lib\mingw32\3.3.1\..\..\..\libbgi.a(winbgi.o)(.text+0x1dcc):winbgi.cxx: undefined reference to `__gnu_cxx::__exchange_and_add(int volatile*, int)'
C:\OJI\MinGWStudio\MinGW\bin\..\lib\gcc-lib\mingw32\3.3.1\..\..\..\libbgi.a(winthread.o)(.text+0x522):winthread.cxx: undefined reference to `std::string::_Rep::_S_empty_rep_storage'
C:\OJI\MinGWStudio\MinGW\bin\..\lib\gcc-lib\mingw32\3.3.1\..\..\..\libbgi.a(winthread.o)(.text+0x57e):winthread.cxx: undefined reference to `__gnu_cxx::__exchange_and_add(int volatile*, int)'

任何想法?

4

0 回答 0