How can I force msvc to use x64 architecture?
Hi,
I'm using clion 2023.2.1 and MSVC2017 as toolchain for building VTK example.
I set up my toolchain as amd64 architecture, c and c++ compilers as host x64 version.
In my cmake settings, I used VS2017 as generator for both debug and release
When I build the project, I get the warning
Could not find a configuration file for package "VTK" that is compatible
with requested version "".
The following configuration files were considered but not accepted:
D:/Development/Libraries/VTK9.1/lib/cmake/vtk-9.1/vtk-config.cmake, version: 9.1.0 (64bit)
This suggests that the vtk library is built under 64bit, but I'm trying to find the packages under a different architecture?(in this case, x86)
I tried to set the platform
SET(CMAKE_GENERATOR_TOOLSET host=x64)
as suggested here https://cmake.org/cmake/help/v3.8/generator/Visual%20Studio%2015%202017.html
but it doesn't seem to resolve the issue. There are similar questions posted here and here
that suggested changing architecture to amd64 in toolchain setting. I've already done that and it didn't help.
My question is:
How can I make sure visual studio uses x64 architecture instead of x86 for build?
Thanks.
Please sign in to leave a comment.
Hello!
If “Architecture” is set to “amd64” in the toolchain settings and the corresponding compilers are used, the resulting executable will be x64. Here is an illustration of this on a default "Hello, World!" project (`File | New Project` > `C++ Executable` > `Create`) :
Also I'm not sure the warning is related to the architecture. Please add
message("${VTK_DIR}")
to your CMakeLists.txt, then doTools | CMake | Reset Cache and Reload Project
, and share the entire output from the CMake tool window.Anna Falevskaya Hi Anna,
Thanks for reply. I tried to create a template as you suggested, it doesn't even build successfully, not to mention running. Here's the log:
by default clion uses Ninja as generator, but even if I use VS2017 as generator, it's the same result.
Regards
Finally I figured out what happened. The toolchain setup is correct, the error occured becaue the file
is being encrypted, thus causing read failure.
Thanks for your help.