I have downloaded the GLFW source package for building the library.
In the QtCreator IDE, I go to File/Open file or project and select the CMakeLists.txt of GLFW. The project is built and the resulting files stored in a certain folder.
The next step is to compile the library to get the .a files (we want to create a static library that could be used by another application). However, the compilation never ends, and the compile output shows "Persisting CMake state..." forever.
I have made my research but cannot find an answer to this. I'm not an expert on CMake or QtCreator IDE.
I could build the project for MVS (Microsoft Visual Studio) in Windows with cmake -G"Visual Studio 15 2017" path/to/CMakeLists.txt
And then compile the resulting MVS project with MVS.
I could do the same on Linux using only the command line (cmake path/to/CMakeLists.txt, make all).
However, I find these problem with QtCreator...
Related
I'm working on a project in C++ configured using CMake.
Each time I build the project, all files are recompiled, which is unbearable considering the time it takes.
With Visual Studio Code
I'm trying to use VSCode and the CMake Extension.
The CMake:Configure command works well and so does the CMake:Build command. It takes a lot of time to compile because I use highly templatized header-only libraries like Eigen3, Boost and CGAL, so I need to build a pre-compiled header. It build some librairies too. But it is normal that it takes time for a first compilation.
However, if I build the target again (without modifying anything in the code) the compilation is completely redone ! I just want the modified source files or librairies to be re-compiled. Or if a header in the list of pre-compiled headers is modified, only then should the pre-compiled headers be recompiled.
With Visual Studio 2019
I thought that VSCode didn't work with a concept of "project", and therefore had to reconfigure and recompile the whole project every time it was launched.
So I decided to generate a Visual Studio Solution with the CMake-GUI program and use Visual Studio 2019 instead of VSCode.
Now when I build a second time my project, nothing is recompiled and the program is directly lauched. Visual Studio say :
========== Build: 0 succeeded, 0 failed, 5 up-to-date, 0 skipped ==========
Wonderful!
Unfortunately not..., because if I modify a file, Visual Studio keeps telling me that everything is up-to-date and my modifications are not taken into account. I need to "Rebuild" the project so that everything will be recompiled, which does not solve my problem as it takes a lot of time.
Question
How to recompile only modified source files, librairies or pre-compiled headers (with VS Code, Visual Studio or both) ?
Plaform : Windows 10
Edit 15.04.21
I did some more methodical testing today to find out what the problem might be.
I used a very simple project to do the tests.
CMakeList.txt
cmake_minimum_required (VERSION 3.8)
project ("HelloCMake")
add_executable (HelloCMake "HelloCMake.cpp")
HelloCMake.cpp
#include <iostream>
int main() {
std::cout << "Hello CMake !" << std::endl;
return 0;
}
1. With VSCode and CMake Tools Extension
With the CMake Tools Extension, VSCode can configure and build a CMake project. It generate a Visual Studio Solution (.sln).
Build the target with CMake Tools Extension which makes VSCode to run the command :
cmake --build <PROJECT_DIR>/build --config Release --target HelloCMake --
/maxcpucount:14
The entire target is compiled
I build it again (without changes)
The target is completely recompiled again
The problem is that the target is completely recompiled, every time. I asked the question directly to the CMake Tools developers. GitHub Issue
2. .sln project generated by CMake (Visual Studio 2019)
I generated a Visual Studio Solution with CMake and open it.
I build my project HelloCMake
I do some modifications in source file
I build the project again, but Visual Studio never takes my modifications into account. The builds are always "up-to-date".
The problem is that Visual Studio does not take my changes into account. I have to rebuild the project, which takes too much time.
3. Directly open CMake project with Visual Studio 2019 (Ninja)
If you open a CMakeList.txt with Visual Studio 2019, it is not a Visual Studio Solution that is generated but a Ninja one.
It seems that this way the compilation works correctly !
According to this research, it is the CMake Tools Extension for VSCode as well as the Visual Studio Solution that cause problems.
I can't figure out why such a simple project doesn't compile properly with a Visual Studio Solution generated by CMake.
I'm a new user of NetCDF, and I would like to use this file structure in my cross-platform Fortran-2008 projects.
The C Library dependency:
So, first I downloaded the NetCDF-C binary installer, that is described as a NetCDF-Fortran library dependency, and installed it in my machine.
Link: NetCDF4+DAP (x64)
After that I added the NetCDF installed folder path to the Windows 10 environment path.
I tested it running the ncdump in the Windows console and it works good!
The Fortran Library:
Second, I cloned the NetCDF-Fortran Github repositore and:
a) I opened the Windows console and went to the cloned folder
b) I created a new folder called: "build"
c) I entered in this "build" folder and typed: cmake ..
Then the CMake complete all stuffs ok:
This CMake process generated 54 Microsoft Visual Studio projects and one Solution file inside the "build" folder.
So, I opened the NC4F solution, and I right-clicked in the solution name and I clicked in the "Build" option. I expected Visual Studio to generate static (*.lib) and dynamic (*.dll) Fortran library output files.
VS starts to compile the solution, but it gave to me a lot of compile-time erros. Here is my print screen:
What I'm doing wrong?
How can I get the NetCDF-Fortran libraries (static and dynamic) to use them in my Fortran-08 projects?
My system is:
Windows 10 x64
Microsoft Visual Studio 2019
Intel Visual Fortran 2019
Thank you,
I am trying to compile GDCM 2.8.4 for Windows. Can anybody describe how to compile it with Visual Studio 2013 Professional? The GDCM wiki is out of date. Thanks a lot.
First of all, you will have to install CMake. Then
Start CMake GUI.
I guess you already have the gdcm-2.8.4 directory (in a directory X:\XXXXX\ ) containing
Applications
Source
Testing
Utilities
and other subdirs. So set the in the CMake GUI "source dir" to X:\XXXXX\gdcm-2.8.4 . (NOT to its Source subdir!).
Then you create a new directory, where CMake will create the VS projects, let's call it X:\XXXXXX\GDCM-VSProjects. In the CMake GUI set "Where to build the binaries" to X:\XXXXXX\GDCM-VSProjects.
Then, in the CMake GUI press "Configure".
After configuring CMake offers you some options; choose at least GDCM_BUILD_APPLICATIONS, GDCM_BUILD_EXAMPLES, GDCM_BUILD_SHARED_LIBS. For documentation you will need doxygen, latex and possibly more.
Then, in the CMake GUI press "Generate". Now a lengthy calculation is performed and finally VS solution and VS subprojects are generated into your new X:\XXXXXX\GDCM-VSProjects subdirectory.
Now you can open GDCM.sln in VisualStudio and BuildAll in 64 bit Release mode.
After the build, you will find libs, dlls and exes in the bin/Release subdirectory of your X:\XXXXXX\GDCM-VSProjects.
Thats it.
I've done a whole tutorial about making a 3D Rendering Engine in OpenGL with Java and lwjgl and the guy who made the tutorial also wrote the engine in C++
To increase my knowledge about programming I wanted to take a look at the C++ version too. Also I believe (and I might be totally wrong) that I'm actually able to do a lot more with C++ than with java. The main problem I have is that I cannot get the engine running despite the included instructions and I would really appreciate if someone can help me out.
this is the engine i want to setup: https://github.com/BennyQBD/3DEngineCpp
I want to use CodeBlocks for this project since it was recommended and unlike Visual Studio it is free.. I also already downloaded glew, assimp and sdl and I installed CMake which are needed for this to run. Now I have to put that together according to this instruction here:
###Windows/MinGW###
- Make sure CMake is both installed and added to the system PATH.
- Open a Terminal and run:
```Shell
# install dependencies
# Install GLEW in %PROGRAMFILES%/GLEW or SET %GLEW_ROOT_DIR% to where GLEW is on your machine (Example: D:\PATH_TO_GLEW)
# Install SDL2 in %PROGRAMFILES%/SDL2 or SET %SDL2_ROOT_DIR% to where SDL2 is on your machine (Example: D:\PATH_TO_SDL2)
# Install ASSIMP in %PROGRAMFILES%/ASSIMP or SET %ASSIMP_ROOT_DIR% to where ASSIMP is on your machine (Example: D:\PATH_TO_ASSIMP)
cd build
# REPLACE "Visual Studio 12" with your preferred build toolchain (Maybe you want "Codeblocks - MinGW Makefiles")
# BTW VS 10 is VS 2010, VS 11 is VS 2012 and VS 12 is VS 2013, BLAME MicroSoft for the naming! LOL!
cmake -G "Visual Studio 12" ../
# open the generated SLN file (or cbp file if using CodeBlocks) and build!
```
- Copy the DLLs in /lib/_bin/ to /build/Debug/ and /build/Release/
- In Visual Studio, set the Startup project to 3DEngineCpp
- Move the res folder into the build folder
- Run
Major problem is, since I've only done java coding in eclipse I'm a bit confused..
What does he mean by "Open a Terminal and run: '''Shell" ?? and how am I supposed to install glew, sdl2 and assimp? what's cd build? and why do I need CMake, it isn't really mentioned what it does..?
Maybe someone can elaborate (step by step if possible) what I need to do in order to get this running, thanks a lot!
No guarantees my steps will work flawlessly as external dependencies in C++ is still very painful to deal with for me, but I'll give you some leads and hope you make some progress. Also, I've never used Code::Blocks, so I'm not sure if Visual Studio projects are compatible with it. This is the only way I know how to do things on Windows.
First, you'll need to install CMake. CMake is a utility that generates project files so that the project can be easily compiled on certain platforms. It generates Visual Studio project files on Windows, which will allow you to open the project in Visual Studio, and compile them from there.
In order to build the project, you'll have to sort out its dependencies first.
GLEW:
Download GLEW's sources and extract everything. It comes with Visual Studio project files
Open up Visual Studio with Administrator permissions
Open up GLEW's project
Build everything
Run the install "project" to get Visual Studio to install GLEW
Assimp:
Download Assimp's source from GitHub
Extract the project root directory somewhere. The root directory is the directory where CMakeLists.txt is in
Open CMake's GUI utility
Click Browse Source, and select that directory
Select an output directory by clicking Browse Build
Click Configure, when that's done click Generate. This will generate a Visual Studio project file for you
Open project with Visual Studio, build everything. Run install like you did before to install Assimp
SDL2: SDL's sources come with Visual Studio project files, so you can repeat the steps for GLEW to install it.
Now you can finally start attempting to get the engine to work. No guarantees that it'll work, but I'd try the same thing I suggested for Assimp as they're both CMake projects. Once the project files are generated, you can open it up in Visual Studio. Except this time, you won't really be installing it. You can modify the sources and run it like you would any other C++ project.
Hello I have downloaded and unzipped OpenCV-2.4.10.exe on my PC. Then created a new Win32 Console application project in VS 2015, set all the Paths in Project properties, set the environmental variables in Win8.1. When I'm trying to start the program in debugging mode I get the "The program can't start because MSVCP120D.dll is missing from your computer. Try reinstalling the program to fix this problem".
Then, I downloaded the Visual C++ redistributable for Visual Studio 2015 But the problem still remains. What should I do to use OpenCV in VS 2015?
OpenCV-2.4.10.exe comes with runtime binary dlls built to work with runtimes from vc10 (vs2010), vc11 (vs2012) and vc12 (vs2013).
These DLL files use MSVCP100.dll, MSVCP110.dll and MSVCP120.dll respectively, and if you have installed Visual Studio 2015 you should find them in your System32 (or SysWOW64) directory.
The MSVCP120D.dll error appears when your application tries to load the DEBUG version of the DLL binaries. You do not have MSVCP120D.dll unless you have Visual Studio 2013 installed on your system. To solve this problem, use the Release runtime instead of the Debug runtime.
All you need to do is exclude the DEBUG lib files from your project. This means including only the lib files without the suffix 'd'. (ie. include opencv_core2410.lib instead of opencv_core2410d.lib)
HTH
Extras:
You don't really need to load the Debug binaries, unless you need to debug openCV's source code. If you do, there's still a way. Download the openCV source code, use CMake to create a VS2015 project. You can then build your own dll binaries using the latest runtime from VS2015.
VS2015 uses vc14 while OpenCV2.4.10 doesn't come with pre-built binaries associated with vc14. This answer should help you to understand. Accordingly you should choose the right folder (vc14) for Linker>General>Additional Library Directories in project properties.
You can use cmake to build binaries using VS2015 or you can download a later version of OpenCV which has prebuilt binaries for vc14.