Skip to content

Latest commit

 

History

History
140 lines (77 loc) · 4.64 KB

File metadata and controls

140 lines (77 loc) · 4.64 KB

 

 

 

 

 

 

link error.

 

 

 

 

 

Full error message

 


/home/richel/qtsdk-2010.04/bin/Projects/Website/CppFile-build-desktop/main.o:: In function `boost::filesystem::basic_path<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::filesystem::path_traits> boost::filesystem::current_path<boost::filesystem::basic_path<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, boost::filesystem::path_traits> >()': /usr/include/boost/filesystem/operations.hpp:530: error: undefined reference to `boost::filesystem::detail::get_current_path_api(std::basic_string<char, std::char_traits<char>, std::allocator<char> >&)' :: error: collect2: ld returned 1 exit status

 

 

 

 

 

Cause

 

Operating system: Ubuntu 10.04 LTS Lucid Lynx

IDE: Qt Creator 2.0.0

Project type: Console Application

Compiler: G++ 4.4.1

Libraries used:

  • Boost: version 1.40
  • Qt: version 4.7.0 (32 bit)

 

 

 

 

 

 


#------------------------------------------------- # # Project created by QtCreator 2010-08-02T13:45:48 # #------------------------------------------------- QT += core QT -= gui TARGET = MyTarget CONFIG += console CONFIG -= app_bundle TEMPLATE = app LIBS += -L/usr/local/lib -lboost_system SOURCES += main.cpp

 

 

 

 

 

Source code

 

 


#include <boost/filesystem.hpp> int main() {   boost::filesystem::path my_path(     boost::filesystem::initial_path<boost::filesystem::path>()); }

 

 

 

 

 

Solution

 

Add the following line to the Qt project file:

 


LIBS += -L/usr/local/lib -lboost_filesystem