I'm trying to debug a c++ project (existing code) in Netbeans.
I can run the code fine by hitting the Run button, but debugging isn't working for some reason. I've seen a lot of suggestions telling that the -g flag needs to be added to the gcc compiler options in Netbeans.
From what I understand this used to be done through the *Aditional options" field in the project properties. But this field doesn't exist anymore in Netbeans 8.
Where can I add the -g flag to the gcc compiler options in Netbeans 8?
If it's a normal C++ Application project, then your NetBeans pulldown menu (to the left of the Build Project button - an icon with hammer) should have at least three lines - Debug, Release and Customize. Choose the Debug configuration to build the project, then the -g option will be added automatically.
Related
I have just installed a fresh Code::Blocks instance, however the build button doesn't work: I have pressed it many time to build the .exe file, but when I try to run it asks me to build it again.
The "Yes" button on the pop-up dialog that asks me to build doesn't do anything.
My complier's installation directory is C:\Program Files\CodeBlocks\MinGW
I'm using Code::Blocks 20.03 with MinGW installation pack
If you have a version of GCC as compiler (such as MingW for Windows), chances are it will come with support for the most recent version of C++ disabled by default. This can be explicitly enabled by going to Settings->Compiler
Example
And here, within Global compiler settings, in Compiler settings tab, check the box Have g++ follow the C++11 ISO C++ language standard
Example
I used to use dev c++ but now I decided to switch over to codeblocks. dev c++ worked normally but when I try to build on codeblocks nothing happens. I typed out some code compiled it and build it but when I tried to run it a message popped up saying I haven't build it yet and if I would like to build it now. when I clicked yes nothing happend and when I clicked no it would run but not work normally. some youtube videos recommended going to settings then compiler, selecting GNU GCC compiler, going to Toolchain executables and cliicking auto detect. in my case when I clicked auto detect a message saying could not auto-detect installation path of "GNU GCC Compiler". what should I do to fix these errors
install GCC then add its path to environment variable in path then click auto-detect again
if you're on windows
type environment variables in search box
click environment variables button in the dialog
in System Variables group double-click path(add one if missing)
click New then Browse buttons, naviagete to GCC folder
click Ok buttons to confirm, then back to code::blocks to auto-detect
or set the path to GCC manually in Toolchain executables tab
I'm fairly new to qt, so sorry if this is a dumb question, I'm trying to keep debug symbols in a release build on linux.
Most of what I've read has todo with qmake which we dont use. Our project is a makefile project using clang. I have the -g in the release build of my makefile, but when a raise() is called, I'm dumped to assembly which is a little hard for me to debug :) And breakpoints just don't work.
I've tried from what I've read.
In Run - Enable QML
In Kits Debugger - Uncheck warn when debugging release builds (this was a tip)
What I did first was to add -g to the release part of my makefile, but qt still didn't pickup the debug symbols.
So in reverse I added -03 to the debug part of the makefile, which allowed me to debug the optimised code.
I am trying to port over a windows c++ application to run on linux and I am using monodevelop. I have run into a compile error, and after some research I figured out that I need to specify the -std=c++0x flag for g++ to compile it correctly. When I run g++ with this flag on the command line it compiles fine. However, I cannot see a way to add this through monodevelop. Under options->Code Generation I see some text for "extra compiler options", but there is no way to add anything to this list. No buttons or text boxes are visible. I also opened up the .cproj file to see if I could just add it manually, but I am not seeing anything obvious where I would put this. Does anyone know how to add compiler options in monodevelop?
In monodevelop 4 and up, you can add custom compiler options such as -std=c++11 and so forth. To do this, you'll need the latest MonoDevelop installed, you can compile it manually from github or install it from the Ubuntu PPA http://ppa.launchpad.net/v-kukol/mono-testing/ubuntu .
After you have it installed, all you have to do is go to Project > 'Project Name' Options and go to Build > Code Generation and add the compiler options where it says Extra Compiler Options.
I am using eclipse IDE. I have here some basic source code including header file. Have been using cygwin as C++ compiler. It compiles my app and it does not produce any error. But I cannot see the output on IDE's console. When I run the executable file on its own it produces output. How to configure Eclipse IDE in order to redirect output to the IDE's console?
This is all I get:
15:40:11 **** Incremental Build of configuration Debug for project GetCompiled ****
make all
Building target: GetCompiled.exe
Invoking: Cygwin C++ Linker
g++ -o "GetCompiled.exe" ./Compiling.o
cygwin warning:
MS-DOS style path detected: D:\Aristotelis\C++\GetCompiled\Debug
Preferred POSIX equivalent is: /cygdrive/d/Aristotelis/C++/GetCompiled/Debug
CYGWIN environment variable option "nodosfilewarning" turns off this warning.
Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
Finished building target: GetCompiled.exe
15:40:12 Build Finished (took 702ms)
Selected app to run:
I tried to run the exe file from the IDE by selecting to run as an C++ app, but it does not produce any output.
Best regards
Eclipse/CDT does not automatically run your application after each build. You need to either go trough the menu Run->Open Run->Run or use the keyboard shortcut Crtl+F11, and then check the Console window again.
An advanced feature is to set your application as a post-build event. For that, go to your Build Settings and find the appropriate submenu and type the name of your application.exe there (haven't got Eclipse at my fingertips right now). With this setting, the application will be launched automatically after each successful build. This comes in handy if you do automated unit testing.