KDevelop not executing Hello World program - kdevelop

I am using KDevelop 4.6.0 on Ubuntu 14.04.
At one point I saw the output of my hello world program, but now I can build it, but not execute it. That is, if I press the Execute button I am presented with a Launch Configurations dialog which gives me a choice of either a Global configuration or a PlayingAround configuration (my project name). However, no matter which configuration is chosen, nothing happens. No error message, no output, nothing.

Click on that "Add New..." button at the left-top corner. This would allow you to create a launch for any targets created with add_executable from CMake as well as arbitrary executable target.

Related

VSCode issues when running a C file and displaying output

I'm trying to run C programs/files from VSCode. I've followed a guide to setting up the gcc for VSCode to use, and it "mostly" works. However, when I run a file, it only outputs to the debug console, which is rather messy. I would prefer if it only output to the "output" window.
If I click on the output window and then try to run the file, I get this error.
This is what my tasks.json file looks like, where I've tried to change build from cppbuild to shell, as well as removing the "file" lines that I saw recommended on other threads, which didn't solve my issue.
Also notice how in the drop down menu for my panel, I don't have a "Code" option that I see in other people's VSCode
TLDR: I want VSCode to display the output of a C file into the Output window, not the debug console. I also want to understand why I am given the "Cannot build and debug because the active file is not a C or C++ source file" error. MinGW has been downloaded and GCC has been set up properly, AFAIK.
Have you installed "Code Runner" extension?

KDevelop 5.2.1 - Hello World Launch Configurations

I´m using KDevelop 5.2.1 on Ubuntu 16.04. I created a new C++ project, default with the Hello World example. For execution I need to start the launch configurations, but I don´t know, which launch configuration to choose.
I tried the Compiled Binary, the result was "Failure: /home/.../HelloWorld/build/install has failed to start". Same for Script Application and install also leads to an error.
With KDevelop 4.7.3 there was a different option in the launch configurations (the name of the project), see the Screenshot.
The option "helloworldkdev4" works fine, the program executes and shows "Hello, world!".
So which launch configuration in KDevelop 5.2.1 I need to choose to execute my Hello World example?
The "Compiled binary" option requires you to select an executable target. Selecting "helloworldkdev4" in your case is just a shortcut for "Compiled binary" case and "helloworldkdev4" target.

How can I set KDevelop to compile codes with gcc properly?

I just downloaded KDevelop from Ubuntu Software Center, and have gcc.
I want to see anything happens by pressing F9 but KDevelop says I need to configure a launcher first. And all I know about the setting window is I have to put 'gcc' in somewhere on the window, as well as path to the source code file and path to the executable file it will make.
I have no any knowledge about this window, no any syntax to use in it and can't find it anywhere on the web. Now I desperately require some help. I want to make KDevelop to compile and debug with already-installed gcc and gdb.
It asks you of which executable to debug. You, i suppose, don't want to debug gcc, so you should set this field to your executable. You can also select Project Target option, and choose CMake target that corresponds to your executable.
This step happens after the build step. Make sure your build process is working first (F8).
The window above lets you select which executable in your project should be run when the launch button is pressed.
If your project is created in KDevelop or otherwise uses CMake as the build system, this should be configured by default and use the "target" part of the dialog.
Otherwise the executable should point to the executable you created as part the build process that you want to test.

error compiling C code in Eclipse

I am new to using Eclipse and CDT and have been trying to get my C code to compile. When I Run As Local C Application, it returns an error message Launch Failed. Binary Not Found. I have MinGW-w64 in C:\mingw-w64. The program compiles and runs fine using gcc via cmd.
I would appreciate if eclipse-proficient users can help out with a how-to. Thanks!
Sometimes, if you try to launch first (before binary has been compiled) eclipse creates launch configuration automatically, that has no binary associated. Later even if you compiled your project (you do this using project/build or hammer icon), it will not associate binary automatically, as it tries to launch your old launch configuration. So:
make sure one of projects source files are selected (in editor for example)
click a down arrow next to bug icon
select debug configurations
select C/C++ application and click on "new launch configuration icon"
If C/C++ application field of your new launch configuration is empty, select search project or browse and tell it where your binary is
optionally set other launch/debug options
launch your new launch configuration using "Debug" button or from "bug" menu

How to stop GDB from executing "break main" by default in Eclipse?

I'm working on a C project with Eclipse and MinGW. When running a debug build of this project, gdb always breaks on entering main(). I can see why this could be useful, but for my current project I don't want that to happen.
I've read that there is a command
(gdb) break main
which will accomplish the same behavior when running from the command line.
At the moment I do NOT have a .gdbinit file.
At the moment gdb doesn't stop on entering main when running from the command line, but it does when running from Eclipse.
How do I make GDB stop breaking on entering main by default within Eclipse?
Make sure you are in the c++ perspective, then go to menu Run -> Debug Configurations. Make sure your application is chosen in the left pane, press the Debugger tab, and uncheck Stop on startup at: checkbox.
EDIT: you can see a screen-shot here: Method/Function Breakpoints in Eclipse CDT
To set it for any new launch, On the menu Window->Preferences, Select C/C++->Debug->GDB item on the left, and then go to the Debug Configurations Defaults section and uncheck the "Stop at startup at:" checkbox on CDT 8.0 or later.
You can see the details here: How do I prevent the debugger from stopping on the first line?

Resources