makefile undefined reference error -


i'm having trouble compiling project coding files wordbench2.h, wordbench2.cpp, makefile.wb2, oaa_bst.h main file given (main_wb2.cpp) wondering if sees wrong in makefile

lib     = /home/courses/cop4530p/lib cpp     = $(lib)/cpp tcpp    = $(lib)/tcpp proj    = . incpath = -i$(proj)-i$(cpp)-i$(tcpp) cc      = g++ -std=c++11 -wall -wextra -i. -i$(cpp)  #target: all: wb2.x foaa.x moaa.x #foaa+.x  main_wb2.o: wordbench2.h main_wb2.cpp         $(cc) -c main_wb2.cpp  foaa.o: wordbench2.h foaa.cpp         $(cc) -c foaa.cpp  moaa.o: wordbench2.h moaa.cpp         $(cc) -c moaa.cpp  wordbench2.o: wordbench2.h wordbench2.cpp wordify.cpp         $(cc) -c wordbench2.cpp  xstring.o: $(cpp)/xstring.h $(cpp)/xstring.cpp         $(cc) $(incpath) -c $(cpp)/xstring.cpp  wb2.x: main_wb2.o wordbench2.o xstring.o         $(cc) -o wb2.x main_wb2.o  foaa.x: foaa.o wordbench2.o xstring.o         $(cc) -o foaa.x foaa.o  moaa.x: moaa.o wordbench2.o xstring.o         $(cc) -o moaa.x moaa.o 

error

g++ -std=c++11 -wall -wextra -i. -i/home/courses/cop4530p/lib/cpp -o wb2.x main_wb2.o                    main_wb2.o: in function `main': main_wb2.cpp:(.text+0xfd): undefined reference `wordbench::wordbench()' main_wb2.cpp:(.text+0x109): undefined reference `fsu::string::string()' main_wb2.cpp:(.text+0x115): undefined reference `fsu::string::string()' main_wb2.cpp:(.text+0x1ad): undefined reference `fsu::operator>>(std::istream&, fsu::string&)' main_wb2.cpp:(.text+0x1c4): undefined reference `fsu::operator<<(std::ostream&, fsu::string const&)' main_wb2.cpp:(.text+0x1f1): undefined reference `fsu::operator<<(std::ostream&, fsu::string const&)' main_wb2.cpp:(.text+0x21e): undefined reference `fsu::operator>>(std::istream&, fsu::string&)' main_wb2.cpp:(.text+0x235): undefined reference `fsu::operator<<(std::ostream&, fsu::string const&)' main_wb2.cpp:(.text+0x25d): undefined reference `wordbench::readtext(fsu::string const&, bool)' main_wb2.cpp:(.text+0x28f): undefined reference `fsu::operator>>(std::istream&, fsu::string&)' main_wb2.cpp:(.text+0x2a6): undefined reference `fsu::operator<<(std::ostream&, fsu::string const&)' main_wb2.cpp:(.text+0x2d3): undefined reference `fsu::operator<<(std::ostream&, fsu::string const&)' main_wb2.cpp:(.text+0x300): undefined reference `fsu::operator>>(std::istream&, fsu::string&)' main_wb2.cpp:(.text+0x317): undefined reference `fsu::operator<<(std::ostream&, fsu::string const&)' main_wb2.cpp:(.text+0x33f): undefined reference `wordbench::readtext(fsu::string const&, bool)' main_wb2.cpp:(.text+0x371): undefined reference `fsu::operator>>(std::istream&, fsu::string&)' main_wb2.cpp:(.text+0x388): undefined reference `fsu::operator<<(std::ostream&, fsu::string const&)' main_wb2.cpp:(.text+0x3b5): undefined reference `fsu::operator<<(std::ostream&, fsu::string const&)' main_wb2.cpp:(.text+0x3e2): undefined reference `fsu::operator>>(std::istream&, fsu::string&)' main_wb2.cpp:(.text+0x3f9): undefined reference `fsu::operator<<(std::ostream&, fsu::string const&)' main_wb2.cpp:(.text+0x42f): undefined reference `wordbench::writereport(fsu::string const&, unsigned short, unsigned short, std::_ios_fmtflags, std::_ios_fmtflags) const' main_wb2.cpp:(.text+0x44d): undefined reference `fsu::string::operator=(fsu::string const&)' main_wb2.cpp:(.text+0x45e): undefined reference `fsu::string::size() const' main_wb2.cpp:(.text+0x488): undefined reference `fsu::string::cstr() const' main_wb2.cpp:(.text+0x4d9): undefined reference `fsu::operator<<(std::ostream&, fsu::string const&)' main_wb2.cpp:(.text+0x572): undefined reference `wordbench::cleardata()' main_wb2.cpp:(.text+0x595): undefined reference `wordbench::showsummary() const' main_wb2.cpp:(.text+0x67a): undefined reference `fsu::string::~string()' main_wb2.cpp:(.text+0x686): undefined reference `fsu::string::~string()' main_wb2.cpp:(.text+0x695): undefined reference `wordbench::~wordbench()' main_wb2.cpp:(.text+0x6cb): undefined reference `fsu::string::~string()' main_wb2.cpp:(.text+0x6dc): undefined reference `fsu::string::~string()' main_wb2.cpp:(.text+0x6f0): undefined reference `wordbench::~wordbench()' collect2: error: ld returned 1 exit status make: *** [wb2.x] error 1 

in rule:

wb2.x: main_wb2.o wordbench2.o xstring.o         $(cc) -o wb2.x main_wb2.o 

you list wordbench2.o , xstring.o in prerequisites list, didn't put them onto compile line.

why rewriting same things on , over? leads silly errors this. use automatic variables avoid retyping , getting things wrong:

wb2.x: main_wb2.o wordbench2.o xstring.o         $(cc) -o $@ $^ 

ditto other linker rules.


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -