0
votes

I'm trying to take the Stanford CS106B course using their free online resources (I'm not a Stanford student). Since they now require a login ID to access many pages on the current quarter's homepage, I am using the archived page from the first quarter 2015, located here:

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

I've seen a few similar questions from others who were having trouble building the assignment projects, but they were all using other IDE and/or OS, and they were all getting different error messages.

I first tried Qt Creator 5.5 but when I got errors, I uninstalled it and installed Qt Creator 5.4.1. This is the version recommended on the archived older page so I figured the assignments on that same page would be compatible with this version. I've tried it on a machine running Windows 8.1 and another running Windows Vista. No matter which version of Qt Creator or Windows I'm using, every time I try to build one of Stanford's assignments or sample projects I get the following messages in the Issues window of Qt Creator:

    cannot find -liberty

    error: Id returned 1 exit status
    collect2.exe

The Compile Output window shows the following errors:

    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"

I should also note that I downloaded a sample project that was offered within Qt Creator, and I was able to build and run this one. It's only the Stanford projects that give me the errors.

I'm new to C++ and to Qt Creator so there is probably something simple that I'm failing to do. I'd appreciate any help.

1
The error message tells you exactly what the problem is, the linker cannot find the iberty library (whatever that is). Is it installed? - cmannett85
Each assignment includes the Stanford CSS Libraries (also located here: stanford.edu/~stepp/cppdoc ). These are supposed to be all the libraries we need for the assignment. There are a number of libraries in this folder but none of them match the error message. I haven't found any reference to this library anywhere in the course materials or the Stanford website, either. - treeline

1 Answers

1
votes

Modify the .pro file so that it no longer tries to link the "liberty" library.

In the simple-project.pro file on line 107 there is a reference to the "liberty" library. I commented that out and the the example simple-project compiles.

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