Closed toninlg closed 2 years ago
Hi @toninlg . I recommend installing a recent version of Visual Studio instead of "Windows SDK 7.1". It looks like you are trying to use a version of cl.exe
included with Visual Studio 2010, which is rather old and no longer supported by the C/C++ extension for VS Code.
I assume you used the build and debug active file
feature of the C/C++ extension, to generate your tasks.json
. It looks like the /Fe:
arg was not supported in that older version of cl.exe
. I suspect you could modify your tasks.json
by removing the /Fe:
and subsequent arg. However, for the best experience, I'd suggest installing a more recent version of Visual Studio, such as Visual Studio 2022 Community Edition.
Hi. I used "Configure default build task" from terminal to generate tasks.json. On newer compiler :
Hi @toninlg . We could make a change to use the /Fe<file>
syntax whenever generating a tasks.json
, to support older compilers.
The tasks.json
is used to essentially just issue a command line. If you run the same command line directly, you should get the same result. Can you determine what the correct command line is to successfully compile and link with the compiler you are using? If you could let me know what that is, I could investigate making changes to how the tasks.json
is generated, to accommodate.
Here is the modification I had to do to compile with Windows SDK 7.1 (SDK version is not picked up and not recognized because of the regex but it's the version number given by WindowsSdkVer.exe, so LIBPATH has to be set to find kernel32.lib):
c_cpp_properties.json
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**",
"C:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\include"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"cStandard": "c89",
"cppStandard": "c++98",
"intelliSenseMode": "windows-msvc-x86",
"compilerPath": "c:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\bin\\cl.exe",
"windowsSdkVersion": "7.1.7600.0.30514"
}
],
"version": 4
}
tasks.json
{
"version": "2.0.0",
"tasks": [
{
"type": "cppbuild",
"label": "C/C++: cl.exe build active file",
"command": "cl.exe",
"args": [
"/Zi",
"/EHsc",
"/nologo",
"/Fe${fileDirname}\\${fileBasenameNoExtension}.exe",
"${file}",
"/link",
"/LIBPATH:C:/Program Files/Microsoft SDKs/Windows/v7.1/Lib"
],
"options": {
"cwd": "${fileDirname}"
},
"problemMatcher": [
"$msCompile"
],
"group": {
"kind": "build",
"isDefault": true
},
"detail": "compiler: cl.exe"
}
]
}
Is there somewhere a list of supported Visual Studio version?
Hey @Colengms, this issue might need further attention.
@toninlg, you can help us out by closing this issue if the problem no longer exists, or adding more information.
Bug type: Language Service
Describe the bug
main.c
LINK : fatal error LNK1181: cannot open input file 'C:\Home\Public\test\main.exe'
Build finished successfully.
{ "configurations": [ { "name": "Win32", "includePath": [ "${workspaceFolder}/**", "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include" ], "defines": [ "_DEBUG", "UNICODE", "_UNICODE" ], "cStandard": "c89", "cppStandard": "c++98", "intelliSenseMode": "windows-msvc-x86", "compilerPath": "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\cl.exe" } ], "version": 4 }
{ "type": "cppbuild", "label": "C/C++: cl.exe build active file", "command": "cl.exe", "args": [ "/Zi", "/EHsc", "/nologo", "/Fe:", "${fileDirname}\${fileBasenameNoExtension}.exe", "${file}" ], "options": { "cwd": "${fileDirname}" }, "problemMatcher": [ "$msCompile" ], "group": { "kind": "build", "isDefault": true }, "detail": "compiler: cl.exe" }