使用 Qt Creator 构建 Stanford CS106B 项目的问题

Problems building Stanford CS106B projects with Qt Creator

我正在尝试使用他们的免费在线资源学习斯坦福 CS106B 课程(我不是斯坦福学生)。由于他们现在需要登录 ID 才能访问当前季度主页上的许多页面,因此我使用的是 2015 年第一季度的存档页面,位于此处:

http://stanford.edu/class/archive/cs/cs106b/cs106b.1154/

我看到其他人在构建作业项目时遇到了一些类似的问题,但他们都在使用其他 IDE and/or OS,而且他们都是收到不同的错误消息。

我首先尝试了 Qt Creator 5.5,但当出现错误时,我将其卸载并安装了 Qt Creator 5.4.1。这是存档的旧页面上推荐的版本,所以我认为同一页面上的作业与此版本兼容。我已经在机器 运行ning Windows 8.1 和另一台 运行ning Windows Vista 上试过了。无论我使用哪个版本的 Qt Creator 或 Windows,每次我尝试构建 Stanford 的作业或示例项目时,我都会在 Qt Creator window 的问题 window 中收到以下消息:

    cannot find -liberty

    error: Id returned 1 exit status
    collect2.exe

编译输出 window 显示以下错误:

    I:/Program Files/Qt Creator/Tools/mingw492_32/bin/../lib/gcc/i686-w64-mingw32/4.9.2/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -liberty
    collect2.exe: error: ld returned 1 exit status
    Makefile.Debug:247: recipe for target 'debug\simple-project.exe' failed
    mingw32-make[1]: *** [debug\simple-project.exe] Error 1
    mingw32-make[1]: Leaving directory 'I:/Moved from Drive 1/Documents/QT Creator projects/build-simple-project-Desktop_Qt_5_5_0_MinGW_32bit-Debug'
    makefile:34: recipe for target 'debug' failed
    mingw32-make: *** [debug] Error 2
    09:42:28: The process "I:\Program Files\Qt Creator\Tools\mingw492_32\bin\mingw32-make.exe" exited with code 2.
    Error while building/deploying project simple-project (kit: Desktop Qt 5.5.0 MinGW 32bit)
    When executing step "Make"

我还应该注意,我下载了 Qt Creator 中提供的示例项目,我能够构建 运行 这个项目。只有斯坦福项目给我错误。

我是 C++ 和 Qt Creator 的新手,所以可能有一些简单的事情我没能做到。如果有任何帮助,我将不胜感激。

修改 .pro 文件,使其不再尝试 link "liberty" 库。

在 simple-project.pro 文件的第 107 行有对 "liberty" 库的引用。我将其注释掉并编译了示例简单项目。

LIBS += -lDbghelp
LIBS += -lbfd
LIBS += -liberty <-place "#" in front of this line
LIBS += -limagehlp