Ich habe versucht, die Poco-Bibliotheken in meinem Programmierprojekt zu verwenden, aber ich bekomme Verknüpfungsfehler. Meine C++ - Datei hat eine einzige Zeile Code in der Hauptfunktion und sollte gut kompilieren.Poco C++ Verknüpfen Probleme mit Conan Abhängigkeitsmanager, wie würde ich es beheben?
Meine C++ Datei:
/**
* Created by kkprince on 27/06/16.
*/
#include <Poco/AutoPtr.h>
#include <Poco/Util/IniFileConfiguration.h>
using Poco::AutoPtr;
using Poco::Util::IniFileConfiguration;
int main(int argc, char* argv[]){
AutoPtr<IniFileConfiguration> pConf(new IniFileConfiguration("invalid"));
}
Mein CMakeLists:
cmake_minimum_required(VERSION 3.5)
project(village.io-server CXX)
include(conanbuildinfo.cmake)
conan_basic_setup()
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "/home/kkprince/ClionProjects/village.io/build")
set(CMAKE_BINARY_DIR ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR})
find_package(Boost
COMPONENTS program_options system REQUIRED)
set(SOURCE_FILES main.cpp) # src/Runner.cpp src/Runner.h src/workQueue/workQueue.h src/server/Server.cpp src/server/Server.h)
add_executable(village.io-server ${SOURCE_FILES})
TARGET_LINK_LIBRARIES(village.io-server ${Boost_LIBRARIES} ${CONAN_LIBS})
Und mein conanfile.txt:
[requires]
Poco/[email protected]/stable
easyloggingpp/[email protected]/testing
[options]
Poco:shared=False
[generators]
cmake
Mein generiert conaninfo.txt:
[settings]
arch=x86_64
build_type=Release
compiler=gcc
compiler.libcxx=libstdc++
compiler.version=5.3
os=Linux
[requires]
Poco/1.Y.Z
easyloggingpp/9.Y.Z
[options]
[full_settings]
arch=x86_64
build_type=Release
compiler=gcc
compiler.libcxx=libstdc++
compiler.version=5.3
os=Linux
[full_requires]
OpenSSL/[email protected]/stable:c9485444fc54028aa59ea9eb50adf168f08452e3
Poco/[email protected]/stable:cfe3c3d40d613222d431d274eb053831f72a9116
easyloggingpp/[email protected]/testing:5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9
electric-fence/[email protected]/stable:52bcde7d26fabb9754f2f3b850001579b1098686
zlib/[email protected]/stable:52bcde7d26fabb9754f2f3b850001579b1098686
[full_options]
OpenSSL:386=False
OpenSSL:no_asm=False
OpenSSL:no_bf=False
OpenSSL:no_cast=False
OpenSSL:no_des=False
OpenSSL:no_dh=False
OpenSSL:no_dsa=False
OpenSSL:no_electric_fence=False
OpenSSL:no_hmac=False
OpenSSL:no_md2=False
OpenSSL:no_md5=False
OpenSSL:no_mdc2=False
OpenSSL:no_rc2=False
OpenSSL:no_rc4=False
OpenSSL:no_rc5=False
OpenSSL:no_rsa=False
OpenSSL:no_sha=False
OpenSSL:no_sse2=False
OpenSSL:no_threads=False
OpenSSL:no_zlib=False
OpenSSL:shared=False
OpenSSL:zlib_dynamic=False
Poco:enable_apacheconnector=False
Poco:enable_cppparser=False
Poco:enable_crypto=True
Poco:enable_data=True
Poco:enable_data_mysql=False
Poco:enable_data_odbc=False
Poco:enable_data_sqlite=True
Poco:enable_json=True
Poco:enable_mongodb=True
Poco:enable_net=True
Poco:enable_netssl=True
Poco:enable_netssl_win=True
Poco:enable_pagecompiler=False
Poco:enable_pagecompiler_file2page=False
Poco:enable_pdf=False
Poco:enable_pocodoc=False
Poco:enable_sevenzip=False
Poco:enable_tests=False
Poco:enable_util=True
Poco:enable_xml=True
Poco:enable_zip=True
Poco:force_openssl=True
Poco:poco_unbundled=False
Poco:shared=False
electric-fence:shared=False
zlib:shared=False
Jetzt
, ich baue es mit rm -Rfv build conan{b,i}* && conan install . && mkdir build && cd build && cmake .. && cmake --build . -- VERBOSE=1; cd ..
:
removed 'build/Makefile'
removed 'build/CMakeCache.txt'
removed 'build/cmake_install.cmake'
removed 'build/CMakeFiles/Makefile2'
removed directory 'build/CMakeFiles/CMakeTmp'
removed 'build/CMakeFiles/TargetDirectories.txt'
removed 'build/CMakeFiles/CMakeOutput.log'
removed 'build/CMakeFiles/progress.marks'
removed 'build/CMakeFiles/Makefile.cmake'
removed 'build/CMakeFiles/Progress/1'
removed 'build/CMakeFiles/Progress/count.txt'
removed 'build/CMakeFiles/Progress/2'
removed directory 'build/CMakeFiles/Progress'
removed 'build/CMakeFiles/feature_tests.bin'
removed 'build/CMakeFiles/CMakeDirectoryInformation.cmake'
removed 'build/CMakeFiles/cmake.check_cache'
removed 'build/CMakeFiles/feature_tests.cxx'
removed 'build/CMakeFiles/3.5.1/CMakeSystem.cmake'
removed 'build/CMakeFiles/3.5.1/CMakeCXXCompiler.cmake'
removed 'build/CMakeFiles/3.5.1/CMakeDetermineCompilerABI_CXX.bin'
removed 'build/CMakeFiles/3.5.1/CompilerIdCXX/a.out'
removed 'build/CMakeFiles/3.5.1/CompilerIdCXX/CMakeCXXCompilerId.cpp'
removed directory 'build/CMakeFiles/3.5.1/CompilerIdCXX'
removed directory 'build/CMakeFiles/3.5.1'
removed 'build/CMakeFiles/village.io-server.dir/depend.internal'
removed 'build/CMakeFiles/village.io-server.dir/cmake_clean.cmake'
removed 'build/CMakeFiles/village.io-server.dir/CXX.includecache'
removed 'build/CMakeFiles/village.io-server.dir/progress.make'
removed 'build/CMakeFiles/village.io-server.dir/depend.make'
removed 'build/CMakeFiles/village.io-server.dir/link.txt'
removed 'build/CMakeFiles/village.io-server.dir/flags.make'
removed 'build/CMakeFiles/village.io-server.dir/main.cpp.o'
removed 'build/CMakeFiles/village.io-server.dir/build.make'
removed 'build/CMakeFiles/village.io-server.dir/DependInfo.cmake'
removed directory 'build/CMakeFiles/village.io-server.dir'
removed directory 'build/CMakeFiles'
removed directory 'build'
removed 'conanbuildinfo.cmake'
removed 'conaninfo.txt'
Requirements
OpenSSL/[email protected]/stable from conan.io
Poco/[email protected]/stable from conan.io
easyloggingpp/[email protected]/testing from conan.io
electric-fence/[email protected]/stable from conan.io
zlib/[email protected]/stable from conan.io
Packages
OpenSSL/[email protected]/stable:c9485444fc54028aa59ea9eb50adf168f08452e3
Poco/[email protected]/stable:cfe3c3d40d613222d431d274eb053831f72a9116
easyloggingpp/[email protected]/testing:5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9
electric-fence/[email protected]/stable:52bcde7d26fabb9754f2f3b850001579b1098686
zlib/[email protected]/stable:52bcde7d26fabb9754f2f3b850001579b1098686
easyloggingpp/[email protected]/testing: Already installed!
electric-fence/[email protected]/stable: Already installed!
zlib/[email protected]/stable: Already installed!
OpenSSL/[email protected]/stable: Already installed!
Poco/[email protected]/stable: Already installed!
PROJECT: Generated conaninfo.txt
PROJECT: Generated cmake created conanbuildinfo.cmake
-- The CXX compiler identification is GNU 5.3.1
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Current conanbuildinfo.cmake directory: /home/kkprince/ClionProjects/village.io/server
-- Configuring done
-- Generating done
-- Build files have been written to: /home/kkprince/ClionProjects/village.io/server/build
/usr/bin/cmake -H/home/kkprince/ClionProjects/village.io/server -B/home/kkprince/ClionProjects/village.io/server/build --check-build-system CMakeFiles/Makefile.cmake 0
/usr/bin/cmake -E cmake_progress_start /home/kkprince/ClionProjects/village.io/server/build/CMakeFiles /home/kkprince/ClionProjects/village.io/server/build/CMakeFiles/progress.marks
/usr/bin/make -f CMakeFiles/Makefile2 all
make[1]: Entering directory '/home/kkprince/ClionProjects/village.io/server/build'
/usr/bin/make -f CMakeFiles/village.io-server.dir/build.make CMakeFiles/village.io-server.dir/depend
make[2]: Entering directory '/home/kkprince/ClionProjects/village.io/server/build'
cd /home/kkprince/ClionProjects/village.io/server/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/kkprince/ClionProjects/village.io/server /home/kkprince/ClionProjects/village.io/server /home/kkprince/ClionProjects/village.io/server/build /home/kkprince/ClionProjects/village.io/server/build /home/kkprince/ClionProjects/village.io/server/build/CMakeFiles/village.io-server.dir/DependInfo.cmake --color=
Dependee "/home/kkprince/ClionProjects/village.io/server/build/CMakeFiles/village.io-server.dir/DependInfo.cmake" is newer than depender "/home/kkprince/ClionProjects/village.io/server/build/CMakeFiles/village.io-server.dir/depend.internal".
Dependee "/home/kkprince/ClionProjects/village.io/server/build/CMakeFiles/CMakeDirectoryInformation.cmake" is newer than depender "/home/kkprince/ClionProjects/village.io/server/build/CMakeFiles/village.io-server.dir/depend.internal".
Scanning dependencies of target village.io-server
make[2]: Leaving directory '/home/kkprince/ClionProjects/village.io/server/build'
/usr/bin/make -f CMakeFiles/village.io-server.dir/build.make CMakeFiles/village.io-server.dir/build
make[2]: Entering directory '/home/kkprince/ClionProjects/village.io/server/build'
[ 50%] Building CXX object CMakeFiles/village.io-server.dir/main.cpp.o
/usr/bin/c++ -DPOCO_NO_AUTOMATIC_LIBS -DPOCO_STATIC=ON -isystem /home/kkprince/.conan/data/Poco/1.7.3/lasote/stable/package/cfe3c3d40d613222d431d274eb053831f72a9116/include -isystem /home/kkprince/.conan/data/easyloggingpp/9.80/memsharded/testing/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/include -isystem /home/kkprince/.conan/data/OpenSSL/1.0.2g/lasote/stable/package/c9485444fc54028aa59ea9eb50adf168f08452e3/include -isystem /home/kkprince/.conan/data/electric-fence/2.2.0/lasote/stable/package/52bcde7d26fabb9754f2f3b850001579b1098686/include -isystem /home/kkprince/.conan/data/zlib/1.2.8/lasote/stable/package/52bcde7d26fabb9754f2f3b850001579b1098686/include -o CMakeFiles/village.io-server.dir/main.cpp.o -c /home/kkprince/ClionProjects/village.io/server/main.cpp
[100%] Linking CXX executable /home/kkprince/ClionProjects/village.io/build/village.io-server
/usr/bin/cmake -E cmake_link_script CMakeFiles/village.io-server.dir/link.txt --verbose=1
/usr/bin/c++ CMakeFiles/village.io-server.dir/main.cpp.o -o /home/kkprince/ClionProjects/village.io/build/village.io-server -L/home/kkprince/.conan/data/Poco/1.7.3/lasote/stable/package/cfe3c3d40d613222d431d274eb053831f72a9116/lib -L/home/kkprince/.conan/data/easyloggingpp/9.80/memsharded/testing/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/lib -L/home/kkprince/.conan/data/OpenSSL/1.0.2g/lasote/stable/package/c9485444fc54028aa59ea9eb50adf168f08452e3/lib -L/home/kkprince/.conan/data/electric-fence/2.2.0/lasote/stable/package/52bcde7d26fabb9754f2f3b850001579b1098686/lib -L/home/kkprince/.conan/data/zlib/1.2.8/lasote/stable/package/52bcde7d26fabb9754f2f3b850001579b1098686/lib -lPocoUtil -lPocoMongoDB -lPocoNet -lPocoNetSSL -lPocoCrypto -lPocoData -lPocoDataSQLite -lPocoUtil -lPocoZip -lPocoXML -lPocoJSON -lPocoFoundation -lrt -lssl -lcrypto -ldl -lefence -lpthread -lz -lPocoMongoDB -lPocoNet -lPocoNetSSL -lPocoCrypto -lPocoData -lPocoDataSQLite -lPocoZip -lPocoXML -lPocoJSON -lPocoFoundation -lrt -lssl -lcrypto -ldl -lefence -lpthread -lz -Wl,-rpath,/home/kkprince/.conan/data/Poco/1.7.3/lasote/stable/package/cfe3c3d40d613222d431d274eb053831f72a9116/lib:/home/kkprince/.conan/data/easyloggingpp/9.80/memsharded/testing/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/lib:/home/kkprince/.conan/data/OpenSSL/1.0.2g/lasote/stable/package/c9485444fc54028aa59ea9eb50adf168f08452e3/lib:/home/kkprince/.conan/data/electric-fence/2.2.0/lasote/stable/package/52bcde7d26fabb9754f2f3b850001579b1098686/lib:/home/kkprince/.conan/data/zlib/1.2.8/lasote/stable/package/52bcde7d26fabb9754f2f3b850001579b1098686/lib
CMakeFiles/village.io-server.dir/main.cpp.o: In function `main':
main.cpp:(.text+0x5a): undefined reference to `Poco::Util::IniFileConfiguration::IniFileConfiguration(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
collect2: error: ld returned 1 exit status
CMakeFiles/village.io-server.dir/build.make:94: recipe for target '/home/kkprince/ClionProjects/village.io/build/village.io-server' failed
make[2]: *** [/home/kkprince/ClionProjects/village.io/build/village.io-server] Error 1
make[2]: Leaving directory '/home/kkprince/ClionProjects/village.io/server/build'
CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/village.io-server.dir/all' failed
make[1]: *** [CMakeFiles/village.io-server.dir/all] Error 2
make[1]: Leaving directory '/home/kkprince/ClionProjects/village.io/server/build'
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2
Bin ich es falsch kompilieren, oder wie kann ich diese Arbeit machen?
Offenbar vermissen Sie eine Poco Shared Library, "*** Keine Regel zu Ziel" –
@ Cheersandthth.-Alf Ich dachte, dass diese Zitate problematisch waren, aber ich habe immer noch ähnliche Probleme. –
Das ist komisch, ich habe es gerade in Ubuntu 14.04 versucht und verlinkt ok. Ich habe Boost/[email protected]/stable von Conan auch verwendet, wird prüfen, ob es verwandt sein könnte – drodri