Anonymous
yup
Is it worth to get a certificate from online courses ?
YVEF
Hi guys. Please help me. Can not add a boost library to CMakeList.txt file. :)
YVEF
i got error: Boost can not find components (ex: regex);
Stephanos
Hi guys. Please help me. Can not add a boost library to CMakeList.txt file. :)
oh man,... there can be SO many different errors, depending whether its linux, mac, or win, which style of cmake you are using which compiler you are using how you installed your boost libs (pre-compiled or self-compiled) You should post info about OS pre- or self-comp and the complete Cmake file as well as the error message and furthermore, this looks like a question you should put on stackoverflow and post the link here, since its going to be a longer discussion
Stephanos
you installed to c:/boost and you point to Boost?
Stephanos
and... please make sure, not to add a couple of lines at once. try commenting out all lines except for find_package
Stephanos
and please write all CMAKE in all CAPS. it makes it easier to read
Stephanos
find_package has also to be before setting the boost_root if i am not mistaken, since find_package initializes the modul for finding packages
Stephanos
https://github.com/Kitware/CMake/blob/master/Modules/FindBoost.cmake Here is the docs:
Stephanos
aaaand, I don't quite know whether it makes a difference, but in my cmake i usually use FIND_PACKAGE(Boost 1.69 COMPONENTS system REQUIRED) but i don't know if it depends from the order
YVEF
you installed to c:/boost and you point to Boost?
my boost compiler lib and include in C:/Boost
Stephanos
oky
Stephanos
but try using "FIND_PACKAGE" befor setting dirs
Stephanos
just a matter of style, no worries. most people tend to write all cmake commandes ALL UPPERCASE like FIND_PACKAGE
Stephanos
have you put find pack to the top now and tried again?
Stephanos
delete use static use multithr and use static runtime for the test please
Stephanos
btw the default of multithreaded is ON already, you don't have to turn it on
YVEF
have you put find pack to the top now and tried again?
yes. and i got "Could NOT find Boost (missing: system) (found suitable version "1.69.0", minimum required is "1.69.0")"
Stephanos
could you please copy the whole cmake messages?
YVEF
could you please copy the whole cmake messages?
C:/Users/Eric/projects/test2/build> mingw32-make -j2 CMake Error at C:/Program Files/CMake/share/cmake-3.15/Modules/FindPackageHandleStandardArgs.cmake:137 (message): Could NOT find Boost (missing: system) (found suitable version "1.69.0", minimum required is "1.69.0") Call Stack (most recent call first): C:/Program Files/CMake/share/cmake-3.15/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE) C:/Program Files/CMake/share/cmake-3.15/Modules/FindBoost.cmake:2142 (find_package_handle_standard_args) CMakeLists.txt:8 (FIND_PACKAGE) -- Configuring incomplete, errors occurred! See also "C:/Users/Eric/projects/test2/build/CMakeFiles/CMakeOutput.log". mingw32-make: *** [Makefile:242: cmake_check_build_system] Error 1 *** Failure: Exit code 2 ***
Stephanos
please delete the 1.69 from the find boost line and try again
YVEF
please delete the 1.69 from the find boost line and try again
again the same error. this is my cmakelists: cmake_minimum_required(VERSION 3.0) project(test2) add_executable(test2 main.cpp) #set(BOOST_ROOT "C:\\Boost") #set(Boost_USE_STATIC_LIBS ON) #set(Boost_USE_MULTITHREADED ON) FIND_PACKAGE(Boost COMPONENTS system REQUIRED) set(Boost_USE_STATIC_RUNTIME ON) #add_executable(test2 main.cpp) #target_include_directories(test2 PUBLIC ${Boost_INCLUDE_DIRS}) #target_link_libraries(test2 ${Boost_LIBRARIES})
Stephanos
please copy the error message for me,
Stephanos
:)
Stephanos
please further try FIND_PACKAGE(Boost) IF (Boost_FOUND) MESSAGE(STATUS ${Boost_INCLUDE_DIR}) ENDIF()
YVEF
please further try FIND_PACKAGE(Boost) IF (Boost_FOUND) MESSAGE(STATUS ${Boost_INCLUDE_DIR}) ENDIF()
now I make to some change and reah what cmakelists find the boost but i give new errors. I can show you. one moment please
Stephanos
why are there two find packages?
YVEF
please further try FIND_PACKAGE(Boost) IF (Boost_FOUND) MESSAGE(STATUS ${Boost_INCLUDE_DIR}) ENDIF()
this is working but if I add #include <boost/asio.hpp> to main.cpp i get the error what you see below
Stephanos
delete one
Stephanos
yeah, you need to add them to target link libs now
Stephanos
undefined reference is a linker-error
YVEF
delete one
yes. its wrong but not is solution of problem)
Stephanos
oh.... it is an undefined reference to wsa i see
Stephanos
you forgot to link the windows socket api
Stephanos
or include it
Stephanos
-lws2_32
Stephanos
if(WIN32) target_link_libraries(test2 wsock32 ws2_32) endif()
Stephanos
before linking agains boost
Stephanos
i think
YVEF
i think
one moment.
YVEF
i think
wow. thank you very much!!!
YVEF
i think
it work for me
Stephanos
wow. thank you very much!!!
call me the cmake-god :D
Stephanos
no,.. just kidding
Stephanos
YVEF
yes, my cmake-god :)))
Stephanos
yes, my cmake-god :)))
hahaha,... i am glad it worked out for you
YVEF
thank you again
Shubham
find all a,b,c,d<1000 where a^3+b^3=d^3+c^3.
Shubham
plz help guys
Shubham
in this
Shubham
solution in c aur c++
Oleksandr
I have never understood why beginners are given tasks with a mathematical bias. It does not help in learning the language))
Till
find all a,b,c,d<1000 where a^3+b^3=d^3+c^3.
https://wandbox.org/permlink/MVrgm78nOe6kR2od Lol
Till
but it doesn't work)
Its concept of foo
Oleksandr
okay, it was killed.. in own ide it works
Mihail
https://wandbox.org/permlink/MVrgm78nOe6kR2od Lol
i really doubt his teacher would want to wait ~50 hours to check his homework
Mihail
true
Mat
I have never understood why beginners are given tasks with a mathematical bias. It does not help in learning the language))
Because you're supposed to know math, and it's easy to create the corresponding algorithm while concentrating on basics language aspects
Mat
Not every programmer has need in math.
But it's easy to find the algorithm. Usually it is even in the request or some Wikipedia page
Mat
And everyone should know basic maths
Wim
A computer is a calculator
Wim
To compute == to calculate
Anonymous
+1
klimi
+2
klimi
Rekt