Eclipse - "Launching 'KeyInPlaintext' Debug has encountered a problem. Error starting process." - c

I am currently attempting to compile and run a C program in eclipse. The problem is, every time I attempt to run a program, the same error shows up.
The image shows the error that is displayed. I am not sure what to get out of that error.
I currently have cygwin installed, and am able to run gcc and g++ on the command prompt. I also have PE Windows Parser and Cygwin PE parser enabled under Binary Parsers. I have also cleaned and built the project many times over.

Related

"Availability status: error" for working C programs

I recently learned about Visual Studio Code & Intellisense and am currently writing code on that and trying to compile it using Cygwin. However, I'm never able to do it.
I have added C:\cygwin64\binand%systemdrive%:\cygwin\bin` to my system environment variables in settings. I'm doing this on a Windows 11 computer. But every time I try to compile a program, like:
gcc HelloWorld.c
I get:
cc1: fatal error: HelloWorld.c: No such file or directory
compilation terminated.
In file explorer, all the programs I'm trying to compile say "Availability status: error". Specifically, any programs (regardless of language) I have downloaded onto my computer hard drive are apparently unavailable. What does this mean?
I tried using MSYS Mingw-w64 but the same problem happens. I thought that I might not have included the "gcc-core" compiler file when I downloaded it, so i did that again with the file but nothing. I typed "gcc --version" and "gdb -- version" to check and debug but the same messages pop up, both for Cygwin and Mingw.
I tried using other text editors (notepad and vim) to type, but they didn't have any effect. I thought they might create compileable, "available" files on file explorer.

Can't launch debug - C in VS code on Linux

Let me preface this, I am very new to linux and to working on a non-IDE based setup.
I am trying to debug a very simple C program using vs code version 1.55
I unloaded all modules beforehand, so vs code can load appropriate default gcc & gdb versions (which it did, GCC 8.2)
I am following the VS code getting started documentation for setting up and everything seems very straight forward until I try to debug.
I use the default settings as instructed, the file builds successfully but then I get the below
/usr/bin/gdb: symbol lookup error: /usr/bin/gdb: undefined symbol: PyUnicodeUCS4_FromEncodedObject
please note that I cannot rebuild python with ucs4 enabled as suggested in another thread as I have no root access. however I can change VS code version to an earlier one if this will help.
Thanks.
I think this issue is specific to my environment but I will post the answer anyway as it may face someone else.
So this for me was 2 separate issues:
First gdb doesn't start and second vs code can't start gdb.
To check if this is the case try to launch gdb from terminal (not vs code) by typing gdb in the terminal (after loading gdb if needed), I was receiving the error above
Solution to this part is this as T0maas thankfully suggested above
Steps for linux newbies:
ldd gdb (or /usr/bin/gdb) (with vs_code loaded)
from step one get the python library path
unload all modules
load gdb
LD_PRELOAD=<python path from 1>
bash -c "export LD_PRELOAD"
load vs_code
load gdb
After the above steps writing gdb in the terminal should start gdb
Part 2:
The rest of the problem was when I tried to launch debugging session through the GUI of vs_code (still produced the same error)
In the terminal (after loading gdb) type whereis gdb
For me this produced multiple directories the first of which was /usr/bin/gdb (this is the default used in vs_code launch.json)
Changing that directory in the launch.json file to a different one of the other directories solved the second part of the problem for me.

Not able to execute the .exe file generated from GCC compiler

I am working on creating a system in C language and I have installed GCC compiler via MinGW Installer. After this, I created a basic Hello World program to check if the compiler is working properly. I compiled my code using the command gcc hello.c -o hello and then tried to run the executable file thus created by typing hello into the command prompt. But the system is not running my .exe file and giving an error - The system cannot execute the specified program.
I repeated the whole process on my second system, step by step, and I was able to see the output for the same program on the command prompt without any error.
I am not able to understand the exact reason behind this but I suspect it has something to do with the permission to execute a .exe file.
Open your .exe file with Dependancy Walker (https://www.dependencywalker.com/). It will tell you if there is something wrong with the file.
Also you should be able to see there if it's 32-bit or 64-bit. In case of 64-bit it won't run on your system if you're on a 32-bit Windows.
You could also try with MinGW-w64 built from http://winlibs.com/ (try the 32-bit version first) and follow the hello world instructions on that site.

OSX Eclipse CDT stalls at the start of debugging: "Configuring GDB"

I have installed Eclipse CDT and GDB.
I created a simple "Hello World" C project.
When I try to debug the project, GDB starts to behave very chaotic: I am able to debug a few times, step through the code, etc., but then it starts stalling at the begining of the next debug session with the message "Configuring GDB".
After I restart Eclipse CDT sometimes I still cannot debug, and sometimes I can, but also just for a few times, and then again the same problem comes up: stalls with "Configuring GDB" message.
I have tried hard to find the pattern, but failed.
What could be the reason for such a chaotic behaviour?
p.s.
I forgot to mention that I did sign the /usr/local/bin/gdb executable (and verified it with codesign --verify --verbose gdb).
Edit:
The screenshot shows the 2 stuck sessions:

Running .exe in cygwin opens windows console with MapViewOfFileEx error, how do I fix this?

I'm trying to run programs I've compiled with GCC. When I run them through cygwin, a windows terminal opens for a couple of miliseconds (or so) giving off the error:
fatal error - MapViewOfFileEx shared 5'(0x66). win32 error 6. Terminating
It's followed by a stack trace. (this was the best shot, had to use video camera)
It doesn't seem to affect the programs but since it's a "fatal error" I suppose it would be good to fix. I tried googling the error, and found that multiple cygwin1.dll in the path shown when running the command
cygcheck -s
could be the cause, but I only found 1 cygwin1.dll.
The problem could have come from when I tried to open a cygwin-created executeable in windows and I read that I should copy the cygwin1.dll into my windows-folder but I simply deleted it after realizing that I needed several more files (libraries).

Resources