CMakeListx.txt generated codeblocks project cannot stop in breakpoints - c++

Ubuntu, I git clone https://github.com/NanoMichael/cLaTeXMath, and use below command to generate codeblocks project:
cmake .. -G"CodeBlocks - Unix Makefiles"
and the project created successfully, however, when I set breakpoints in the main function, and click Debug/Continue, the breakpoints cannot be stopped just like release version, the application can run very well, just cannot debug.
I checked some similar posts in stackoverflow like this, and check the project, there are totally five build targets (I cannot find where these 5 defined); when I open "Build Options", click one target(LaTeX), just cannot find "Compiler Settings".
Then I check "Settings"->"Global compiler settings"->GNU GCC Compiler"->Compiler settings, and check "Produce debugging symbols [-g]", and rebuild, but still cannot stop on breakpoints.
I am not familar with codeblocks, please help, thanks!

Related

Eclipse CDT, CMAKE project: No C/C++ Build Menu Item

Thanks in advance for the help.
This is on Windows/MSYS2 (mingw64) Eclipse CDT Version: 2019-09 R (4.13.0) Build id: 20190917-1200.
I have figured out how to run cmake in order to create an Eclipse compatible project file. I then got the project into Eclipse via I got this File->Open Project from File System. I can then make/build that file and create my executables. I do get a couple warnings regarding improper project path but the code all compiles without error.
However, I need to "connect" the cmake build directory (i.e. the project in Kicad) to my source code in order to edit and/or debug the changes I wish to make. Based on my research I believe I have to do this via the Project Properties C/C++ Build menu, however, this menu is not present. I believe I access this menu by selecting the project on the left and right clicking or alt-enter or from the top menu Project->Properties.
For some reason I can't do a screen grab on Eclipse but I pulled the image attached from the online help file: (https://help.eclipse.org/2019-06/index.jsp)
.
My "Project->Properties" menu looks similar in that it shows Resource, Builders, plus more things but there is no C/C++ Build entry: it just goes from Builders to C/C++ General.
I found this "solution" https://bugs.eclipse.org/bugs/show_bug.cgi?id=508319 which seemed appropriate as I had installed the standalone debugger, however, uninstalling it had no effect.
Any suggestions?
Thanks

Eclipse Compiling for Debug vs Native Debug (C++ Code)

I am having an issue compiling in Eclipse Mars.1. I have a C++ program that I've been working on and have it working to the point that I want to put it somewhere other than on my machine. I'm not that great with Eclipse so bear with me...I have everything compiled and working when my Build Configuration is set to "Native Debug", but when I change it to "Debug", the program doesn't build. I get an error code....
Make: Error 127.
I'm hoping this is just a setting that needs to be changed, but I can't find the answer.
Thanks for any help!
Check the build configuration settings of "Native Debug" build config.
Right click on your C++ project. Select Properties option then check the settings of both build configurations.
You can easily find out the difference between these two build configurations and spot the cause of this error.

Eclipse c++ never run when build has errors

When programming in eclipse (c++), I would like to just hit f5 (run) and have the project I'm working on save, build and (if there are no errors) run. If there are errors I want it to show the problems window and stop.
This all works at the moment except for the part where it shouldn't run when there are errors.
Is there a way to make eclipse never run the project when there are errors? Perhaps with an addon?
EDIT: Forgot to mention the prompt... The prompt does show but I want it to not show at all. If you look at the preference window you'll see that there's no 'never' option, there is one for all the other options but not for the 'launch if project contains errors'.
By default, Eclipse CDT does not run code with build errors, but maybe you have checked the option Always launch without asking checkbox.
You should go to Windows menu->Preferences->Run/Debug->Launching->Continue launch if project contains errors and check Prompt option instead of Always. Using this, Eclipse CDT will prompt you if errors exists during building or launch your binary if it has been compiled without errors.

Stepping through a program using Eclipse IDE

How do I step through the program one line at time.
Also, how do I view the console input?
I recently installed Eclipse IDE here:
http://www.eclipse.org/downloads/
Eclipse IDE for C/C++ Developers (includes Incubating components)
Go to Run, Debug Configurations and click the Debugger tab.
Make sure that there is a gdb debugger selected. If not click Browse find the gdb.exe. It will probably be in your installation directory (of eclipse I mean under the /bin subdir).
Hope it helped. :D

Launch Failed. Binary not found. CDT on Eclipse Helios

I'm using Eclipse Helios on Ubuntu 10.04, and I'm trying to install CDT plugin on it. I download it from here here.
And then I go to Install New Software and select the zip file (I don't extract it, just select the zip file). And its ok, it installs, everything works fine, it shows optional features, blah blah blah.
And then I create a new HelloWorld project. And when I try to run it, it shows an error and says:
Launch failed. Binary not found.
Can anyone explain me how to fix it?
Thanks.
You must build an executable file before you can run it. So if you don't “BUILD” your file, then it will not be able to link and load that object file, and hence it does not have the required binary numbers to execute.
So basically right click on the Project -> Build Project -> Run As Local C/C++ Application should do the trick
First you need to make sure that the project has been built. You can build a project with the hammer icon in the toolbar. You can choose to build either a Debug or Release version. If you cannot build the project then the problem is that you either don't have a compiler installed or that the IDE does not find the compiler.
To see if you have a compiler installed in a Mac you can run the following command from the command line:
g++ --version
If you have it already installed (it gets installed when you install the XCode tools) you can see its location running:
which g++
If you were able to build the project but you still get the "binary not found" message then the issue might be that a default launch configuration is not being created for the project. In that case do this:
Right click project > Run As > Run Configurations... >
Then create a new configuration under the "C/C++ Application" section > Enter the full path to the executable file (the file that was created in the build step and that will exist in either the Debug or Release folder). Your launch configuration should look like this:
Go to the Run->Run Configuration-> now
Under C/C++ Application you will see the name of your executable + Debug (if not, click over C/C++ Application a couple of times). Select the name (in this case projectTitle+Debug).
Under this in main Tab -> C/C++ application -> Search your project -> in binaries select your binary titled by your project....
You must "build" before "run", otherwise "Binary not found". You can set up "Auto build", so that it will build and run. Check this post to set up "Auto build" http://situee.blogspot.com/2012/08/how-to-set-eclipse-cdt-auto-build.html
I had this problem for a long while and I couldn't figure out the answer. I had added all the paths, built everything and pretty much followed what everyone on here had suggested, but no luck.
Finally I read the comments and saw that there were some compilation errors that were aborting the procedure before the binaries and exe file was generated.
Bottom line: Do a code review and make sure that there are no errors in your code because sometimes eclipse will not always catch everything.
If you can run a basic hello world but not your code then obviously something is wrong with your code. I learned the hard way.
If you still have an error even after building the project then try to do this:
click on Binaries in Project Explorer with the left button
click on green "Play" button (Run Debug)
I was having this same problem and found the solution in the anwser to another question:
https://stackoverflow.com/a/1951132/425749
Basically, installing CDT does not install a compiler, and Eclipse's error messages are not explicit about this.
I faced the same problem. I have Eclipse Indigo and Eclipse Luna on Ubuntu. I tried many solutions, but none worked. Here's how you can try :)
Try it in order :)
Either do Build All and then compile :)
Install G++ Compiler
Windows->Preferences->NEW CDT PRoject-> Makefile-> Binary Parsers-> Choose Cywin or Window PE depending on your Os :)
Change your toolchain to cywin gcc
Project->Properties->Environment-> Release Active
After 1,2, 3, and 4, I tried changing paths, and other stuff, but nothing worked. In the end, I noticed that it mentioned Debug Active was not configured. So when I changed it to Release Active, it worked. Do note that change in environment and path is not required.
I faced the same problem while installing Eclipse for c/c++ applications .I downloaded Mingw GCC ,put its bin folder in your path ,used it in toolchains while making new C++ project in Eclipse and build which solved my problem.
Referred to this video
Seems like having "Build Automatically" under the Project menu ought to take care of all of this. It does for Java.
make sure you have GDB installed on your system...
If your using Linux based OS simply in a terminal type:
sudo apt-get install gdt
when finished downloading extract the file and install.
close your IDE (in this case eclipse and open it again and run your project.
Adding the compiler to the PATH fixed the problem for me...
export PATH="$HOME/opt/cross/bin:$PATH"
My problem was the same as one commenter above. I had to change the binary parser to the correct one (PE for windows, ELF for Linux, mach for mac)