Errors when using parseCpp to parse C++ files - rascal

I am trying to use Clair and Rascal to analyze C++ files.
I followed the instructions on the Github page of Clair to add Clair to an empty Rascal project. After importing the required modules successfuly, I attempted to call parseCpp to parse a C++ file and got the following errors:
rascal>parseCpp(|project://myproject3/myFile.cpp|);
|jar+file:///Users/rh07/.m2/repository/org/rascalmpl/clair/0.4.0/clair-0.4.0.jar!/src/lang/cpp/AST.rsc|(24317,206,<455,0>,<456,167>): Java("NoSuchMethodError","\'io.usethesource.vallang.IString org.rascalmpl.library.Prelude.readFile(io.usethesource.vallang.ISourceLocation)\'")
at lang.cpp.internal.CDTParser.parseFileAsCpp(|unknown:///CDTParser.java|(0,0,<202,0>,<202,0>))
at lang.cpp.internal.Parser.parseCpp(|unknown:///Parser.java|(0,0,<349,0>,<349,0>))
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(|unknown:///NativeMethodAccessorImpl.java|(0,0,<0,0>,<0,0>))
at parseCpp(|jar+file:///Users/rh07/.m2/repository/org/rascalmpl/clair/0.4.0/clair-0.4.0.jar!/src/lang/cpp/AST.rsc|(24516,5,<456,160>,<456,165>)Beginning at 2022-11-25T11:35:54.827391Z
WARNING: ResourcesPlugin was null, can't get workspace; not overriding include files
How I can get parseCpp to work? Thanks.

The error is caused by a bad combination of versions. Please use clair-0.5.0 (just released) which will work with rascal-0.27.2 that is distributed with the Rascal VScode extension 0.5.5.
Adopt the pom.xml like so:
<dependency>
<groupId>org.rascalmpl</groupId>
<artifactId>clair</artifactId>
<version>0.5.0</version>
</dependency>

Related

Let ParseAndCheckFileInProject recognize symbols from Nuget dependecies

When using FSharp.Compiler.SourceCodeServices.FSharpChecker.ParseAndCheckFileInProject from FSharp Compiler Service for whole-project analysis, how can NuGet dependencies be included for symbolic resolution?
In the project under analysis, some project file (*.fsproj) contains some <PackageReference> element, e.g. <PackageReference Include="NodaTime" Version="3.0.3" />, and some source file contains an open statement open NodaTime and somewhere some symbol DateInterval refering to NodaTime.DateInterval. For me, the FSharp Compiler Service seems to fail to resolve DateInterval to NodaTime.DateInterval in that source file.
What I am currently doing is, summarized:
let checker = FSharpChecker.Create()
let options: FSharpProjectOptions = { ... }
checker.ParseAndCheckFileInProject (...)
Given that I use ParseAndCheckFileInProject, what is necessary for checker and/or options to consider symbols coming from NuGet dependencies?
I think you have to extract the FSharpProjectOptions from the .fsproj project file. For old-style .NET Framework projects, there used to be a method called ProjectCracker.GetProjectOptionsFromProjectFile that would do this, but it has been replaced with Dotnet.ProjInfo, which also supports .NET Core. See this SO question for details.

"NestModule" , "NestMiddleware", "MiddlewareConsumer" has no exported member in types/#nestjs/common

I am new to NestJs and tried implementing the middleware specified in NestJs documentation,
https://docs.nestjs.com/middleware
When NestMiddleware is imported i am getting the following error
" Module '"../../types/#nestjs/common"' has no exported member 'NestMiddleware'". and similar errors while importing "NestModule" and "MiddlewareConsumer'.
Iam using nestJs version 6.0.0
NestModule, MiddlewareConsumer, and NestMiddleware are all imported from #nestjs/common. From your project root, that would be <root>/node_modules/#nestjs/common/index. If you are having trouble importing these sources, you may need to re-install your dependencies.

XlsLib integration in IOS Application

I'm trying to integrate xlslib in my app. After compiling and installing lib, I have added this in my code. Then I got the error shown below:
format_t::format_t(CGlobalRecords& gRecords, const u16string& fmtstr) :
formatstr(fmtstr),
index(0),
m_usage_counter(0),
m_GlobalRecords(gRecords)
{
}
Errors:
format.cpp:125:52: Reference to 'u16string' is ambiguous
Out-of-line definition of 'format_t' does not match any declaration in
xlslib_core::format_t
while in format.h file, declaration as below
format_t(CGlobalRecords& gRecords, const u16string& fmtstr);
Can any one help to solve this issue?
Why didn't you post a bug report on the SourceForge page? In any case, the xlslib project has been updated and now offers the DHxlslibIOS library that you can incorporate as is into your project. You can download a zipped package here with the latest 2.4.0b1 source, or pull it from SVN. The framework is in the DHxls directory.

Grails - Batik.jar interaction

An external Library need the Batik.jar Library.
But on Loading it outputs:
java.lang.LinkageError: loader constraint violation: loader (instance of ) previously initiated loading for a different type with name "org/xml/sax/SAXParseException"
I tried modifying the build config.groovy file to exclude xml-apis but it didnt work. Any workaround for using batik?
I faced the same problem , I've manually looked for all ivy*.xml files in %User%\.ivy2\cache\org.apache.xmlgraphics and deleted the following entry :
<dependency org="xml-apis" name="xml-apis" rev="1.3.04" force="true" conf="compile->compile(*),master(*);runtime->runtime(*)"/>
I had the same issue with the selenium libraries, which have contain some xml-libraries. I extracted these newer/outdated versions from selenium and then it worked.
I had a look into "batik" and in the lib folder there are xalan, xerces and xml-apis. Try to remove them and hope, that the api-versions provided from grails are compatible.

Help in using OpenCV - Errors of type: identifier not found

Am a beginner to OpenCV and have gone so far as to work out the hello world samples, inverting, color conversion(RGB->greyscale ) etc programs working.
However i am stuck at the Programs that use cvCanny, cvPyr and other such feature detectors.Would really be thankful if the tiny prblem was sorted out .
I get the Error: error C3861: 'cvPyrDown': identifier not found
error C3861: 'cvCanny': identifier not found
I've included the imgproc and features2d headers yet the problem persists.
What am I missing out ?
Do you have your "Additional input directories" property set correctly?
Mine, configured by cmake, looks like this:
C:/OpenCV-2.2.0/release
C:/OpenCV-2.2.0/include
C:/OpenCV-2.2.0/include/opencv
C:/OpenCV-2.2.0/modules/core/include
C:/OpenCV-2.2.0/modules/imgproc/include
C:/OpenCV-2.2.0/modules/features2d/include
C:/OpenCV-2.2.0/modules/gpu/include
C:/OpenCV-2.2.0/modules/calib3d/include
C:/OpenCV-2.2.0/modules/objdetect/include
C:/OpenCV-2.2.0/modules/video/include
C:/OpenCV-2.2.0/modules/highgui/include
C:/OpenCV-2.2.0/modules/ml/include
C:/OpenCV-2.2.0/modules/legacy/include
C:/OpenCV-2.2.0/modules/contrib/include
C:/OpenCV-2.2.0/modules/flann/include
Btw. CMake is a nice tool if you are dealing with libraries that contains many include files, line OpenCV.
You can also check two other things:
After compiling OpenCV2.2 from sources, did you built "INSTALL" project in the OpenCV VS solution?
If you are using c++ headers, you might prefer c++ version of those functions,
in the cv namespace:
cv::Canny(...)
That sounds like a link error rather than any problems with include. Are you sure you are linking with cv.lib?
You need to add the $(OPENCV_ROOT)/lib directory to the linker path so it knows where to search for the files.
From the description, I assume you're using Visual Studio? If so, you have two options for doing so.
Add it to this project under Project -> Properties -> Linker -> General -> Additional Library Directories.
Add it for all projects: Tools -> Options -> Projects and Solutions -> VC++ Directories -> Library files. And then add folders there.

Resources