Viewing cout Output From CLion C++ file - c++11

I recently downloaded CLion to use with C++ and it's working fine, I just wanted to know if/how I could view std::cout. If not in the CLion output console, then maybe in a separate terminal window using the CMakeLists.txt file? Again, my code is building fine, I just want to know how/if I can view the output (similar to what I'd be able to do in Eclipse, XCode, or even Sublime).

You'll see it in the "run" tab, not the "terminal" tab
From the dropdown box at the top, make sure you have the correct target selected and hit the play button.

Related

Suppress popup console in apps created using Code::Blocks IDE

I am using Code::Blocks version 13.12 with the GNU GCC Compiler. I recently installed and started using these tools on Windows 7. Although I do not believe language is a contributing factor, I use this environment to create both C and C++ applications.
After getting a clean build for either a debug or release target executable, and click on either the green "Run" or the red "Debug/Run" toolbar button, I see a console popup flicker (appear, then close) even for code that writes nothing to stdout. For example...
int main(void)
{
int a = 1;
return 0;
}
...produces a console popup.
Can anyone describe how to set the Code::Blocks IDE to suppress the console popup?
Note: I have reviewed answers related to this question here and here. These posts are related in that one is closed as a duplicate of the other, but answers for neither address this question. (i.e. Because my systems do not use Avast, Avast is completely unrelated to the issue)
You can change the settings in Code::Blocks to run as a GUI application. This will tell it to compile as such and it will not produce a console window on startup. And this is how you do so:
1. Click Project on the CodeBlocks menu.
2. Click Properties.
3. Click the second tab, Build Targets.
4. On the right, where it says Type: Console application, change it to GUI application.
5. Rebuild the project.
This is where the information was gather if you have further questions: How to get ride of console box of a GUI program compile by MinGW + Code::Block

Enter Insert/Edit mode of CLion IDE

New to CLion, not sure if its just me, but everytime I type, the "Search for" bar appears in the Project directory left side bar. I am unable to type anything into the opened file. The caret does not even appear on the file. It's like when using Vim, but you're not in Insert mode. I have no idea how to go and start typing into the IDE. Any recommendations to how to use this thing?
It it because the focus in on the Project pane:
Just click once in the editor pane (where the file you want to edit is displayed). The caret will appear and you will be able to type.
I know it's painful, but just restart the IDE. That's what I did and it works now.

GNAT GPS Debugger - Could not initialize the debugger

I am attempting to debug my project in GNAT's GPS IDE. Every time I chose Debug->Initialize->"program name" the gui of GPS switches to that of the debug GUI, and then an error pops up with "could not initialize the debugger".
The two possible solutions I have found are that gdb.exe may be out of date and it suggests running it outside of GPS, which it does run fine. The other possible solution is to make sure the -g tags are applied when building the project, as those are necessary for gnatlink and gcc for debugging. It also states that the -g tag is applied to a new project by default, unless you have specifically removed it. I doubt I have, but I am not sure where I would check that to make sure it is still included.
The other odd thing is that the tutorial that comes with GPS that runs through how to build and debug your code works perfectly fine when I initialize debugging on it. That tutorial I am referring to can be accessed through Help->GPS->GNAT Programming Studio Tutorial. It references the program 'sdc' which comes in the GNAT/2012/share/examples/gps/tutorial directory.
Any ideas on what I am doing incorrectly, since the error isnt very helpful?
Thanks!
At first it sorta sounds like a path problem, but if you're able to run a debugger tutorial that's probably not the case.
The behavior you're seeing if the program isn't compiled with the debug (-g) flag doesn't quite match my experience, but let's go ahead and check/set the debug flag anyway.
Select Project/Edit Project_Properties
Click the Switches tab.
Click the Gnatmake tab.
Check "Debug information". Note that a -g now shows up in the text box at the bottom of the tab page. Click OK on the dialog.
Recompile your code so that it uses the changed option. Select Build/Clean/Clean All, and OK any dialog that pops up.
Then do your build (you can just press F4).

Xcode external tools cpplint

Is there already a way in Xcode to map from a generic command line tool's output to line numbers and messages so that when running e.g. cpplint you can have it mapped to the graphical text editor?
I though of writing a plugin for this but it seems overkill, I imagined that this kind of generic functionality had already been developed, if not already included in Xcode.
In case anyone stumbles upon this:
In Xcode 7 it's actually very easy to accomplish this behaviour. Add a "Run Script Phase" to the "Build Phases" of your target, as described very well on this site here. Then use the following command to run cpplint.py:
/usr/local/bin/cpplint.py ./${TARGET_NAME}/*
Adjust the path to cpplint.py to your situation. When cpplint.py encounters an error, Xcode should highlight the specific line in the editor like this:
Hint: If you want to modify the command above, you can observe the entire output of the script in Xcode on the "Report Navigator". To view the "Report Navigator" press either ⌘8 or click on View > Navigators > Show Report Navigator, then select the last build on the right pane and activate All Messages on the log pane. See also the answer of the the following post: Added Run Script phase to Xcode, but nothing happens.

In Xcode is there code that will open up the console for you?

Is there a way in Xcode to have your software open up the console for you? I would like to have it when my code compiles and runs in Debug to have the console open up automatically but in release for it to not open.
Thanks in advance.
A common way to achieve this is :
Open a new tab, and rename it 'Console' (or what name you want)
In this tab, show only the panes you want (in your case the console)
Go to Preferences>Behaviors
Tell Xcode to 'Show tab' and give it the name you set in 1. (you can set this at various moments, when build starts, or when app runs).
Now, each you will either compile or run your app, Xcode will switch to the tab you have set in Prefs.
You dont use code, you go to xcode pref's and do it there
This is where I came for the answer given and marked correct (although it's not clear it was what the asker quite wanted).
Arguably, a simpler version of the answer given is to set the Behaviors preferences to show the Debugger when a run starts. With the settings in the image below, this opens up the console (or the console + variable views or the variables view, depending on how it was last set - that's what 'Current Views' means).

Resources