Closed utherbone closed 1 year ago
Have you verified that your GCC works in general?
What happens if you execute this by hand in the CMD?
C:\Users\Utherbone\Documents\VSCODE\projetos/msys64/ucrt64/bin/gcc -Wall -Wextra -Wpedantic -Wshadow -Wformat=2 -Wcast-align -Wconversion -Wsign-conversion -Wnull-dereference -O3 -DNDEBUG -c c:\Users\Utherbone\Documents\VSCODE\projetos\main.c -o .\build\Release\main.o && C:\Users\Utherbone\Documents\VSCODE\projetos/msys64/ucrt64/bin/gcc -Wall -Wextra -Wpedantic -Wshadow -Wformat=2 -Wcast-align -Wconversion -Wsign-conversion -Wnull-dereference -O3 -DNDEBUG .\build\Release\main.o -o .\build\Release\outRelease.exe
Haven't tested outside of Visual Studio Code or VSCodium
Have you verified that your GCC works in general? Result in any path:
PS C:\Users\Utherbone\Documents\VS_CODE_DEV\VSCODE_dev\projetos> msys64\ucrt64\bin\gcc.exe gcc.exe: fatal error: no input files compilation terminated. PS C:\Users\Utherbone\Documents\VS_CODE_DEV\VSCODE_dev\projetos> msys64\ucrt64\bin\gcc.exe main.c -o test.exe PS C:\Users\Utherbone\Documents\VS_CODE_DEV\VSCODE_dev\projetos> ls
Diretório: C:\Users\Utherbone\Documents\VS_CODE_DEV\VSCODE_dev\projetos
Mode LastWriteTime Length Name
d----- 05/10/2023 00:30 .vscode d----- 05/10/2023 01:07 .vscode_clang d----- 05/10/2023 01:07 .vscode_gcc d----- 05/10/2023 00:42 build d----- 05/10/2023 00:04 msys64 -a---- 05/10/2023 04:27 93 main.c -a---- 05/10/2023 04:50 135221 main.exe
PS C:\Users\Utherbone\Documents\VS_CODE_DEV\VSCODE_dev\projetos>
Result in path parent of gcc executable:
PS C:\Users\Utherbone\Documents\VS_CODE_DEV\VSCODE_dev\projetos> cd msys64\ucrt64\bin\
PS C:\Users\Utherbone\Documents\VS_CODE_DEV\VSCODE_dev\projetos\msys64\ucrt64\bin> ./gcc ../../../main.c -o testxx
PS C:\Users\Utherbone\Documents\VS_CODE_DEV\VSCODE_dev\projetos\msys64\ucrt64\bin> ./testxx
Hello 2023
PS C:\Users\Utherbone\Documents\VS_CODE_DEV\VSCODE_dev\projetos\msys64\ucrt64\bin> ls *txx.exe
Diretório: C:\Users\Utherbone\Documents\VS_CODE_DEV\VSCODE_dev\projetos\msys64\ucrt64\bin
Mode LastWriteTime Length Name
-a---- 06/10/2023 01:06 133341 testxx.exe
PS C:\Users\Utherbone\Documents\VS_CODE_DEV\VSCODE_dev\projetos\msys64\ucrt64\bin>
> What happens if you execute this by hand in the CMD?
>
> C:\Users\Utherbone\Documents\VSCODE\projetos/msys64/ucrt64/bin/gcc -Wall -Wextra -Wpedantic -Wshadow -Wformat=2 -Wcast-align -Wconversion -Wsign-conversion -Wnull-dereference -O3 -DNDEBUG -c c:\Users\Utherbone\Documents\VSCODE\projetos\main.c -o .\build\Release\main.o && C:\Users\Utherbone\Documents\VSCODE\projetos/msys64/ucrt64/bin/gcc -Wall -Wextra -Wpedantic -Wshadow -Wformat=2 -Wcast-align -Wconversion -Wsign-conversion -Wnull-dereference -O3 -DNDEBUG .\build\Release\main.o -o .\build\Release\outRelease.exe
Rsesult:
PS C:\Users\Utherbone\Documents\VS_CODE_DEV\VSCODE_dev\projetos> C:\Users\Utherbone\Documents\VSCODE\projetos/msys64/ucrt64/bin/gcc -Wall -Wextra -Wpedantic -Wshadow -Wformat=2 -Wcast-align -Wconversion -Wsign-conversion -Wnull-dereference -O3 -DNDEBUG -c c:\Users\Utherbone\Documents\VSCODE\projetos\main.c -o .\build\Release\main.o && C:\Users\Utherbone\Documents\VSCODE\projetos/msys64/ucrt64/bin/gcc -Wall -Wextra -Wpedantic -Wshadow -Wformat=2 -Wcast-align -Wconversion -Wsign-conversion -Wnull-dereference -O3 -DNDEBUG .\build\Release\main.o -o .\build\Release\outRelease.exe No linha:1 caractere:270
PS C:\Users\Utherbone\Documents\VS_CODE_DEV\VSCODE_dev\projetos>
PS C:\Users\Utherbone\Documents\VS_CODE_DEV\VSCODE_dev\projetos> C:\Users\Utherbone\Documents\VSCODE\projetos/msys64/ucrt64/bin/gcc -Wall -Wextra -Wpedantic -Wshadow -Wformat=2 -Wcast-align -Wconversion -Wsign-conversion -Wnull-dereference -O3 -DNDEBUG -c c:\Users\Utherbone\Documents\VSCODE\projetos\main.c -o .\build\Release\main.o && C:\Users\Utherbone\Documents\VSCODE\projetos/msys64/ucrt64/bin/gcc -Wall -Wextra -Wpedantic -Wshadow -Wformat=2 -Wcast-align -Wconversion -Wsign-conversion -Wnull-dereference -O3 -DNDEBUG .\build\Release\main.o -o .\build\Release\outRelease.exe
No linha:1 caractere:270
+ ... Documents\VSCODE\projetos\main.c -o .\build\Release\main.o && C:\User ...
+ ~~
O token '&&' não é um separador de instruções válido nesta versão.
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : InvalidEndOfLine
PS C:\Users\Utherbone\Documents\VS_CODE_DEV\VSCODE_dev\projetos>
This is PowerShell and not CMD
CMD Test 1
C:\Users\Utherbone\Documents\VS_CODE_DEV\VSCODE_dev\projetos>C:\Users\Utherbone\Documents\VSCODE\projetos/msys64/ucrt64/bin/gcc -Wall -Wextra -Wpedantic -Wshadow -Wformat=2 -Wcast-align -Wconversion -Wsign-conversion -Wnull-dereference -O3 -DNDEBUG -c c:\Users\Utherbone\Documents\VSCODE\projetos\main.c -o .\build\Release\main.o && C:\Users\Utherbone\Documents\VSCODE\projetos/msys64/ucrt64/bin/gcc -Wall -Wextra -Wpedantic -Wshadow -Wformat=2 -Wcast-align -Wconversion -Wsign-conversion -Wnull-dereference -O3 -DNDEBUG .\build\Release\main.o -o .\build\Release\outRelease.exe
O sistema não pode encontrar o caminho especificado.
C:\Users\Utherbone\Documents\VS_CODE_DEV\VSCODE_dev\projetos>
CMD Test 2
C:\Users\Utherbone\Documents\VS_CODE_DEV\VSCODE_dev\projetos>C:\Users\Utherbone\Documents\VS_CODE_DEV\VSCODE_dev\projetos\msys64\ucrt64\bin\gcc -c main.c -o teste.exe
C:\Users\Utherbone\Documents\VS_CODE_DEV\VSCODE_dev\projetos>dir
O volume na unidade C não tem nome.
O Número de Série do Volume é F0DB-33E0
Pasta de C:\Users\Utherbone\Documents\VS_CODE_DEV\VSCODE_dev\projetos
06/10/2023 04:43 <DIR> .
05/10/2023 00:16 <DIR> ..
05/10/2023 00:30 <DIR> .vscode
05/10/2023 01:07 <DIR> .vscode_clang
05/10/2023 01:07 <DIR> .vscode_gcc
05/10/2023 00:42 <DIR> build
05/10/2023 04:27 93 main.c
05/10/2023 04:50 135.221 main.exe
05/10/2023 00:04 <DIR> msys64
06/10/2023 04:43 168 NL891833388BR_.txt
3 arquivo(s) 135.482 bytes
7 pasta(s) 82.285.547.520 bytes disponÃveis
C:\Users\Utherbone\Documents\VS_CODE_DEV\VSCODE_dev\projetos>
CMD Test 3 Result in path parent of gcc executable:
C:\Users\Utherbone\Documents\VS_CODE_DEV\VSCODE_dev\projetos>cd msys64\ucrt64\bin\
C:\Users\Utherbone\Documents\VS_CODE_DEV\VSCODE_dev\projetos\msys64\ucrt64\bin>./gcc ../../../main.c -o testxxT
'.' não é reconhecido como um comando interno
ou externo, um programa operável ou um arquivo em lotes.
C:\Users\Utherbone\Documents\VS_CODE_DEV\VSCODE_dev\projetos\msys64\ucrt64\bin>gcc ../../../main.c -o testxxT
C:\Users\Utherbone\Documents\VS_CODE_DEV\VSCODE_dev\projetos\msys64\ucrt64\bin>dir *estxxT.exe
O volume na unidade C não tem nome.
O Número de Série do Volume é F0DB-33E0
Pasta de C:\Users\Utherbone\Documents\VS_CODE_DEV\VSCODE_dev\projetos\msys64\ucrt64\bin
07/10/2023 03:43 133.341 testxxT.exe
1 arquivo(s) 133.341 bytes
0 pasta(s) 82.288.644.096 bytes disponÃveis
C:\Users\Utherbone\Documents\VS_CODE_DEV\VSCODE_dev\projetos\msys64\ucrt64\bin>testxxT.exe
Hello 2023
C:\Users\Utherbone\Documents\VS_CODE_DEV\VSCODE_dev\projetos\msys64\ucrt64\bin>
What I noticed is that if I go to where GCC is using CMD, PS, ZSH (mysys2) it does not create an output, it compiles because it does not display any error, but it does not produce an output, if it is already executed while it is Inside its directory, when executed, it produces output.
That's very strange. I'm using Windows 11
Note, Clang works every way I've tried.
[UPDATED] I was sleeping through the keyboard and keyboard and keyboard and I ended up closing it and reopening it.
Sorry i dont really get your last comment.
So it works for absolute paths but not for relatives?
Ok, I apologize, I was in a hurry because I'm still studying at university, there are times when it's stressful. had accidentally fallen asleep sitting in front of the computer and typing on keyboard in closing the issue
That's right, if I use direct or relative paths, it doesn't work, but if I open the windows shell CMD, PwerSehll, or any other and use the CD command in the directory where gcc is, it produces an output, does the build.
The strange thing is that otherwise it doesn't display any message
Now I'm reviewing it and what I wrote was really confusing. in the previous comment
Okay, then please only use absolute paths.
I've always used clang, so I don't know if the problem is a bug in the extension or vscode. A friend asked me to create an environment to use visual studio code configured with gcc to run without him needing to install gcc and visual studio code on his machine.
So I took the project I had with CLANG and just changed the executables to gcc and gdb and my return is always 1 and gcc doesn't seem to be working, follow in detail the configurations with clang working and gcc not working.
CONFIG Files Clang: c_cpp_properties.json
launch.json
settings.json
BUILD Clang
RUN Compiled by clang
<----------------------------------------------------------->
Now gcc configuration c_cpp_properties.json
launch.json
settings.json
BUILD Clang
RUN Compiled by clang
The executable is not yet built.
I'm using Msys2 and its folder is inside the working folder of the project opened in Visual Studio Code.