microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
164.4k stars 29.33k forks source link

Escaped string argument in tasks.json ignored by compiler (objectively the same command with different results) #200803

Closed stlinkgangs closed 10 months ago

stlinkgangs commented 11 months ago

Type: Bug

Use a project that has libs with dots in the name (e.g. wxWidgets wx-3.2. ) Compiler commands would include here for instance: -l"wxtiff-3.2" -l"wxjpeg-3.2". We have to surround the name with "" otherwise g++ will interpret ".2" as a separate file and fail to compile. This works perfectly when run directly from the Terminal. Problem: When I create a task inside the tasks.json file with the arguments strings "\"-lwxtiff-3.2\"" and run the task, g++ sees the dot as a separate file, it then fails of course and vscode switches from debug tab to console and reruns the same command for me, where it executes successfully. The debug command was exactly the same as the one entered in the terminal but there where two different results.

VS Code version: Code 1.85.0 (af28b32d7e553898b2a91af498b1fb666fdebe0c, 2023-12-06T20:48:09.019Z) OS version: Windows_NT x64 10.0.19045 Modes:

System Info |Item|Value| |---|---| |CPUs|12th Gen Intel(R) Core(TM) i7-12700H (20 x 2688)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled| |Load (avg)|undefined| |Memory (System)|31.72GB (17.17GB free)| |Process Argv|| |Screen Reader|no| |VM|67%|
Extensions (14) Extension|Author (truncated)|Version ---|---|--- better-comments|aar|3.0.2 vscode-hide-comments|eli|1.9.0 rainbow-csv|mec|3.9.0 vscode-dotnet-runtime|ms-|2.0.0 cmake-tools|ms-|1.16.32 cpptools|ms-|1.19.1 cpptools-extension-pack|ms-|1.3.0 hexeditor|ms-|1.9.12 makefile-tools|ms-|0.7.0 powershell|ms-|2023.11.1 gcc-md|pha|0.0.1 intellicode-api-usage-examples|Vis|0.2.8 vscodeintellicode|Vis|1.2.30 vscode-surround|yat|1.5.0 (1 theme extensions excluded)

executed task: C:\msys64\ucrt64\bin\g++.exe main.cpp -IC:/msys64/ucrt64/lib/wx/include/msw-unicode-static-3.2 -IC:/msys64/ucrt64/include/wx-3.2 -D_FILE_OFFSET_BITS=64 -DWXMSW -LC:/msys64/ucrt64/lib -pipe -mwindows C:/msys64/ucrt64/lib/libwx_mswu_xrc-3.2.a C:/msys64/ucrt64/lib/libwx_mswu_qa-3.2.a C:/msys64/ucrt64/lib/libwx_baseu_net-3.2.a C:/msys64/ucrt64/lib/libwx_mswu_html-3.2.a C:/msys64/ucrt64/lib/libwx_mswu_core-3.2.a C:/msys64/ucrt64/lib/libwx_baseu_xml-3.2.a C:/msys64/ucrt64/lib/libwx_baseu-3.2.a -l"wxtiff-3.2" -l"wxjpeg-3.2" -l"wxpng-3.2" -l"wxregexu-3.2" -l"wxscintilla-3.2" -l"wxexpat-3.2" -l"wxzlib-3.2" -lrpcrt4 -loleaut32 -lole32 -luuid -llzma -luxtheme -lwinspool -lwinmm -lshell32 -lshlwapi -lcomctl32 -lcomdlg32 -ladvapi32 -lversion -lws2_32 -lgdi32 -loleacc -lwinhttp

C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -l"wxtiff-3.2": No such file or directory C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -l"wxjpeg-3.2": No such file or directory C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -l"wxpng-3.2": No such file or directory C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -l"wxregexu-3.2": No such file or directory
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -l"wxscintilla-3.2": No such file or directory C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -l"wxexpat-3.2": No such file or directory
C:/msys64/ucrt64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -l"wxzlib-3.2": No such file or directory collect2.exe: error: ld returned 1 exit status

executed manually in terminal: g++ main.cpp -IC:/msys64/ucrt64/lib/wx/include/msw-unicode-static-3.2 -IC:/msys64/ucrt64/include/wx-3.2 -D_FILE_OFFSET_BITS=64 -DWXMSW -LC:/msys64/ucrt64/lib -pipe -mwindows C:/msys64/ucrt64/lib/libwx_mswu_xrc-3.2.a C:/msys64/ucrt64/lib/libwx_mswu_qa-3.2.a C:/msys64/ucrt64/lib/libwx_baseu_net-3.2.a C:/msys64/ucrt64/lib/libwx_mswu_html-3.2.a C:/msys64/ucrt64/lib/libwx_mswu_core-3.2.a C:/msys64/ucrt64/lib/libwx_baseu_xml-3.2.a C:/msys64/ucrt64/lib/libwx_baseu-3.2.a -l"wxtiff-3.2" -l"wxjpeg-3.2" -l"wxpng-3.2" -l"wxregexu-3.2" -l"wxscintilla-3.2" -l"wxexpat-3.2" -l"wxzlib-3.2" -lrpcrt4 -loleaut32 -lole32 -luuid -llzma -luxtheme -lwinspool -lwinmm -lshell32 -lshlwapi -lcomctl32 -lcomdlg32 -ladvapi32 -lversion -lws2_32 -lgdi32 -loleacc -lwinhttp Successfull!

vscodenpa commented 11 months ago

Thanks for creating this issue! It looks like you may be using an old version of VS Code, the latest stable release is 1.85.1. Please try upgrading to the latest version and checking whether this issue remains.

Happy Coding!

meganrogge commented 11 months ago

have you tried escaping the .?

vscodenpa commented 10 months ago

This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines.

Happy Coding!