Creating a QT Project with CMake - c++

I am trying to set up a QT project with CMake (and not using QT Creator).
I am currently trying to build a minimum working example, that just shows an empty window. My current code is based (more like coppied) from this tutorial from the official (?) docs and this answer by another user to a similar question.
I then run the following three commands:
cmake .
cmake --build .
.\Debug\helloworld.exe
But nothing happens (when running the program, the first two commands appear to work as intended). If I put the code from main.cpp into an existing QT Creator project it works and shows an empty window. Anyone can tell me, what I am missing?
main.cpp
#include <QApplication>
#include <QWidget>
#include <QMainWindow>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
//Option 1, like in the mentioned stackoverflow answer
//QWidget window;
//Option 2, to test If maybe the QWidget above was the problem
QMainWindow window;
window.setWindowTitle("Test");
window.show();
return app.exec();
}
CMakeList.txt
cmake_minimum_required(VERSION 3.16)
project(helloworld VERSION 1.0.0 LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Without this line, cmake does not find the package
set(CMAKE_PREFIX_PATH "C:/Qt/6.3.1/msvc2019_64")
find_package(Qt6 REQUIRED COMPONENTS Widgets)
qt_standard_project_setup()
add_executable(helloworld
main.cpp
)
target_link_libraries(helloworld PRIVATE Qt6::Widgets)
set_target_properties(helloworld PROPERTIES
WIN32_EXECUTABLE ON
MACOSX_BUNDLE ON
)
EDIT:
As suggested by Aamir I created an extra build folder. The output of the three comands is as follows:
One more thing, if I replace the code in main.cpp with a simple "Hello World" programm, it works fine. I therefore assumed, that the missing/failed parts in the first cmake command are no problem. Or am I wrong about that part?
PS H:\Coding\QT_Tic_Tac_toe> mkdir build
Directory: H:\Coding\QT_Tic_Tac_toe
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 19/08/2022 10:11 build
PS H:\Coding\QT_Tic_Tac_toe> cd .\build\
PS H:\Coding\QT_Tic_Tac_toe\build> cmake ..
-- Building for: Visual Studio 17 2022
-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19043.
-- The CXX compiler identification is MSVC 19.32.31332.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.32.31326/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - not found
-- Found Threads: TRUE
-- Performing Test HAVE_STDATOMIC
-- Performing Test HAVE_STDATOMIC - Success
-- Found WrapAtomic: TRUE
-- Could NOT find WrapVulkanHeaders (missing: Vulkan_INCLUDE_DIR)
-- Configuring done
-- Generating done
-- Build files have been written to: H:/Coding/QT_Tic_Tac_toe/build
PS H:\Coding\QT_Tic_Tac_toe\build> cmake --build .
Microsoft (R) Build Engine version 17.2.1+52cd2da31 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.
Checking Build System
Automatic MOC and UIC for target helloworld
Building Custom Rule H:/Coding/QT_Tic_Tac_toe/CMakeLists.txt
mocs_compilation_Debug.cpp
main.cpp
Generating Code...
helloworld.vcxproj -> H:\Coding\QT_Tic_Tac_toe\build\Debug\helloworld.exe
Building Custom Rule H:/Coding/QT_Tic_Tac_toe/CMakeLists.txt
PS H:\Coding\QT_Tic_Tac_toe\build> .\Debug\helloworld.exe
PS H:\Coding\QT_Tic_Tac_toe\build>

You need to add the Qt DLL directory to the PATH environment variable either permanently or before calling the program from the console as follows:
set PATH=C:\Qt\6.3.1\msvc2019_64\bin;%PATH%
If you would have started your application from a cmd console window an error dialog would have popped up notifying you about the missing DLL. But as you were using PowerShell there is a bug pending (see here) that prevents the error dialog to be shown.
NB: You can call cmd from a PowerShell window to get the old console window.

Related

How to setup mingw in vcpkg (Windows)

I tried to install mingw package from vcpkg but I got an error
C:\Users\Administrator\Downloads\vcpkg>vcpkg.exe install curl:x64-mingw-static
Computing installation plan...
The following packages will be built and installed:
curl[core,non-http,schannel,ssl,sspi]:x64-mingw-static -> 7.82.0
* zlib[core]:x64-mingw-static -> 1.2.12
Additional packages (*) will be modified to complete this operation.
Detecting compiler hash for triplet x64-mingw-static...
Error: while detecting compiler information:
The log content at C:\Users\Administrator\Downloads\vcpkg\buildtrees\detect_compiler\stdout-x64-mingw-static.log is:
-- Configuring x64-mingw-static
CMake Error at scripts/cmake/vcpkg_execute_required_process.cmake:128 (message):
Command failed: ninja -v
Working Directory: C:/Users/Administrator/Downloads/vcpkg/buildtrees/detect_compiler/x64-mingw-static-rel/vcpkg-parallel-configure
Error code: 1
See logs for more information:
C:\Users\Administrator\Downloads\vcpkg\buildtrees\detect_compiler\config-x64-mingw-static-out.log
Call Stack (most recent call first):
scripts/cmake/vcpkg_configure_cmake.cmake:370 (vcpkg_execute_required_process)
scripts/detect_compiler/portfile.cmake:18 (vcpkg_configure_cmake)
scripts/ports.cmake:145 (include)
Error: vcpkg was unable to detect the active compiler's information. See above for the CMake failure output.
C:\Users\Administrator\Downloads\vcpkg>
How can I fix it? I have mingw installed on C:/mingw64 and C:/mingw32 and I'm using them in CLion without problems
Error in config-x64-mingw-static-out.log
[1/1] cmd /c "cd .. && "C:/Users/Administrator/Downloads/vcpkg/downloads/tools/cmake-3.22.2-windows/cmake-3.22.2-windows-i386/bin/cmake.exe" "C:/Users/Administrator/Downloads/vcpkg/scripts/detect_compiler" "-DCMAKE_MAKE_PROGRAM=C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/Ninja/ninja.exe" "-DBUILD_SHARED_LIBS=OFF" "-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=C:/Users/Administrator/Downloads/vcpkg/scripts/toolchains/windows.cmake" "-DVCPKG_TARGET_TRIPLET=x64-windows-static" "-DVCPKG_SET_CHARSET_FLAG=ON" "-DVCPKG_PLATFORM_TOOLSET=v143" "-DCMAKE_EXPORT_NO_PACKAGE_REGISTRY=ON" "-DCMAKE_FIND_PACKAGE_NO_PACKAGE_REGISTRY=ON" "-DCMAKE_FIND_PACKAGE_NO_SYSTEM_PACKAGE_REGISTRY=ON" "-DCMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP=TRUE" "-DCMAKE_VERBOSE_MAKEFILE=ON" "-DVCPKG_APPLOCAL_DEPS=OFF" "-DCMAKE_TOOLCHAIN_FILE=C:/Users/Administrator/Downloads/vcpkg/scripts/buildsystems/vcpkg.cmake" "-DCMAKE_ERROR_ON_ABSOLUTE_INSTALL_DESTINATION=ON" "-DVCPKG_CXX_FLAGS=" "-DVCPKG_CXX_FLAGS_RELEASE=" "-DVCPKG_CXX_FLAGS_DEBUG=" "-DVCPKG_C_FLAGS=" "-DVCPKG_C_FLAGS_RELEASE=" "-DVCPKG_C_FLAGS_DEBUG=" "-DVCPKG_CRT_LINKAGE=static" "-DVCPKG_LINKER_FLAGS=" "-DVCPKG_LINKER_FLAGS_RELEASE=" "-DVCPKG_LINKER_FLAGS_DEBUG=" "-DVCPKG_TARGET_ARCHITECTURE=x64" "-DCMAKE_INSTALL_LIBDIR:STRING=lib" "-DCMAKE_INSTALL_BINDIR:STRING=bin" "-D_VCPKG_ROOT_DIR=C:/Users/Administrator/Downloads/vcpkg" "-DZ_VCPKG_ROOT_DIR=C:/Users/Administrator/Downloads/vcpkg" "-D_VCPKG_INSTALLED_DIR=C:/Users/Administrator/Downloads/vcpkg/installed" "-DVCPKG_MANIFEST_INSTALL=OFF" "-G" "Ninja" "-DCMAKE_BUILD_TYPE=Release" "-DCMAKE_INSTALL_PREFIX=C:/Users/Administrator/Downloads/vcpkg/packages/detect_compiler_x64-windows-static""
-- The C compiler identification is MSVC 19.31.31107.0
-- The CXX compiler identification is MSVC 19.31.31107.0
#COMPILER_HASH#c3649029c7e070e5f43d9ce4d317605f000f9404
#COMPILER_C_HASH#2db604846bbf78fdf1b811ea56df2670f6b33536
#COMPILER_C_VERSION#19.31.31107.0
#COMPILER_C_ID#MSVC
#COMPILER_CXX_HASH#2db604846bbf78fdf1b811ea56df2670f6b33536
#COMPILER_CXX_VERSION#19.31.31107.0
#COMPILER_CXX_ID#MSVC
-- Configuring done
-- Generating done
CMake Warning:
Manually-specified variables were not used by the project:
BUILD_SHARED_LIBS
CMAKE_INSTALL_BINDIR
CMAKE_INSTALL_LIBDIR
VCPKG_TARGET_ARCHITECTURE
_VCPKG_ROOT_DIR
-- Build files have been written to: C:/Users/Administrator/Downloads/vcpkg/buildtrees/detect_compiler/x64-windows-static-rel
It looks like it detects microsoft compiler instead of mingw
The problem was not set gcc.exe in PATH, adding it resolved problem

"MySQL C++ Connector Unresolved Dependencies (VS 2015)" solution did not work

This refers to the original question posted by Tom Doodler, and answered by Norbert Boros, on the same topic. I am also trying to get the MySQL Connector/C or /C++ to work. Using MS Visual Studio 2017. Following the steps in the answer, did all the steps till :
Run this command ( assuming you want the STATIC DEBUG ):
cmake -G "Visual Studio 15 2017 Win64" -DCMAKE_BUILD_TYPE=Debug -DBUILD_STATIC=true -DBUNDLE_DEPENDENCIES=ON -DSTATIC_MSVCRT=OFF -DWITH_JDBC=ON
The output on the screen says:
Configuring incomplete, errors occurred! in the last few lines. No "MYSQLCPPCONN.sln" either.
I have a pdf of the output but do not know how to attach it here. The output says three files are missing and one test failed, these are towards the end of the file, highlighted. Of course, their could be more problems that I could not identify, being a green thumb.
Any ideas about how to address this ?
I found Protobuf.sln at E:\MySQL C++ Connector Unresolved Dependencies (VS 2015) *\mysql-connector-cpp-master\cdk\protobuf*. would this be of any use ?
Here is part of the output where problems occurred (there could be more problems elsewhere, have no idea. Also, had to format the output as "code", a posting requirement on the forum ?):
-- Looking for pthread.h
-- Looking for pthread.h - not found
.
.
-- Performing Test HAVE_STATIC_ASSERT - Success
-- Performing Test HAVE_IS_SAME
-- Performing Test HAVE_IS_SAME - Failed
-- Performing Test HAVE_SHARED_PTR
-- Performing Test HAVE_SHARED_PTR - Success
-- Performing Test HAVE_SYSTEM_ERROR
-- Performing Test HAVE_SYSTEM_ERROR - Success
-- Check size of wchar_t
-- Check size of wchar_t - done
-- Looking for sys/endian.h
-- Looking for sys/endian.h - not found
-- Looking for sys/byteorder.h
-- Looking for sys/byteorder.h - not found
Wrote configuration header: E:/MySQL C++ Connector Unresolved Dependencies (VS 2
015)/mysql-connector-cpp-master/cdk/include/mysql/cdk/config.h
Legacy library soversion: 7
Looking for MySQL Client library:
CMake Error at jdbc/cmake/DepFindMySQL.cmake:128 (message):
Could not find MySQL headers at:
Point at MySQL client library location using WITH_MYSQL or
MYSQL_INCLUDE_DIR, MYSQL_LIB_DIR settings.
Call Stack (most recent call first):
jdbc/cmake/DepFindMySQL.cmake:555 (main)
cdk/cmake/dependency.cmake:42 (include)
jdbc/CMakeLists.txt:147 (find_dependency)
-- Configuring incomplete, errors occurred!

CEGUI: Failed to obtain desktop OpenGL version

Environment:
OS: Fedora Release 26
Compiler: g++ (GCC) 7.2.1
CEGUI: 0.8.7
Configured with: cmake .. -DCEGUI_BUILD_RENDERER_OPENGL=OFF -DCEGUI_BUILD_RENDERER_OPENGL3=ON -DCEGUI_USE_EPOXY=ON -DCEGUI_USE_GLEW=OFF
Epoxy: Latest version from https://github.com/yaronct/libepoxy
PowerVR Graphics SDK and Tools: v2017_R2 from
https://community.imgtec.com/developers/powervr/graphics-sdk/
Code:
CEGUI::OpenGL3Renderer& myRenderer = CEGUI::OpenGL3Renderer::bootstrapSystem();
Error:
CEGUI::RendererException in function 'void
CEGUI::OpenGLInfo::initTypeAndVer()'
(/home/jay/tmp/cegui/cegui-0.8.7/cegui/src/RendererModules/OpenGL/GL.cpp:88)
: Failed to obtain desktop OpenGL version. terminate called after
throwing an instance of 'CEGUI::RendererException' what():
CEGUI::RendererException in function 'void
CEGUI::OpenGLInfo::initTypeAndVer()'
(/home/jay/tmp/cegui/cegui-0.8.7/cegui/src/RendererModules/OpenGL/GL.cpp:88)
: Failed to obtain desktop OpenGL version.
Include from header file:
#include <epoxy/gl.h>
Just in case this is helpful. Here is the output of the cmake to show what it was able to find and what it was not:
sudo cmake .. -DCEGUI_BUILD_RENDERER_OPENGL=OFF -DCEGUI_BUILD_RENDERER_OPENGL3=ON -DCEGUI_USE_EPOXY=ON -DCEGUI_USE_GLEW=OFF
CMake Deprecation Warning at CMakeLists.txt:6 (cmake_policy):
The OLD behavior for policy CMP0017 will be removed from a future version
of CMake.
The cmake-policies(7) manual explains that the OLD behaviors of all
policies are deprecated and that a policy should be set to OLD only under
specific short-term circumstances. Projects should be ported to the NEW
behavior and not rely on setting a policy to OLD.
-- The C compiler identification is GNU 7.2.1
-- The CXX compiler identification is GNU 7.2.1
-- Check for working C compiler: /bin/cc
-- Check for working C compiler: /bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /bin/c++
-- Check for working CXX compiler: /bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PCRE: /usr/lib64/libpcre.so
-- Found FREETYPE: /usr/lib64/libfreetype.so
-- Found MINIZIP: /usr/lib64/libminizip.so
-- Found PkgConfig: /bin/pkg-config (found version "1.3.12")
-- Checking for module 'fribidi'
-- Found fribidi, version 0.19.7
-- Found FRIBIDI: TRUE
-- Looking for iconv
-- Looking for iconv - found
-- Found OpenGL: /usr/lib64/libOpenGL.so
-- Found GLEW: /usr/lib64/libGLEW.so
-- Found GLM: /usr/include
-- Could NOT find GLFW (missing: GLFW_H_PATH)
-- Found GLFW3: /usr/lib64/libglfw.so
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Found SDL2: /usr/lib64/libSDL2.so;-lpthread
-- Found SDL2IMAGE: /usr/lib64/libSDL2_image.so
-- Could NOT find DIRECTXSDK (missing: DIRECTXSDK_LIB_PATH DIRECTXSDK_H_PATH DIRECTXSDK_MAX_D3D)
-- Could NOT find D3DX11EFFECTS (missing: D3DX11EFFECTS_LIB D3DX11EFFECTS_H_PATH)
-- Found IRRLICHT: /usr/lib64/libIrrlicht.so
-- Could NOT find OGRE (missing: OGRE_LIB OGRE_H_PATH OGRE_H_BUILD_SETTINGS_PATH)
-- Found OIS: /usr/lib64/libOIS.so
-- Could NOT find DIRECTFB (missing: DIRECTFB_LIB DIRECTFB_H_PATH)
-- Could NOT find OPENGLES (missing: OPENGLES_LIB OPENGLES_H_PATH)
-- Found EPOXY: /usr/local/lib64/libepoxy.so
-- Found EXPAT: /usr/lib64/libexpat.so
-- Could NOT find XERCESC (missing: XERCESC_LIB XERCESC_H_PATH)
-- Found LibXml2: /usr/lib64/libxml2.so (found version "2.9.4")
-- Found TINYXML: /usr/lib64/libtinyxml.so
-- Performing Test TINYXML_API_TEST
-- Performing Test TINYXML_API_TEST - Success
-- Could NOT find RAPIDXML (missing: RAPIDXML_H_PATH)
-- Could NOT find IL (missing: IL_LIB IL_H_PATH)
-- Could NOT find ILU (missing: ILU_LIB)
-- Found FREEIMAGE: /usr/lib64/libfreeimage.so
-- Found SILLY: /usr/lib64/libSILLY.so
-- Could NOT find CORONA (missing: CORONA_LIB CORONA_H_PATH)
-- Could NOT find PVRTOOLS (missing: PVRTOOLS_LIB PVRTOOLS_H_PATH)
-- Found LUA51: /usr/lib64/liblua.so
-- Found TOLUAPP: /usr/lib64/libtolua++.so
-- Found PythonInterp: /bin/python (found version "2.7.14")
-- Found PythonLibs: //lib64/libpython2.7.so (found suitable exact version "2.7.14")
-- Boost version: 1.63.0
-- Found the following Boost libraries:
-- python
-- unit_test_framework
-- system
-- timer
-- Found Doxygen: /bin/doxygen (found version "1.8.13") found components: doxygen missing components: dot
-- Found GTK2_GTK: /usr/lib64/libgtk-x11-2.0.so
-- Configuring done
-- Generating done
-- Build files have been written to: xxx
I was able to resolve this issue and I wanted to share what worked for me.
The issue was that Epoxy was not finding the active context. OSG does not currently set the context that you have open ( which might be your only context ) as the current context. You have to manually set it as the current context as follows:
// You will need to have realized the viewer at least once
viewer.realize();
// You can get your camera's primary context by calling getGraphicsContext
// on it. I then also called realize on it. I'm not 100% certain if this
// is necessary, but it seemed to .
viewer.getCamera()->getGraphicsContext()->realize();
// Set the GraphicsContext as the current GraphicsContext.
viewer.getCamera()->getGraphicsContext()->makeCurrent();
Epoxy now sees the current context and this error goes away.

Basic procedure to use boost with biicode and MSVC 10.0

I'd like to test how biicode allows me to quickly create a project that uses boost. I (think I) have followed the procedure outlined in the bii docs.
After modifying the CMakeLists.txt, the configuration step does not succeed. The boost library does not seem to build to be built. I know that sometimes the configure step needs to be done twice (according to http://forum.biicode.com/t/error-could-not-find-the-following-static-boost-libraries-boost-thread/374), but this does not help.
I have pasted the exact steps I took below. I'd be very grateful if someone could show me where I went wrong.
1. Environnement : Windows 7 x64, Visual Studio 10 SP 1
PS G:\> bii --version
3.2
PS G:\> cmake --version
cmake version 3.2.2
CMake suite maintained and supported by Kitware (kitware.com/cmake).
PS G:\>
2. Start in a clean folder (G:\biitests)
3. Init the bii project
PS G:\biitests> bii init boostUsageTest -L
Successfully initialized biicode project boostUsageTest
4. Create the G:\biitests\boostUsageTest\main.cpp file with the following contents:
#include <boost/lexical_cast.hpp>
#include <boost/thread/mutex.hpp>
#include <iostream>
#include <exception>
int main (int argc, char *argv[])
{
boost::mutex uselessMutex;
auto value = boost::lexical_cast<int>(argv[0]);
std::cout << "value = " << value << std::endl;
return 0;
}
5. bii find
PS G:\biitests\boostUsageTest> bii find
INFO: Processing changes...
WARN: There are local unresolved dependencies
They will not be searched in the server
Unresolved: boost/lexical_cast.hpp
INFO: Finding missing dependencies in server
INFO: Looking for boost/thread...
WARN: Can't find block candidate for: boost/thread
INFO: No block candidates found
6. bii configure
PS G:\biitests\boostUsageTest> bii cpp:configure -G "Visual Studio 10"
INFO: Processing changes...
Running: "cmake" -G "Visual Studio 10" -Wno-dev ..\cmake
-- The C compiler identification is MSVC 16.0.40219.1
-- The CXX compiler identification is MSVC 16.0.40219.1
-- Check for working C compiler using: Visual Studio 10 2010
-- Check for working C compiler using: Visual Studio 10 2010 -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler using: Visual Studio 10 2010
-- Check for working CXX compiler using: Visual Studio 10 2010 -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
BLOCK: user/boostUsageTest
-----------------------------------------------------------
+ LIB: user_boostUsageTest
+ EXE: user_boostUsageTest_main
-- Configuring done
-- Generating done
-- Build files have been written to: G:/biitests/boostUsageTest/bii/build
PS G:\biitests\boostUsageTest>
7. edit CMakeLists.txt in the following way
(before my changes, the only non-commented line was ADD_BII_TARGETS() )
include(biicode/boost/setup)
INIT_BIICODE_BLOCK()
# Create Targets
ADD_BII_TARGETS()
bii_find_boost(COMPONENTS thread REQUIRED)
8. run bii find again
PS G:\biitests\boostUsageTest> bii find --update
INFO: Processing changes...
WARN: There are local unresolved dependencies
They will not be searched in the server
Unresolved: boost/lexical_cast.hpp
INFO: Finding missing dependencies in server
INFO: Looking for biicode/boost...
INFO: Block candidate: biicode/biicode/boost/master
INFO: Version biicode/boost: 9 (DEV) discarded
INFO: Version biicode/boost: 8 (STABLE) valid
INFO: Version biicode/boost: 7 (STABLE) valid
INFO: Version biicode/boost: 6 (STABLE) valid
INFO: Version biicode/boost: 5 (STABLE) valid
INFO: Version biicode/boost: 4 (STABLE) valid
INFO: Version biicode/boost: 3 (STABLE) valid
INFO: Version biicode/boost: 2 (STABLE) valid
INFO: Version biicode/boost: 1 (STABLE) valid
INFO: Version biicode/boost: 0 (STABLE) valid
INFO: Looking for boost/thread...
WARN: Can't find block candidate for: boost/thread
INFO: Analyzing compatibility for found dependencies...
Find resolved new dependencies:
biicode/boost: 8
ERROR: Find could not resolve:
boost/thread/mutex.hpp
INFO: Saving files from: toeb/cmakepp
INFO: Saving files from: biicode/boost
INFO: Saving files from: boost/install
9. Run bii configure again
PS G:\biitests\boostUsageTest> bii cpp:configure -G "Visual Studio 10"
INFO: Processing changes...
Running: "cmake" -G "Visual Studio 10" -Wno-dev ..\cmake
BLOCK: user/boostUsageTest
-----------------------------------------------------------
CALLING INIT_BIICODE_BLOCK IS NO LONGER NECESSARY
+ LIB: user_boostUsageTest
+ EXE: user_boostUsageTest_main
-- No linking type specified. Assuming static linking
-- Setting up biicode Boost configuration...
-- Building Boost 1.57.0 components with toolset msvc-10.0...
Starting thread library build job...
Building Boost components, please wait [ ]
Finished building thread library
-- Boost version: 1.57.0
CMake Error at ../deps/toeb/cmakepp/cmake/core/message.cmake:94 (_message):
Unable to find the requested Boost libraries.
Boost version: 1.57.0
Boost include path: G:/Users/bgo/.biicode/boost/1.57.0
Could not find the following static Boost libraries:
boost_thread
No Boost libraries were found. You may need to set BOOST_LIBRARYDIR to the
directory containing Boost libraries or BOOST_ROOT to the location of
Boost.
Call Stack (most recent call first):
C:/Program Files (x86)/CMake/share/cmake-3.2/Modules/FindBoost.cmake:1182 (message)
../deps/toeb/cmakepp/cmake/targets/find_package.cmake:17 (_find_package)
../deps/boost/install/install.cmake:351 (find_package)
../../CMakeLists.txt:9 (bii_find_boost)
-- Configuring incomplete, errors occurred!
See also "G:/biitests/boostUsageTest/bii/build/CMakeFiles/CMakeOutput.log".
ERROR: CMake failed
And running bii cpp:configure after that always gives the exact same output.
Thanks a lot in advance !
Benjamin

Cmake build error for c++

I want to build the bayes optimization program error is
The C compiler identification is GNU 4.9.2
The CXX compiler identification is GNU 4.9.2
Check for working C compiler: C:/MinGW/bin/gcc.exe
CMake Error: Generator: execution of make failed. Make command was: "C:\MinGW\bin" "cmTryCompileExec2576605559/fast"
Check for working C compiler: C:/MinGW/bin/gcc.exe -- broken
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.2/Modules/CMakeTestCCompiler.cmake:61 (message):
The C compiler "C:/MinGW/bin/gcc.exe" is not able to compile a simple test
program.
It fails with the following output:
Change Dir: C:/Code-Lite-Test/CMakeFiles/CMakeTmp
Run Build Command:"C:\MinGW\bin" "cmTryCompileExec2576605559/fast"
Access is denied
Generator: execution of make failed. Make command was: "C:\MinGW\bin"
"cmTryCompileExec2576605559/fast"
CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
I have downloaded source from url https://bitbucket.org/rmcantin/bayesopt/ and i have downloaded the MinGW compiler for Windows when I try to build the program the error is:
Please help me on this I have also deleted the old cache when I try to build the bayes optimization.
You could try to compile a simple C++ program first without CMake. E.g. store a simple main.cpp somewhere in your user directory C:\Users\<yourname>\Temp directory with following content:
int main()
{
return 0;
}
Now open CMD window in your C:\Users\<yourname>\Temp directory and run:
C:\MinGW\bin\gcc.exe main.cpp -o testprog
If an error popup appears that is saying something about a missing .dll, run following command in your CMD window and try to compile again:
set PATH=%PATH%;C:\MinGW\bin
If you had to run the last command, add the C:\MinGW\bin path permanently. After all it should be possible to run CMake with MinGW as compiler.
Verify that your MinGW compiler for Windows is able to build a simple program without CMake, for example: Hello World
When it works, clean your cache and try again.