KDevelop 5.2.1 - Hello World Launch Configurations - kdevelop

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.

Related

KDevelop not executing Hello World program

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.

Eclipse C/C++ project on Bash on Ubuntu on Windows

I've installed Eclipse Neon (v4.6). Also, I have "Bash on Ubuntu on Windows" (Sept '16). I installed gcc and gdb for compiling and debugging in C. I tested them on terminal and they're running.
I'm trying to use Eclipse to create a new C project but in the compiler selection stage it doesnt give me the option to use the "Bash on Ubuntu on Windows" compiler.
Is there any way to solve my problem?
Because Bash/WSL is pretty new and the ability to correctly invoke Linux commands from outside Bash (using bash.exe -c ...) is not well understood by many dev tools (yet), you may have to do some work to define custom tasks/actions to call the necessary bash.exe -c "gcc ..." commands that you want to invoke.
However, you should absolutely be able to write/configure a makefile (or, perhaps even better, a CMake file) which can switch paths to lib/include/tools/etc. based on environment and then build smoothly on Windows or in Linux.
This very scenario has sparked an idea for a cool blog post that I'll work on and publish to our blog https://blogs.msdn.microsoft.com/commandline in the next week or two :)
HTH.
I think the best way to use the wsl for programming in C/C++ is like Microsoft does it. Visual Studio use ssh to connect to linux environment for "C++ for Linux Development".
So, in our case we can set up openssh server on wsl, connect to localhost from your IDE and start remote project.
Eclipse and NetBeans supports remote projects.
Clions I think not.
Here are Microsoft's instruction on how to configure Visual Studio
and wsl:
https://blogs.msdn.microsoft.com/vcblog/2017/02/08/targeting-windows-subsystem-for-linux-from-visual-studio/
May 2017
We use Eclipse and a makefile project. I configured Eclipse by adding an "external builder" - and use the following script:
-c "cd `echo '${project_loc}' | sed -e 's/C:/\/mnt\/c/g' -e 's/\\\\/\//g'` && make -f path_to_makefile/makefile
The "cd" and sed trick is to convert from Eclipse "C:\" to Windows Subsystem for Linux "/mnt/c/" and replace "\" with "/"
Make now executes in the project location as defined by ${project_loc}
I still have not figured out how to execute gdb on Linux. But at least compile+link (and execute unit tests as defined in my makefile) is now leveraging the full speed of the native Ubuntu toolchain...
I have some better way...
You can add new user terminal and give "Ubuntu.exe" location in eclipse under Local terminal setup as shown in screen shot.
in my case directory is ...
C:\Users\MyuserName\AppData\Local\Microsoft\WindowsApps\CanonicalGroupLimited.Ubuntu16.04onWindows_79rhkp1fndgsc
if eclipse not able to select ubuntu16.4.exe, then write manually in path.
as shown in image.
Now just click on Apply and close. Open terminal (Ctrl+Alt+Shift+T) and select Ubuntu terminal.
Now, Navigate to source directory through terminal and compile you project. Enjoy...
Initially I followed espenalb's advice, but it didn't parse my build output correctly: double-clicking on lines didn't open the file, nor go to the line with the error.
I ended up changing the built-in CDT builder (instead of adding an external builder). I changed the build command to be the following (alex is my username):
bash.exe -c make 2>&1 | sed -e 's/\\/home\\/alex/C:\\\\Users\\\\alex/g' -e 's/\\//\\\\/g'
This way, the make output is converted from paths with "/home/alex" to the same path under "c:\users\alex". This fixes the parsing issue.
I also had an issue with eclipse replacing the build output with "Build not configured correctly" - I fixed it by disabling the "Scanner Configuration Builder" in the "Builders" submenu of the project properties (it's a C Makefile project). Also, need to remove targets "all" and "clean" from default build command.
Yet another variation. I managed to build with the external builder command set to
bash.exe -c "cd '${project_loc}' && cd directory_where_the_Makefile_is && make -j8"

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.

How to make a run configuration in eclipse using CDT

I'm trying to compile a code i made in C in Debian using CDT for Eclipse and i'm having the famouse Binary not found error when i try to compile the code. I already build the code by pressing Ctrl+B and the Debug folder appears, and the code doesn't have any syntax error, but the error still there. After that i tried to make a run configuration for my project but i'm not sure about what to put where it say's C/C++ Application. Which is the best configuration for this problem?
I'm using Debian Squeeze, Eclipse CDT and GCC as compiler
If you have successfully built your project and have an executable you can run (no build errors, project properly configured as executable), just press a "search project" or "browse" button in "debug configurations" dialog and point it to your executable.

Eclipse mac osx: Launch failed, binary not found

Just installed eclipse on my mac cannot run my projects when i build and run i get the following message: launch failed, binary not found.
I've set on project setting \macosx gcc\ and linker\miscellaneus\flags -arch i686
doesnt work, i am pretty stuck.
Hi I ran into a similar problem. I am using the following build :
Eclipse IDE for C/C++ Developers
Version: Juno Service Release 2
The fix go into Project > Properties > C/C++ Build > Settings > Binary Parsers : Make sure "Mach-O 64 Parser is selected"
This thread helped me out: "Launch Failed. Binary Not Found." Snow Leopard and Eclipse C/C++ IDE issue
"THE PROBLEM: is that GCC 4.2 (the GNU Compiler Collection) that comes with Snow Leopard compiles binaries in 64-bit by default. Unfortunately, the linker that Eclipse uses does not understand 64-bit binaries; it reads 32-bit binaries. There may be other issues here, but in short, they culminate in no binary being generated, at least not one that Eclipse can read, which translates into Eclipse not finding the binaries. Hence the error."
The fix go into Project > Properties > C/C++ Build > Settings > Binary >Parsers : Make sure "Mach-O 64 Parser is selected"
I made sure this was correct, and still recieved an error, so I would say the best solution is to do this step...then, BUILD the project, then press the "play" button and it should work (that is what fixed my problem)
You must build it first, then click run. It will be fine then.
You need to select the proper binary parser so Eclipse can recognize the executable :
Select the project, then
Project->Properties->C/C++ Build->Settings->Binary Parsers
For the mac select Mach-O Parser.
I wish CDT just came with these selected, it’d be a simple plug-n-play setup. If nothing else they could add a hint in the error text.
I had the same issue,
although i changed the parser as above mentioned it didn't work and i got the same error.
In addition, building the project via the menu solved the problem:
Project>Build All
I guess the very first code execution with eclipse makes it necessary to build the code separately before pressing the green run button (as i supposed this at least compiles the code).

Resources