After setting up the basic VTK environment, the learning process follows. But I had a bunch of problems in the first example. Here’s how to solve them. Fill in a bunch of holes first.
1. Problem introduction
I follow: Dongling VTK tutorial series navigation learning.
>
>
>
>
>
>
>
>
>
The first is the cmake code:
cmake_minimum_required(VERSION2.8)
project(TestVTKInstall)
find_package(VTKREQUIRED)
include(${VTK_USE_FILE})
add_executable(${PROJECT_NAME}TestVTKInstall.cpp)
target_link_libraries(${PROJECT_NAME}vtkRendering vtkCommon)
Then the CPP code:
#include <vtkRenderWindow.h>
#include <vtkSmartPointer.h>
int main()
{
vtkSmartPointer<vtkRenderWindow> renWin = vtkSmartPointer<vtkRenderWindow>::New();
renWin->Render();
std::cin.get();
return 0;
}
ror configuration process, project files may be invalid
.>r> error configuration process, project files may be invalid
2. Problem solving:
Error Configuration Process: The Project Files may be invalid method did not work. Here’s a little bit about this approach.
2.1 No use of CMAKE to select the version of VS on the corresponding machine.
When generating the corresponding VS solution with the CMAKE configuration, you need to correspond to the correct VS version. This is the same version that you used when installing VTK.
2.2 Previous error cache is not cleaned
|
to clear the cache.
click on the top left corner of the file - & gt; Delete cathe
2. 3 cmake list programming problems
Following the above description did not solve our problem, so we had to continue to Google. We saw us have similar questions on several StackOverflow posts.
- VTK + Cmake -> USE_VTK_RENDERING erroCMake error: ‘Target is not built by this project’ Cmake link liabray target link errorCMake OpenCV Cannot Specify link Libraries
According to the above, compared with our CMMakelists code, we tried one code after another, and finally found a very hidden error, that is, we must pay attention to the space in CMMakelists!!
To be specific,
- is the first line:
rsion
a> code>2.8>e> have a space> The third line: VTK
d r>red
has a s> on line 9, testvtkinstal>cpp
has a space on line> In line 11, we change the previous vtkRendering vtkCommon
$>tk_libraries}
with a>e before. There is nothing wrong with cmake, though, if you simply add a space. However, when VS is compiled later, the following error will occur, so it will be fine to fix it. Finally, the cmMakelists.txt code:
cmake_minimum_required(VERSION 2.8)
project(TestVTKInstall)
find_package(VTK REQUIRED)
include(${VTK_USE_FILE})
add_executable(${PROJECT_NAME} TestVTKInstall.cpp)
target_link_libraries(${PROJECT_NAME} ${VTK_LIBRARIES})
3. Run in VS
After cmake has no errors, we configure, then generate. Open VS2017 as an administrator. Open the file we compiled.
> compile l_build
>>ck on F7 or build it. If there are no errors, right-click TestVTKInstall and set it as a startup item, then click F5, or run to get the correct results.
Over
Just solve problems one by one.
Read More:
- To solve problems in cmake VTK: error configuration process, project files may be invalid
- windows CMake error: error in configuration process, project files may be invalid
- “Error in configuration process project files may be invalid” appears during cmake compilation
- CMake error: error in configuration process, project files may be invalid
- Solution: when cmake is compiled, “error in configuration process project files may be invalid” appears
- Error in configuration process, project files may be invalid in cmake compilation
- When cmake is compiled, “error in configuration process project files may be invalid” appears
- Error resolution-“Error in configuration process, project files may be invalid” appears when Cmake compiles openCV
- To solve the problem in Windows opencv installation: error configuration process, project files may be invalid
- Error configuration process, project files may be invalid
- Error configuration process and project file may be invalid appear in cmake compilation
- Summary of problems encountered in compiling and installing vtk7 + vs2013 / 2015 + cmake
- Project files may be invalid appears when cmake compiles opencv3.1, and the debug additional dependency of the compiled opencv3.1 is at the end
- [VTK] cmake compiling VTK
- Common mistakes and solutions of cmake + QT + VTK
- CMake_ Compiling VTK_ 9.0.0 running vtkcommoncolor DLL has access conflict
- Configuration of OpenGL under CodeBlocks and solutions to problems encountered
- Two methods of cmake in VTK program
- Solutions to several VTK compilation errors (vtk5.8 + VS2010)
- Android learning notes 03: some problems and solutions in the learning process