How to switch between debug and release Makefiles in Eclipse CDT? - c++

For example I have 2 Makefiles: Makefile.Debug and Makefile.Release.
I can switch between them by setting different commands in:
C/C++ Build -> Builder Settings -> build command : make -f Makefile.Debug -j4 or make -f Makefile.Release -j4, but how can I switch between two makefiles in Eclipse GUI (Like in Visual Studio debug/release configurations)?

Create two Build configurations in Eclipse, each with a different make command.
Then, you can click the down arrow near the hammer in Eclipse's top bar to switch configuration.
Detailed steps:
Right click on Project, click Properties
Left sidebar, click C/C++ Build
Top right corner, "Manage Configurations..."
Add
Set "Name" and select "Existing configuration: xxxxx"
Ok
Ok
Switch between the configurations setting what's required (in your case, under the C/C++ Build section, in the "Builder Settings" tab, select "External builder" type in the "Builder type" combo, then deselect "Use default build command" and enter yours in the "Build command" field
Confirm with OK
Use the hammer
(I haven't a copy of Eclipse on this PC right now so I can't send screenshots, sorry.)

Related

CMakeListx.txt generated codeblocks project cannot stop in breakpoints

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!

How to execute a CLion program in gnome terminal?

This question already has an answer here but I am using CLion version 1.2.1 and the answer in that post doesn't help. It is possible to run a CLion program in gnome terminal instead of its own console ? If yes, how ? Thanks.
EDIT : I know where the executable file are stored but want to know if it is possible to run the file in terminal directly from the ide i.e. by selecting the run option in ide.
Yes, you can execute a Clion c/c++ program in a gnome terminal from the IDE. Here is how:
In the top right of your clion application you should see your project name or "Build All". Click on that and go to "edit configurations"
there click on the plus sign(top left) and then on "Application"
Now go to "Executable:" and click on "select others". There you should go to where your gnome-terminal is stored (mine is at "/usr/bin/gnome-terminal" on ubuntu)
Next go to "Program arguments:" and type -e ./myProjectName (For newer versions of gnome-terminal -e is deprecated, use -- ./myProjectName)
go to "Working Directory:" and type in the location to your cmake-build-debug folder found in your project folder
You can now press okay and go to the top right to select the name of your application that you created in step 2
This will run your program in the gnome terminal.
Hope this helped :)

Trying to build Telegram (Desktop) from source

I'm trying to built the Telegram Desktop client from source using the instructions on Github. I'm up to this point:
Tools > Options > Build & Run > Kits tab > Desktop (default) > change
Qt version to Qt 5.4.0 (Qt-5.4.0) > Apply Open MetaStyle.pro,
configure project with paths
/home/user/TBuild/tdesktop/Linux/DebugIntermediateStyle and
/home/user/TBuild/tdesktop/Linux/ReleaseIntermediateStyle and build
for Debug
I can open MetaStyle.pro, but I don't know what the instructions mean by "configure project with paths...".
Does it mean I have to add those directories to the INCLUDEPATH? The OBJECTS_DIR?
When you open a project file with Qt Creator, it first prompts you to configure the project. If it doesn't, select the "Projects" button at the left side of QtCreator and click the "Build & Run" tab.
Under the Build Settings header, choose which build configuration you want to change ("Edit build configuration: " Debug/Release).
For the Debug configuration, set the debug "Build Directory" as
/home/user/TBuild/tdesktop/Linux/DebugIntermediateStyle
If the field is grayed out, check the "Shadow Build" box.
For the Release configuration, set the release directory as
/home/user/TBuild/tdesktop/Linux/ReleaseIntermediateStyle

How to make eclipse cdt(c++) build&run in one button?

I code in c++ using eclipse cdt.
Every time i make changes i have to press this combination:
ctrl+s - save(without saving, just hitting the run button runs the
old version of code)
build(hammer button)
run
I remember i could just hit the run button - and it would do all 3 steps - save, build,run
How to make the run button achieve and do all this work?
This is configurable in the "Run Configurations" settings.
From the toolbar, go to Run -> Run Configurations...
Select your run configuration on the left
On the "Main" tab on the right, look for "Build (if required) before launching"

How to define g++ or clang++ in xcode 4?

How do I use a c++ compiler (g++ or clang++) to compile a simple c++ project in xCode 4?
You can assume I am in the project, in the Build Settings.
I have in Build Options -> Compiler for C/C++/Objective-C -> Apple LLVM compiler 3.0 and LLVM GCC 4.2 as options.
Is either one appropriate or do I have to install another one?
How do I do that?
For running a simple code with Xcode after running Xcode choose “Create a new XCode project”. (You can also go to “File|New|New Project...” or press Shift-⌘-N). This will bring up a screen in that screen select "Application"then select "Command Line Tool" and then click next .Now enter a name for your project and select type c++ and click next in upcoming screen select a directory for you project and click "create" now you can write codes in main.cpp file in the left panel for running your code just click on "Run" button .
Update:
In Build options click "Build settings" and then click "All" from "C++ language Dialect"and "C++ standard library"tab you can choose the compiler and c++ standard that you want included c++11.