Intellisense not working in VS Code on Ubuntu - c++

I am running VS Code version 1.17.2 on Ubuntu 16.0.4 on a VMware Player VM in Windows 10. I installed the C++ extension for VS Code. When installing the extension there was a message to say that the extension installed OK but afterwards there was a lot of repeated messages saying something like "failed to update database".
When I type something which is invalid syntax there is no red squiggle and if I press Ctl-Space it just shows "Loading..." but nothing comes. The red flame icon on the status bar shows and I see "Updating Intellisense..." when I hover the mouse over but the icon doesn't ever seem to go away.
If I #include a non existent header, there is no green squiggle but if I save the file, exit VS Code and reopen, them the green squiggle shows on the header but there is no light bulb showing in the left margin.

I had exactly the same problem. I've been playing around with settings and disabling/enabling the extension. Finally got it working with setting the followings then disabling/enabling the extension (reload VS code after both of them):
"C_Cpp.errorSquiggles": "Enabled",
"C_Cpp.intelliSenseEngine": "Tag Parser",
"C_Cpp.loggingLevel": "Information"
Also you can play around with "Reset IntelliSense Database" command, I ran it a couple of times, that might have helped too.
I suspect the intelliSenseEngine setting was the one that made the trick.
Edit
This doesn't enable all features, e.g. wrong include markers and "go to definition" works for includes, but code completion doesn't.

I had exactly the same problem, running ElementaryOS on VirtualBox. As per this comment (https://github.com/Microsoft/vscode-cpptools/issues/756#issuecomment-303513360) I changed my settings to
"C_Cpp.intelliSenseEngine": "Tag Parser"
And things seems to be working again.

I am running VS Code 1.19.2 with C/C++ IntelliSense 0.15.0 (Microsoft) on a Ubuntu 16.04 LTS running as a Virtualbox VM (Windows 10 host). All x64 OS's.
In my case the symptom is a recurrent flaming icon in the bottom status bar hinting "Updating IntelliSense..." that seems related to a hung process.
A couple of "Microsoft.VSCod" processes doesn't use CPU...
Hovering over code just hints "Loading...".
After changing "C_Cpp.loggingLevel" to "Information" to analyze log on the Output windows (as requested in https://github.com/Microsoft/vscode-cpptools/issues/1291 thread) didn't show anything useful... but symptom dissapeared most of the time.
After changing "C_Cpp.intelliSenseEngine" to "Tag Parser" things went much better. The flaming icon disappeared and definition are available all the time.

Related

Visual Studio 2017 Invisible Breakpoints on the Breakpoint Bar

My Visualstudio 2017 Breakpoints are invisible, which means they appear in the submenu.
My application stops by hitting each breakpoint correctly.
I'm able to set and delete Brakpoints via the sidebar next to the line bar.
Breakpoints can be controlled by rightclick them and the submenü will open
BUT:
They wont appear. Setting a breakpoint in the bar only left a grey bar behind as there is no breakpoint.
So far I tried:
Reinstall vs 2017 7 times
Deinstalling all plugins and similar stuff (visual assist, Qt etc.)
Delete every project
Delete every %appdata% stuff
Delete registry data for vs
Tryed (I hope) everything in Debug config and vs settings
Installed it on my laptop using also intel Windows 10 etc. (there it workes, but I still need it on my pc)
Solution:
(System: Win-10)
(VisualStudioversion: 17/19)
Check if there is a breakpoint.png on your computer (if this is missing, this solution wont work). (Search in Windows explorer and enable to see all file and search trough everything filename, file etc. [enable this in the settings])
Create Win10 .iso with the offered tool from Microsoft here and store it on the desktop.
Execute this .iso and press install Windows. [Dont forget to cross the right checkbox to keep your data and just replace all your windows files]
!Some settings will be gone after new installation as they inherited by the system! (but most things will stay)
After finishing the (re)installation just start vs 17/19 and the Breakpoint should work now or better should be visible breakpoints. :D
Note: I tried a lot of things including a huge amount of testing, checking etc.. This solution should work, but there is the possibility, that I fixed the issue with some other test or stuff I've done. Though there is no guarantee that this will work, but if it doesn't work, just leave a comment and I can try to remember what I've done along my solution process.

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...

Visual Studio 2015 error: Unable to start debugging. Unexpected GDB output from command "-target-select remote :5039". Remote connection closed

I see the following error whenever I try to debug "Cross Platform" under "C++" category: "Unable to start debugging. Unexpected GDB output from command "-target-select remote :5039". Remote connection closed"
I've installed all of the contents when I downloaded Visual Studio 2015 community and I ran it on Windows 10 Pro which supports Hyper-V.
I've been searching a solution for this and I've found an assumption:
"What is your debug target, the VS Android Emulator? When we saw this before it turned out to be a bad emulator image. Do you have this problem with all targets (e.g. if you try a physical device) or just one?"
In my case, I just tried this via Emulator(VS Emulator 5" Lolipop (5.0) XXHDP Phone (0x86 -...)
So I've sent an Email to VS 2015.
And the answer was like this:
"Sorry for the delay in responding we were looking at an emulator image of another user that ran into this problem so I was waiting until we had the results of that investigation to report back. We actually were not able to find anything wrong the emulator itself, our current hypothesis is that it is a network or adb problem interfering with GDB’s ability to connect to GDB server on the remote machine. Do you see this error every time you try to debug, or if you reboot the emulator will it work sometimes right after the reboot? Next time you see the error, can you open the emulator’s console mode by going go the Hyper-V manager and double clicking the emulator. Then find the location your app installed to and run “gdbserver --version" from the app path and let me know what it says? This will validate if the correct version of gdbserver is on the device."
So we are trying to solve this problem but I'm also asking here just in case.
Is there anyone who has magical solution for this problem?
I'll put a comment on this if I figure out how to solve this.
Thanks in advance.
** Following answer is from the manager of Visual Studio 2015:
You are only the second person who has run into this issue, and the first person that ran into it provided their everything works correctly when we run their .vhd on our machines so it appears to be some strange problem where gdbserver (which comes from the Android NDK provided by Google) crashes only when running on certain machines. Unfortunately the .vhd you provided does not appear to be the correct one it won’t boot for me. You can see the .vhd file being used by the emulator if you look under the settings of the emulator in your Hyper-V manager. .However given we got the other person’s .vhd you can hold off providing any additional information at this point. I’m waiting to hear back from the emulator team on if they have any ideas since this appears to be an issue only on specific machines since.
If you don’t mind my asking, if you don’t have a background in computers what inspired you to try C++ on Android? That scenario will be significantly more complicated than doing Java on Android.
It's been almost two months since I got this answer but I haven't got any additional response from them yet. So, I ended up quitting developing an application by using VS2015.
If you run into this problem, there are only two ways to go. Change your computer or stop developing application via VS2015.
If the project name contains spaces, the whole remote debugging fails. Visual Studio also creates weird paths. When checking out the "Blink1 for Raspberry Pi" template, I named the Project "Blink1 for Pi", which resulted in a path like this:
~/projects/Blink1?/for/pi/PI/for/pi....
And all the debugging failed. When I recreated this keeping the project name "Blink1", everything worked fine. It's a pity, that spaces aren't handled here...

VS2013 freezes as I type OpenCV include header files

I have a problem with VS2013. I'm trying to write a program in vc++ using opencv and in vs2013 update 4 IDE. the problem is as I just type these lines, my computer freezes. infact the hard activity runs to 100 percent and never stops untill restart. even when I (hardly) close VS and even when I logged off, hard disk activity is still at maximum. the code is:
#include <iostream>
#include <stdio.h>
#include "opencv2/core/core.hpp"
#include "opencv2/features2d/features2d.hpp"
It seems that the last line makes the problem.
FYI I have tried and run lots of OpenCV examples in VS2013.
And when I tried the code above on VS2012 on another computer it works well, but on VS2013 on another computer it again freezes just like my computer.
So what's wrong here?
The problem may point to several performance issues in VS2013, please try each one of the following separately until overcoming the issue:
Disabling Synchronized Settings: Go to Tools -> Options -> Environment-> Synchronized Settings and remove this option by unchecking the checkbox.
Set Current source control plug-in to None: Tools > Options > Source
Control
Clear the "Use hardware graphics acceleration if available" check
box to prevent the use of hardware graphics acceleration : Tools -> Options -> Environment-> General , make sure "Automatically adjust visual experience based on client performance" is cleared too.
Note: You can select or clear the "Enable rich client visual experience" check box to make sure that rich visuals are always on or off, respectively. When this check box is selected, rich visuals are used independent of the computer environment. For example, rich visuals are used when you run Visual Studio locally on a rich client and over remote desktop. it may help too.
Try deleting the solution's .suo file (it's next to the .sln file),
closing and re-opening Visual Studio

NetBeans 7.0.1 good C++ program execution "RUN FAILED"

Working inside NetBeans 7.0.1, fresh install on Ubuntu 13.10.
I have a known good C++ program.
I finally get it to compile and link.
When I press the Netbeans Run Main Project triangle, the execution breaks with
java.util.MissingResourceException: bin/nativeexecution/Linux-x86/pty
RUN FAILED
What's going on, and how to fix it?
This is a NetBeans output-window setting problem.
NetBeans comes up with C++ projects defaulting to "Internal Terminal". This is not working on your present configuration.
The answer is to switch your output to "External Terminal", which pops up a separate purple terminal typing console in its own window for your interaction, or "Standard Output",which presents the output in the expected white subpane below.
Do this by:
Right-mouse-click on your project name -> Properties
on the left side, in the "Categories:" column, select * Run
on the right side, beside the >General -> Console Type:,
change the pulldown menu from "Internal Menu" into "Standard Output".
Hit the OK button at the bottom to lock it in.
Now your project will run, forever after, when you ask it to.
according to this netbeans forum post package of netbeans 7.0.1 is lacking some files.
Removing version from repo and installing from netbeans download site worked like a charm for me and nb forum OP.
So problem is also in ubuntu 14.04.
Also repo version is little out-of-date and NB have nice .sh installer. Just remember to install some JDK from repo or anywhere else.