I am trying to debug a sample program in Gnome Builder IDE that is written in C, but there is a pop up each time I am pressing the "Debug" button, that says "Failed to initialize debugger: a suitable debugger could not be found".
I am using Manjaro Linux XFCE, the project is make-based, so no meson.
Here is a part of my makefile:
all: koala
WARNINGS = -Wall
DEBUG = -fno-omit-frame-pointer -g
OPTIMIZE = -O2
koala: Makefile koala.c
gcc -o $# $(WARNINGS) $(DEBUG) $(OPTIMIZE) koala.c -lm
UPD: Tried debugging on some sample project with Meson - it works. Now I want to figure out how to use it with make projects.
Same issue here: have a C++ project I am building with make on gnome-builder 3.38 and no chance to spawn gdb from the UI.
By searching the Gnome forums, it appears that at the time I am writing this answer Builder doesn't know how to execute the final executable/environment through make. Hence it cannot launch GDB.
Meson is the only option to graphically debug in Builder for now and since Builder is very much targeting Gnome applications develoment, hence Meson, I have not seen a clear roadmap to support GDB via make.
Related
I'm trying to make a file into a program on VScode with the Bash terminal, but it reports the above error. I'm relatively new to programming as a whole and trying to follow along with the CS50 course uploaded online; please forgive any incompetence.
below is the entire problem
$ make Hello CC=gcc
g++ Hello.C -o Hello
process_begin: CreateProcess(NULL, g++ Hello.C -o Hello, ...) failed.
make (e=2): The system cannot find the file specified.
make: *** [<builtin>: Hello] Error 2
I installed Git and then downloaded chocolatey because I was missing the "make" cmd and I was then able to use the cmd but thats as far as I got before the aforementioned error showed up.
I've already made sure the file directory is correct in VScode via the explorer (Folder -> Hello.C)
I've been attempting this for a couple hours now and genuinely have no idea how to proceed; any advice is appreciated.
I am under the assumption you are using Windows.
Which is very likely your problem.
Under Windows, C Compilers aren't preinstalled, and the compiler you are trying to use (GCC/G++) is a Linux exclusive. MinGW is the Windows equivalent.
From personal experience, programming C under Windows is a hassle, so I can recommend you use WSL (Windows Linux Subsystem) and the corresponding VSCode extension, wich allows you to code in VSCode under Windows with the Terminal, Code and Filesystem running in Linux.
If you were watching this Video, the Prof is using Github codespaces an online cloud service his code runs on (also Linux).
I want to learn gtk to make GUI using c language I installed all the stuff required as per the website installation guide but then I don't know what to do next how to compile the code, I use atom for writing my c code sometimes also dev c++, so can I set up gtk in atom or dev c++ and compile my code and if not is there any good alternatives for compiling gtk code?
If you are using Dev-C++ (that project is ancient BTW, I would suggest moving on from that) I expect you are working in a Windows environment? I would suggest using MSYS2 for compiling GTK applications in Windows:
https://www.msys2.org/
MSYS uses the Pacman package manager for its shell. You will need to download the following package in order to compile GTK applications in MSYS/MinGW:
pacman -S mingw-w64-x86_64-gtk3
You should also download gcc and pkg-config to compile:
pacman -S pkg-config gcc
Note that pkg-config is generally used to compile GTK applications due to the number of dependencies that are required (Glib, Cairo, etc.). I can't imagine you possibly compiling a GTK application using Dev-C++ as a result. You should add the following line to your .bashrc file (this will be located in the home directory of MSYS):
export PKG_CONFIG_PATH="/mingw64/lib/pkgconfig:$PKG_CONFIG_PATH"
A typical compile line for a GTK application would look like this:
gcc -o <program> <program>.c $(pkg-config gtk+-3.0 --cflags --libs) -rdynamic -lm
I'm building a plugin on Mac OS X using Eclipse CDT, which streams some data via libwebsockets to a browser websocket connection. The compilation process works fine, and I'm able to run my plugin in X-Plane and see data coming in on Google Chrome as expected.
I want to setup debugging with GDB, but I've been pulling my hair for about a week now without any success. I've created a launch configuration in Eclipse CDT to Attach to Application, but every time the debug session is supposed to start, I just get the following in the Eclipse debug perspective:
When starting the Debug, Eclipse shows me a popup list of running processes, and I select X-Plane, but when starting, it simply shows that the thread is suspended.
I've set up the launch configuration as follows:
As an alternative, I tried setting up a project using a makefile, which can be seen here:
https://gist.github.com/josefvanniekerk/690ad22160789c724490
The gcc and linker invocations from Eclipse CDT look as follows:
Building file: ../src/XPWebSocket.c
Invoking: GCC C Compiler
gcc -DAPL=1 -DIBM=0 -DLIN=0 -DXPLM210 -I../lib/xpsdk_v213/CHeaders/XPLM -I../lib/libwebsockets/lib -O3 -g3 -Wall -c -fmessage-length=0 -fvisibility=hidden -MMD -MP -MF"src/XPWebSocket.d" -MT"src/XPWebSocket.d" -o "src/XPWebSocket.o" "../src/XPWebSocket.c"
Finished building: ../src/XPWebSocket.c
Building target: xpwebsocket.xpl
Invoking: MacOS X C Linker
gcc -L../lib/libwebsockets/build/lib -F/{...omitted...}/Projects/xplane/XPWebSocketLib/lib/xpsdk_v213/Libraries/Mac -framework XPLM -shared -o "xpwebsocket.xpl" ./src/XPWebSocket.o -lwebsockets
Finished building target: xpwebsocket.xpl
I've made double sure that I've passed the -g option to enable debugging, but I just can't get this working.
I've tried pointing the C/C++ Application to /Applications/X-Plane/X-Plane.app/Contents/MacOS/X-Plane, changed it to Debug/xpwebsocket.xpl, tried pointing it to the .xpl file inside the X-Plane Resources/Plugins folder, quite frankly, I have no idea what I'm supposed to do to get debugging to work with X-Plane + GDB.
I've started reading up on trying to establish a GDB debug session from the command line, maybe if I understand that process, I can get around to get Eclipse to work. But who knows how many days of reading up that's going to involve.
Can anyone please offer some advice?
More info just in, GDB trace in Eclipse CDT is showing the following (just the error bits):
033,165 &".gdbinit: No such file or directory.\n"
033,165 13^error,msg=".gdbinit: No such file or directory."
037,222 19-target-attach --thread-group i1 197&
037,223 19^error,msg="Asynchronous execution not supported on this target."
After turning off: "Non-stop mode" in CDT, getting the following:
527,581 18^error,msg="Unable to find Mach task port for process-id 197: (os/kern) failure (0x5).\n (\
please check gdb is codesigned - see taskgated(8))"
Guessing I need to codesign X-Plane executable.
I managed to sort this out by signing gdb using the following guide:
http://ntraft.com/installing-gdb-on-os-x-mavericks/
However, fixing the above only reveals that there's possibly a LOT wrong with GDB on Yosemite.
I tried to compile tcc for ARM using gcc 4.6.3 . but I got following error while compiling in both shared/static lib mod :
root#localhost:/p/tcc/tcc# make
gcc -o tcc tcc.o libtcc.so.1.0 -lm -ldl -Wall -g -O2 -fno-strict-aliasing -Wno-pointer-sign -Wno-sign-compare -D_FORTIFY_SOURCE=0 -Wl,-rpath,"/usr/local/lib" libtcc.so.1.0: undefined reference to `vrotb'
collect2: ld returned 1 exit status
make: *** [tcc] Error 1
I am using lastest branch from tcc github
Just checked it on raspberry pi (ARMv6 CPU). https://github.com/TinyCC/TinyCC repository, removed static qualifier from vrotb function in tccgen.c (line 945). It builds and passes 'hello world'.
Since that's obvious mistake likely to be introduced by some change that they forgot to adapt for ARM - i suggest performing further tests to ensure it works as intended. Bug report should be filed - probably on github.
I know it is little confusing, but your problem is that you are using wrong repository. Fabrice Bellard does not work any more on TinyCC (see http://bellard.org/tcc/). He keeps his repositories for personal/historical reasons. However all development has moved to http://repo.or.cz/w/tinycc.git. To confuse things even more the 0.9.26 release from Fabrice's web site is actually from the http://repo.or.cz/w/tinycc.git repository, and not Fabrice's own. But this is all just communication issue. In short you should use new repository. On the repository web site is a link to a mailing list where you should report any problems in case the new repo code does not compile.
I installed Eclipse in fedora and then installed the CDT plugin for developping C/C++ applications . All the installation are done !
So now i can create a C/C++ project but when it comes to running it i got this message
launch failed , Binary not found
and
unable to find full path to gcc.
gcc -O2 -g -Wall -c -fmessage-length=0 -o Rad1.o ../Rad1.c
Internal Builder: Cannot run program "gcc": Unknown reason
Error: Program "gcc" is not found in PATH
Is there any more configuration i must do so C/C++ runs?
Thanks.
Executing c/c++ program with eclipse+unix base plate-forme, it requied object file of the program to execute/run it. So first of all you need to build your program by just pressing Ctr+b to buid it. This will create an object file that was required. Now you enabled to run/execute your programe. Good luck :)