Rstudio lost C++ autocomplete and diagnostics.

I have recently lost c++ autocomplete, and diagnostics as well. Possibly similar to: Rstudio does not display correct C++ diagnostics; libclang error - #3 by jweinstk, but I do not have any errors that I know of.

I did not make any changes to cause the issue. I have updated Rstudio to the latest 1.2.5033 as well as all packages, but it did not help. R is still 3.5.3.

Here are my code settings but nothing works.

Even if I use Ctrl+Space which always brings up autocomplete I only get a space.
However other combinations such as Ctrl-Shift-C works for commenting.

Thank you.

Update:

I keep getting the following error in logs, which I just found.

03 Mar 2020 16:58:23 [rsession-melkin] ERROR Error parsing translation unit C:/Users/Michael/Documents/RStudio/CppTest1/ED_CppTest1.cpp; LOGGED FROM: class rstudio::core::libclang::TranslationUnit __cdecl rstudio::core::libclang::SourceIndex::getTranslationUnit(const class std::basic_string<char,struct std::char_traits,class std::allocator > &,bool) C:\jenkins\workspace\IDE\windows-v1.2\src\cpp\core\libclang\SourceIndex.cpp:270

When this started I lost auto complete in all projects. I tried re-installing Rtools and Rstudio and it did not help. I then renamed the Rstudio-Desktop folder in AppData which reset the Rstudio completely.

After the reset new projects do have completions and diagnostics, but old projects still do not and give the error I posted.

Update 2:

I am looking a the default new c++ file from Rstudio.
#include <Rcpp.h>
using namespace Rcpp;

// [[Rcpp::export]]
NumericVector timesTwo(NumericVector x) {
return x * 2;
}

This works and gives completions.
If I add #include <RcppArmadillo.h>, then it does not seem to work and when compliing I get a clang error: fatal error: 'RcppArmadillo.h' file not found.

Then if I try to run TimesTwo(42) R crashes.

But if I add ```
// [[Rcpp::depends(RcppArmadillo)]]

to the code then I get an error not to include Rcpp.h with Armadillo.

So once I only leave #include <RcppArmadillo.h> then it compiles and works, but clang give the following error:
error: OpenMP support and version of OpenMP (31, 40 or 45) was disabled in PCH file but is currently enabled
And I again have no code completion.

I searched that error and know nothing about the PCH or OpenMP so I am at a complete loss here.

I tried not including RcppArmadillo at all, and I get a new error:
called object type 'Rcpp::NumericMatrix' (aka 'int') is not a function or function pointer

This error occurs anytime I reference the numericMatrix with something like x(1,1) from the timesTwo default example.

Does this file have a parse error of some kind? Perhaps that is causing an issue?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.