I'm trying to compile a file as x86 but I keep getting this error: (Main.obj : fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'x86')
I set up my build task accordingly as such:
{
"version": "2.0.0",
"tasks": [
{
"type": "shell",
"label": "C/C++: cl.exe build active file",
"command": "CL",
"args": [
"/D WIN32",
"${file}",
"\"C:\\Users\\Axair\\Desktop\\VScode\\OpenGL\\GLFW\\lib-vc2022\\glfw3.lib\"", // 32 bit library
"/link",
"/MACHINE:X86"
],
"presentation": {
"showReuseMessage": false,
"clear": true,
"close": false
},
"problemMatcher": [
"$msCompile"
],
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
Console output looks like this:
C:\Users\Axair\Desktop\VScode\OpenGL>cl /D WIN32 "C:\Users\Axair\Desktop\VScode\OpenGL\Main.cpp" "C:\Users\Axair\Desktop\VScode\OpenGL\GLFW\lib-vc2022\glfw3.lib" /link /MACHINE:X86
Microsoft (R) C/C++ Optimizing Compiler Version 19.32.31332 for x64
Copyright (C) Microsoft Corporation. All rights reserved.
Main.cpp
Microsoft (R) Incremental Linker Version 14.32.31332.0
Copyright (C) Microsoft Corporation. All rights reserved.
/out:Main.exe
/MACHINE:X86
Main.obj
C:\Users\Axair\Desktop\VScode\OpenGL\GLFW\lib-vc2022\glfw3.lib
Main.obj : fatal error LNK1112: module machine type 'x64' conflicts with target machine type 'x86'
The compiler keeps recognizing Main.obj as an x64 module despite the specified WIN32 option.