Codeblocks variable highlighting... what's happened? - c++

Background:
I'm a big fan of using Codeblocks to do C++. I have just upgraded to Ubuntu 14.04 LTS and installed Codeblocks via the Ubuntu Software Centre.
My Problem: All is going great, apart from one minor thing which is missing. When I double click on a variable, other instances of that variable used to be highlighted too. This was an extremely useful way I debugged my programs. But it isn't here on the new version for some reason.
I would like the feature shown in the screenshot below to be set. Where is the option?
Please can someone help me out, maybe there's an option I'm missing?

Install the contrib plugins for Code::Blocks IDE (codeblocks-contrib) to enable occurrences highlighting in Code::Blocks.
sudo apt install codeblocks-contrib
In Code::Blocks select Settings -> Editor -> Occurrences Highlighting (scroll down in the pane on the left side to find it) and then put a check mark in the three checkboxes under Highlight occurrences of selection as shown in the below screenshot.
The three checkboxes to select are:
Highlight occurrences
Case sensitive
Whole words only
Then click the OK button to apply the changed settings. You can also put a check mark to the left of the two settings under Permanently highlighted occurrences in order to apply these settings.

karel -- Thank you very much for your answer. I believe this will be the thing which will solve most people's question.
For completion, I would like to document my different answer (for other forum users).
I simply had to install the optional extras on the Ubuntu software centre alongside the Codeblocks installation. The menu "occurence highlighting" did not appear without doing this.
Best wishes.

Related

Eclipse shortcuts do not work ubuntu

I have installed Eclipse Neon with C++ features on Ubuntu 16.04.
My problem is that some more unusual shortcuts do not work such as "copy lines" (ctrl+alt+down), or "move lines up" (alt+up), or autocomplete (ctrl+space) for example.
The others more usual like "ctrl+c" or "ctrl+f" or "ctrl+z" do work.
I have tried to restart eclipse, and even the computer. I have restored the defaults key bindings but they do not work anymore. I think they worked just few times at the beginning after installing eclipse.
I don't want to uninstall and then reinstall eclipse because it is not a good solution if I have to do that every time, it will be just bothering at will. While searching for solutions on Google, it seems it is a quite recurrent issue for eclipse, but there is never real answers for them.
Thank you in advance
Go to Window > Preferences > General > Keys and change commands involving arrow keys or other keys that don't work such as:
ctrl+Alt+upArrow
To something involving a key that registers when set in binding, such as:
ctrl+Alt+d
Eclipse was having trouble with arrow keys and function keys on my system and this solved it. Hopefully helps someone who ends up on this page.
Running Arch linux version = Linux 4.15.7-1-ARCH

VSCode "go to definition" not working

I installed Visual Studio Code 1.1 with the C/C++ extension,
opened my C++ project and tried to use "Go to definition" in vain.
The "Go to definition" is not working at all.
Example, go to definition of a class member:
int i = m_myVar;
(I opened a simpler project with one file and it was working for this one)
In the end, what I want is good indexation of my big project, is there a way to install Intellisense?
I had a the same issue: F12 and Ctrl + Click and Right Click "Go To Definition" wasn't working.
The fix for me was:
Go to Extensions
Click "Disable All Installed Extensions"
Close and Reopen VS Code
Back to Extensions and "Enable All Extensions"
Essentially enable/disable all extensions fixed the issue.
I recently came across this same issue and after trying all of the suggested solutions I could find with no success, I found this article:
https://code.visualstudio.com/docs/setup/linux#_visual-studio-code-is-unable-to-watch-for-file-changes-in-this-large-workspace-error-enospc
Basically my project grew too large and VS code was no longer able to track all files, which messed up the "go to definition" functionality.
After following the steps on the link to increase the maximum number of files to be tracked, the issue was resolved.
The correction is pretty simple (tested on Ubuntu 18.04):
Add this line:
fs.inotify.max_user_watches=524288
to the end of the file /etc/sysctl.conf
After saving, run the following command:
sudo sysctl -p
Hopefully this will be useful to someone else, this has been bothering me for the last few days.
I had a similar problem except with Python and google searches for solutions kept bringing me back to this post so I figured I'd post my solution here in the hopes that it might help other people.
I was working on a remote cluster through VScode Remote and was getting similar errors to the original question(all 'go to ___' functionality was unavailable and was even getting a 'too large to track' error) and I thought I had to increase the number of watches, which didn't end up helping.
All I needed to do was install a python interpreter on the remote VScode server. This fixed my problem.
I believe vscode 1.1 (well, 1.1.1 actually) + the C++ extension (cpptools) is as much Intellisense as we can get for now.
You should load your big project with the "open folder" function to make vscode know about the other files.
https://blogs.msdn.microsoft.com/vcblog/2016/03/31/cc-extension-for-visual-studio-code/ warns about letting the indexing finish first (red icon in lower right corner during indexing) and mentions the current limitations on the source code parsing.
It wasn't working on my laptop as well after installing a few VSCode extensions. I decided to close and re-open VSCode with administrator permission and suddenly it sorted out.
I have been trying to fix this for a long time. In the end, what worked for me was simply reinstalling VSCode, then installing the latest C/C++ extension (v0.18.1). Then, in your .vscode/c_cpp_properties.json file, under includePath, add your include folder which has all your header files.
I tried the methods mentioned in this thread none of them seemed to work for me. A simple solution that worked for me is that I closed the current workspace and created a new workspace, added the folders which I required(same as the old workspace), and saved the new workspace. Waited for a couple of minutes to index and IntelliSense is able to find definitions now.
I am using VSCode 1.52.1 on Ubuntu 20.04.
In my case, for whatever reason,c_cpp_properties.json has become set to Disabled in ~/.config/Code/User/settings.json.
Manually changing it to Enabled solved the problem.
Fixed mine by UNCHECKING C_Cpp > Default > Limit Symbols To Included Headers
Your mileage may vary. Good luck!
Have you saved your workspace? Or did you just open a folder with File->Open Folder? This question already has many answers, but none of them address this case, which was my issue.
The question is not specific enough for me to know if you are having the exact same symptoms as my case.
If:
You have not saved your workspace. vscode doesn't say "(workspace)" at the top of the window.
None of the goto functions are working, but instead report: "No ___ found for ____"
The tag parser database icon in the bottom right is always there but only reports "Parsing open files", rather than telling you how many files have been parsed.
Then:
Try saving your workspace.
If you have multiple versions of a language on your PC, specify the exact language you are using in the VScode(in my case, I am using Python, so I must specify the version to the python Interpreter in VS Code)
If you could not do it whatsoever, then uninstall all the other versions that you don't use and then if you go to VS Code, it will ask the version to be used, and you would have only one version, so when you select the version, the "Go To Definition" will be activated.
I was having a similar issue with java on Ubuntu 20.04 using OpenJDK version 11 (openjdk-11-jdk in apt). At first I didn't have the JRE installed, so I installed it and it still didn't work.
Afterwards, I went to the CTRL + SHIFT + P menu and then to Java: Configure Java Runtime, there I saw in the Java Tooling Runtime tab that /usr/lib/jvm/java-11-openjdk-amd64 was selected, changed it to /usr/lib/jvm/java-1.11.0-openjdk-amd64 just to see if it would work, and after a restart it did. I'm not sure why this is, but I hope it may help somone else.
For python ensure your code analysis settings are correct. In my case the languageServer was accidentally set to 'None'. Reverting it to 'default' or 'pylance' did the trick.
Just to inform if none of above works then
In my case i was using Kite extension in my VS code, I just disabled it and it worked. I think kite extension is blocking this feature.
OS: Linux Ubuntu 22.04
if you encountered with following error:
"The .NET Core SDK cannot be located. .NET Core debugging will not be enabled. Make sure the .NET Core SDK is installed and is on the path."
Normally Vscode remains unable to locate .Net sdk. need to set path manually.
sudo ln -s /snap/dotnet-sdk/current/dotnet /usr/local/bin/dotnet
restart omnisharp & restart vscode
No need to do anything. Just close and re-open. It will work.
I also faced similar problem. In my mac os cmnd + 'click' is used to 'go to definition' then it suddenly stoped working. If that is the case then please follow these steps:
restart vs code
restart pc
uninstall all extensions and reinstall again followed by a pc restart.
I had a similar issue with the extension C/C++ installed. I solved it by downloading an older version of the extension and upgrading to the last version. Somehow it solved the problem...

CodeLite dark theme

I just downloaded CodeLite 5.4 from YaST. It has everything that I want from an IDE. It has text predictions, autocomplete, and auto indent. I love it. It takes me back to Eclipse when I was using Windows. I could get my code done efficiently. There's only one one problem with it. I don't like the theme at all. White color schemes aren't good (especially for those of us who are up late coding) I've found this to be a problem in a lot of IDEs for Linux. How can I get this great IDE to look good?
CodeLite 5.4 is a bit outdated. Did you try downloading latest CodeLite for OpenSUSE from CodeLite website ?
Once installed, you can select themes from (the main menu):
Settings -> Colours and fonts -> <Your language>
You should have a drop down which says: "Available themes"
Eran

Can't run C++ in NetBeans: "No Shell Found" error

I'm trying to learn C++ using NetBeans but even though I have CYGWIN and everything set up in my PATH, I keep getting an error that says: "No shell found. Cannot proceed. Please install either CYGWIN or Msys."
I don't know what Msys is but since the error says "or" I assume that if I have CYGWIN that I don't need to have Msys.
I'm trying to run the basic "Hello World!" tutorial but this error from what I've seen isn't covered. I'm getting aggravated because I have a project I need to have done in a few weeks.
If anyone has any answers for me, that would be great. I can supply screenshots if you need them.
Cygwin alone is not enough, first of all you have to check if you installed C++/gcc/gdb packages in your Cygwin.
From Cygwin/Net beans docs:
Open the Control Panel (Start > Settings > Control Panel) and double-click the System program.
Select the Advanced tab and click Environment Variables.
In the System Variables panel of the Environment Variables dialog, select the Path variable and click Edit.
Add the path to the cygwin-directory\bin directory to the Path variable, and click OK. By default, cygwin-directory is C:\cygwin. Directory names must be separated with a semicolon.
Click OK in the Environment Variables dialog and the System Properties dialog.
If it fails you could try to Re-Install Netbeans from/within an cygwin/bash instance start the netbeans from a cygwin/bash instance.
Netbeans should automatically detect gdb/g++
PS: I'd prefer to use a good Gnu/Linux distro
I had the same problem with 8.1.
Adjusting the %PATH%-variable - in my case adding C:\msys64\usr\bin - solved it (as wdavilaneto's slightly verbose answer suggested).
This is not an answer but it adds to this question, I know that isn't very objective but in this case there may be a problem with Netbeans. I have 7.3 so this could be the reason. I am getting the same error but it used to work just fine, then one day it just stopped working and couldn't find the Shell. I have everything you need to make C/C++ work for Netbeans and it was working, for a while too!
It is rather old, but I've had the same issue a moment ago. It "Solved itself" by Creating a new "welcome sample" project and then made it run, then went back to my original project and made it run again. For me, it solved the problem. Probably it is related to an issue with Netbeans as Cian said.
Btw, I'm with Netbeans 8.1.
Make sure the shell is in your path! Depending whether you have Cygwin, Mingw32, Mingw32, TDM Mingw... it will be somewhere here:
c:\<installation path>\usr/bin
Hmh, I have 2 C compilers one for 64bit and one for 32bit set in NetBeans. When I had 32bit compiler without 64bit one then compiling went fine but when I have installed 64bit then NetBeans has started to do some problems, firstly everything went fine but then I started to get this problem to. For me fix is to switch from 64bit compiler back to 32bit compiler, then compile my program and then go back to 64bit compiler and now I can compile it with 64bit compile... Not sure why is this fixing it.
I have this problem with Netbeans 10.
Computer is Windows 10 x64.
Resolved by following the answer given by TNT.
Problem was when start building my project the said "no shell" (the topic of this posting) dialog box popped up. Since there was no command prompt, the build tools cannot run - process cannot spawn.
Solution was to give the correct path (environment variable). Since I am using MSYS, Since I am using MSYS, adding
F:\msys64\usr\bin
to my PATH made it work.

Flex/Flash Builder stand alone has a duplicate "Open Resource" menu

I've seen an issue a few different installations whereby the Open Resoure menu open in Navigate appears twice, which wouldn't be a problem if it didn't disable the CTRL+SHIFT+R shortcut to it.
I've seen it affect both Flex Builder 3 and Flash Builder 4, but it only seems to affect the standalone version when it is installed after the plugin version. Re-installation doesn't seem to help.
NOTE: I'm posting this with the intent of self-answering
I recently spotted the answer posted by Kammerer on a related question, but it doesn't appear will in search results. I'm reproducing the solution here, but please vote up the original answer if this answer helped.
Open %FLEX_BUILDER_HOME%\plugins\com.adobe.flexbuilder.standalone_3.0.214193\plugin.xml
%FLEX_BUILDER_HOME% is the installation directory for Flex/Flash Builder
Requires elevation on Windows Vista/7
The version number may not match the above
Search for com.adobe.flexbuilder.standalone.navigate and comment out (or remove) the entire <actionSet> ... </actionSet> node that contains it
Save the file
Run %FLEX_BUILDER_EXE -clean
%FLEX_BUILDER_EXE% is FlexBuilder.exe or FlashBuilder.exe, depending on your version