Trouble specifying compiler path in C/C++ extensions in vscode - c

I am coding a c app on a distant server (Using VScode Remote).
I want to specify my sdk compilator to the c/c++ vscode extension in order to make Intellisens working properly.
I have tried to specify the compilator path in the settings.json like this :
{
"C_Cpp.default.compilerPath": "/opt/toolchains/arm-buildroot-linux-gnueabihf_sdk-builroot/bin/arm-linux-gnueabihf-gcc",
"C_Cpp.loggingLevel": "Debug"
}
But in the debug output, it says that it hasn't found the compilator :
Attempting to get defaults from C++ compiler in "compilerPath" property: '/opt/toolchains/arm-buildroot-linux-gnueabihf_sdk-builroot/bin/arm-linux-gnueabihf-gcc'
Specified compiler was not found: /opt/toolchains/arm-buildroot-linux-gnueabihf_sdk-builroot/bin/arm-linux-gnueabihf-gcc
I was expecting it was dealing with rights on the sdk folder but even with chmod 777 it doesn't work.

Related

Windows VSCode C "cannot open source file" from WSL GCC

Currently using VSCode on Windows for development, including C files. However, including unix header files (like <unistd.h>) results in VSCode thinking that there is an error. The current compiler path is "C:/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe" but there is a working GCC installed in WSL which is the main compiler I want to use.
Using wsl gcc to compile files works and the files run normally. There is an option for "Compiler path" and "Include path" in the Microsoft C/C++ Extension, but WSL paths (such as "\wsl.localhost", "//wsl$/Ubuntu/", "/usr/local" etc.) are not recognised by either option. Opening another VSCode window in WSL remote mode works, but doing that just for C files specifically is very slow. Is there a way to specify a configuration for non WSL VSCode windows to use the WSL GCC compiler for C code analysis?
The most important thing to do is set the compiler path.If you do that, you won't need to manually set the system to include paths and defines.
VS Code Website

i have added path to C:\MinGW\bin' but it's not recognized when i type gcc "file name"

For best explaination pls look at img.
Being new i installed VS Code (added path), installed MinGW minimalist, applied changed by marking everything in installation ,copied the path in environment variable, interestingly i can't open gcc by clicking on it. if i go to Windows powershell and try to run (in admin mode) it gives fatal error but i type ar then it opens.if i type C:\MinGW\bin then it doesn't recognizes it. Upon removing the path of gcc, it doesn't shows fatal error when i type it's path and not recongnizable when i type gcc.Is there a way to fix it? i watch tutorials but they didn't help even tho i followed them step by step.Some of my environment variable were different from the varibale excluding C:MinGW\bin.BTW pls tell ans in ez way because i just installed C as my 1st programming language.
Here are the correct steps:
add C:\MinGW\bin to the PATH environment variable
open a new Powershell or Command Prompt (not an existing one, and don't Run As Administrator) and type gcc --version)
open VSCode and make sure the compiler is configured properly, see also: https://code.visualstudio.com/docs/cpp/config-mingw
MinGW is old, I recommend using newer MinGW-w64 which is much more up to date and support both 32-bit and 64-bit Windows. You can get a standalone version from https://winlibs.com/

C - Not able to run a C program in any IDE (Tried with Netbeans and VSCode)

I installed MinGW compiler to run a C/C++ program. When I check the compiler version it shows this:
This is my MinGW directory:
This is my PATH setting:
I have set my PATH environment variable as follows:
%SYSTEMROOT%\System32\WindowsPowerShell\v1.0;C:\MinGW\bin;C:\MinGW\MSYS\1.0\bin;
Whenever I run my C/C++ project in Netbeans, it's giving me below error even though my program build is getting successful:
Please help me to fix this issue.

Eclipse CDT using CygwinGCC toolchain cannot debug if app links with dll?

Why wouldn't my Eclipse CDT find an x.dll where I specified via
C C++ General/Paths and Symbols/Libraries (this is the lib name without extension x)
C C++ General/Paths and Symbols/Library Paths (this is full path to dll)?
I'm on Windows 8.1, using CygwinGCC toolchain, debugging via gdb.
The app.exe is built OK, Eclipse project seems to see the dll at this point (for example, if I misspell the dll name, it complains and fails to build). However, when I try to debug the app, I get an ugly unhandled exception message right at startup.
When I manualy copy the needed x.dll to sit in the same directory as app.exe, then I can debug with no problems.

ntddk.h no such file or directory

I am using CODE::BLOCKS in windows XP. Tried to write a device driver. But right after creating a project, I got below error. I did below settings, but still getting the error as
"ntddk.h no such file or directory". I have tried with all compilers (Project built option), but it is still there.
Please help.
Created the project like:- File->New->Project->Kernel Mode Driver->Next->Next...
If, like most people using Code::Blocks on Windows, you use MingW-TDM (commonly detected as "GNU GCC Compiler" by Code::Blocks, and bundled with the "easy install" package), the file ntddk.h is located in the ddk subfolder of the system include folder.
Thus, you either have to add the ddk folder to the include search path, or write #include <ddk/ntddk.h>, either will work.
Your list of compilers does not seem to include the DDK compiler
Do you have the windows DDK installed?
NOTE: I know nothing about codeblocks but you will need the DDK compiler to compile windows drivers.

Resources