빨간색 에러들

[Visual Studio] error: lnk1112 module machine type x64....

vhxpffltm 2022. 5. 25. 20:54
반응형

32비트 바이너리를 매일 빌드하는데...

 

최근 사내 업데이트로 바이너리를 x64 비트로 빌드해야 하는 작업을 하고 있다.

 

VS code에서는 configuration을 아래 그림과 같이 편하게 잡아주기 때문에? 

금방 작업할 수 있는데...

 

 

Visual Studio는 상단에 실행 / 디버그 쪽에 x64를 체크하면 되는걸로 알고있다.

 

하지만!? 없는 경우가 있었고 임의로 사용 확장 가능한 아키텍처를 임의로 고르다 보니 여러 이상해졌다.

 

 

구성 관리자가 Win32 밖에 없었고... 뭐 새로 추가해서 마음대로 하니 빌드가 안돼고 이상해졌다.

 

그래서 프로젝트 속성(C/C++ , 링커)과 솔루션 속성에 들어가서 확인해봤는데 별로 문제가 없어보였다.

명령줄에 machine 옵션, 솔루션 구성 설정에 들어간 라이브러리 등 x64환경에 맞게 들어 있었다...

 

문제는 Cmake configure에서 잘못되었다. 

 

Visual Studio로 Configure할때, 이미 아키텍처가 Win32여서 이 프로젝트를 WIn64로 바꾸려면 하나씩 모든걸 수정해야했다.

 

Cmake에 -A 아키텍처 옵션으로 x64를 사용하면 된다.

 

Cmake -S . -B build -A x64 -G "visual studio 2017" 과 같이 말이다.

 

https://stackoverflow.com/questions/3563756/fatal-error-lnk1112-module-machine-type-x64-conflicts-with-target-machine-typ

 

fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'X86'

I'm using CUDA (VC++, Visual studio 2008sp1) to debug a FEM program. The program can only run on a Win32 platform, for the insufficiency of cuda. I think the library files linked are all compiled o...

stackoverflow.com

 

https://stackoverflow.com/questions/28350214/how-to-build-x86-and-or-x64-on-windows-from-command-line-with-cmake

 

How to build x86 and/or x64 on Windows from command line with CMAKE?

One way to get cmake to build x86 on Windows with Visual Studio is like so: Start Visual Studio Command prompt for x86 Run cmake: cmake -G "NMake Makefiles" \path_to_source\ nmake One way to get ...

stackoverflow.com

 

 

반응형