Connect everything that could connect

#include "mainwindow.h" #include "ui_mainwindow.h" // тут библиотеки СИ языка #include <iostream> // для оператора cout #include <cmath> // библ отвеч за квадрат в СИ //-------------------- #include <iostream> #include <cassert> #include <math.h> // библ отвеч за квадрат в СИ #include <cstring> // библиотека отвечающая за подчет символов строки (char* str) и перевода их (int) //#include "math.h" #include <stdio.h> #include <QtGui/QApplication> #include <QTextCodec> #include <QFile> #include <QDebug> #include <QDateTimeEdit> #include <QDateTime> #include <QToolBar> #include <QFont> #include <QLocale> #include <QDebug> #include <QDir> #include <wchar.h> #include <windows.h> //-------------------- #include <boost/filesystem/config.hpp> #include <boost/filesystem/convenience.hpp> #include <boost/filesystem/detail/utf8_codecvt_facet.hpp> #include <boost/filesystem/exception.hpp> #include <boost/filesystem/fstream.hpp> #include <boost/filesystem/operations.hpp> #include <boost/filesystem/path.hpp> #include <boost/filesystem/path_traits.hpp> #include <boost/filesystem/string_file.hpp> #include <boost/filesystem.hpp> MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { ui->setupUi(this); qDebug() << "1"; boost::filesystem::path p1 = "notpresent/dirtest"; boost::system::error_code ec; boost::filesystem::create_directory(p1, ec); } MainWindow::~MainWindow() { delete ui; } 

In the .pro file, set the bools library

  #------------------------------------------------- # # Project created by QtCreator 2016-09-12T17:30:01 # #------------------------------------------------- QT += core gui greaterThan(QT_MAJOR_VERSION, 4): QT += widgets TARGET = sohran_wpapku TEMPLATE = app #------------------------------------------------- INCLUDEPATH += C:/Qt/boost_1_61_0 LIBS += -L"C:/Qt/boost_1_61_0/bin.v2/libs/system/build/msvc-10.0/release/link-static/threading-multi" -llibboost_system-vc100-mt-1_61 LIBS += -L"C:/Qt/boost_1_61_0/stage/lib" \ -llibboost_filesystem-vc100-mt-1_61 \ -llibboost_filesystem-vc100-mt-gd-1_61 #------------------------------------------------- SOURCES += main.cpp\ mainwindow.cpp HEADERS += mainwindow.h FORMS += mainwindow.ui 

It produces errors

mainwindow.obj: -1: error: LNK2019: unresolved external symbol "void __cdecl boost :: filesystem :: path_traits :: convert (char const *, char const *, class std :: basic_string, class std :: allocator> &, class std :: codecvt const &) "(? convert @ path_traits @ filesystem @ boost @@ YAXPBD0AAV? $ basic_string @ GU? $ char_traits @ G @ std @@ V? $ allocator @ G @ 2 @@ std @@ ABV? $ codecvt @ GDH @ 5 @@ Z) referenced in function "void __cdecl boost :: filesystem :: path_traits :: convert (char const *, char const *, class std :: basic_string, class std :: allocator> &)" (? convert @ path_traits @ filesystem @ boost @@ YAXPBD0AAV? $ basic_string @ GU? $ char_traits @ G @ std @@ V? $ allocator @ G @ 2 @@ std @@@ Z)

mainwindow.obj: -1: error: LNK2019: unresolved external symbol "public: static class std :: codecvt const & __cdecl boost :: filesystem :: path :: codecvt (void)" (? codecvt @ path @ filesystem @ boost @ @SAABV? $ Codecvt @ GDH @ std @@ XZ) referenced in function "void __cdecl boost :: filesystem :: path_traits :: convert (char const *, char const *, class std :: basic_string, class std :: allocator> &) "(? convert @ path_traits @ filesystem @ boost @@ YAXPBD0AAV? $ basic_string @ GU? $ char_traits @ G @ std @@ V? $ allocator @ G @ 2 @@ std @@@ Z)

release \ sohran_wpapku.exe: -1: error: LNK1120: 2 unresolved externals

When the boots libraries are connected, they are highlighted and variants of the full name are offered. I installed the boost library by the method proposed on this site http://evilcoderr.blogspot.ru/2013/01/boost-c-vs-2010.html . When connecting the bustovsky libraries and following compilation without using the code of functions of the bustovsky libraries, everything works fine (O_o) /. What am I doing wrong ????

1 answer 1

  • Are you sure Qt is also MSVC 2010?
  • Trying to connect the boost, which is assembled in mt, and Qt is most likely in md, because of - this can also be a problem.
  • After all the manipulations with the pro-file, did qmake run?
  • If you do not use the library code boost, then the lib will not connect, although they are specified in the pro-file, therefore there are no compilation errors.
  • Most likely, everything that you want from boost can be done using Qt