I'm trying to build an application in C# that parses (using ANTLR) a C source file and returns me an AST with all the functions and stuff.
I did what was explained here : http://www.antlr.org/wiki/pages/viewpage.action?pageId=557075#
But after doing all that when I try and compile I get the following errors:
The type or namespace name 'GrammarRuleAttribute' could not be found (are you missing a using directive or an assembly reference?)
I have antlr-3.4 and antlrworks-1.4.3.jar
I've used the dll that are in the \antlr-3.4\runtime\CSharp2\dist\DOT-NET-runtime-3.1.3.zip and just noticed now that they are supposed to be for ANTLR 3.1.3
What could cause my problem, I must say I'm a bit lost so many versions
i had the same problem. using the runtime libs provided here and CSharp3 target with antlr 3.4 worked for me. the problem is that the runtime libs comming with antlr-3.4 for CSharp2 target are out of date. i did not try, but maybe building the runtime libs from source is another option that could help.
Related
Myself as well as my coworkers all started seeing this problem sometime in the last few weeks:
Build FAILED
CSC : warning CS8032: An instance of analyzer My.Company.Generators.ReportingV2Generator cannot be created from /Users/work/dev/git/reporting-model/src/My.Company.Generators/bin/Debug/netstandard2.1/My.Company.Generators.dll : Could not load file or assembly 'Microsoft.CodeAnalysis, Version=3.10.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The system cannot find the file specified.. [/Users/work/dev/git/reporting-model/src/My.Team.Models.ReportingV2/My.Team.Models.ReportingV2.csproj]
/Users/work/dev/git/reporting-model/src/My.Company.Api/SmokeTests/Tests/ContentAskExpertSmokeTest.cs(7,20): error CS0234: The type or namespace name 'Models' does not exist in the namespace 'My.Team' (are you missing an assembly reference?) [/Users/work/dev/git/reporting-model/src/My.Company.Api/My.Company.Api.csproj]
...
Many more of the above "type or namespace" errors
...
This happens on both macOS and Windows. It works on Linux (both on a personal machine and inside mcr.microsoft.com/dotnet/sdk:5.0.
Literally none of the source generator code / csproj has changed, it started spontaneously around two weeks ago. I can reproduce this on a commit from two months ago too, so it seems like something might have changed externally in the packages?
I found the solution for this by going to Microsoft directly.
The error on the failure case is that the generator is dependent on Microsoft.CodeAnalysis.dll version 3.10, and 3.10 only shipped in 5.0.300. It appears that your success case is using SDK 5.0.300 but the failure case is using 5.0.204.
You have two options to fix this:
If you're not using any of the features introduced in 3.10 for source generators, you can lower the Microsoft.CodeAnalysis nuget package target to 3.9
Ensure that all builds are using at least 5.0.300 version of the SDK
https://github.com/dotnet/roslyn/issues/54710
I'm having some issues at running CNTK on c# wrapper. I see rold2007 had success on doing the same thing. There got to be something simple that I missed. Any advice would be greatly appreciated.
The steps I used are as follow:
use the source code from C#
generate a new dos application and copy the new code to it.
building the program, the following error occurred at line
using (var model = new IEvaluateModelManagedF())
Wit error message:
Severity Code Description Project File Line Suppression State
Error CS0246 The type or namespace name 'IEvaluateModelManagedF' could not be found (are you missing a using directive or an assembly reference?)
VS version: vs community 2015
OS: windows 10.
CNTK: Downloaded binary. Able to run a sample program.
Your project needs to reference EvalWrapper.dll. In the same directory as the DLL, you need to have a list of other DLLs that are used. See the detailed discussion on the CNTK GitHub page. If you are running a CPU-only build, this is the list of DLLs:
EvalDll.dll
EvalWrapper.dll
libacml_mp_dll.dll
libifcoremd.dll
libifportmd.dll
libiomp5md.dll
libmmd.dll
Math.dll
svml_dispmd.dll
Update
CNTK has switched from ACML to Intel MKL as of August 2016 (see Release Notes). After this change, the list of required DLLs is
EvalDll.dll
EvalDll.lib
EvalWrapper.dll
Math.dll
libiomp5md.dll
mkl_cntk_p.dll
I'm using Visual Studio 2013, and I'm getting an error in my C# code that I can't figure out. I'm working with the Microsoft Kinect SDK, but I'll keep it general.
I downloaded the SDK, and I can get the included sample programs to build and run. But when I try to use the code in my own project, I get the
Type or namespace name 'Kinect' does not exist in the namespace 'Microsoft' (Are you missing an assembly reference)
error.
The thing is, I'm not missing an assembly or reference. I have it added to the project's references, and the path is valid. Also, the using statements at the top of the file will autocomplete to "Kinect" for me. If I start typing using Microsoft., Kinect will appear as an autocomplete option.
What are the steps to debugging an error such as this? Could it be a 32/64 bit issue? I tried using Dependency Walker to look at the Kinect DLL, and while it throws some errors (Error: Modules with different CPU types were found.), it doesn't show any issues that I don't see with other DLLs that I'm using successfully.
What are some other potential issues that might cause a problem with DLLs not being recognized?
1 - Try going to your project settings and verify the version of the .NET framework it uses.
The best to do is to choose the same version as the external libraries.
If it's a client profile, it will very often bring that exact problem. (I'm not sure what the client profile is, but I ended up never using it...)
2 - Check if any of your references got an exclamation mark.
I have a strange issue with my generated serialization .dll. The .dll is successfully generated I can reference it in my project, all the types are contained within the namespace Microsoft.Xml.Serialization.GeneratedAssembly as expected, even the intellisense is picking up the types and namespaces. But when I go to build the project referencing any of the types within the generated assembly I get an error along the lines of:
Error 2 The type or namespace name 'Xml' does not exist in the
namespace 'Microsoft' (are you missing an assembly reference?)
Rather odd, no? The namespace clearly exists as far as intellisense is concerned and I've never had an issue like this before. I tried to regenerate the assembly, still the same problem.
For now I have run sgen.exe with the flag /keep and just copied the generated source into my project which is fine. I was just curious if there was a way to fix this issue or if anyone else has ever come across it before.
EDIT:
It turns out that the issue is because the generated assembly is targeting a version of the .NET framework greater than the assembly that is referencing it. Now the question becomes - how do I generate a serialization assembly with Sgen that targets a specific .NET framework version.
Ok so after reading the answer on this question I managed to generate a serialization assembly that has the correct "runtime version" for .NET 3.5 and everything works as expected, sorry for wasting time.
I have downloaded the irrKlang sound library, and since I'm using C# with sharpdevelop I have:
a) Added a reference to the DLL such that irrKlang.NET4 appears under References in the project tree.
b) Added the statement 'using IrrKlang.NET4;' to my code, which corresponds exactly to one of the example programs provided.
When I try to compile, SD tells me that the type or namespace name NET4 doesn't exist (are you missing an assembly reference).
If I change the using statement to 'using IrrKlang;' as (rather confusingly) appears in another .net example program, my application compiles but I get the runtime error "Error: Could not load file or assembly 'irrKlang.NET4, Version .... or one of it's dependencies. An attempt was made to load a program with an incorrect format".
What is going on here? Any ideas?
Thanks in advance
It looks like that assembly was not constructed properly
instead of
using irrKlang.Net4;
change it to
using irrKlang;
and all is well :)
IrrKlang comes preloaded with various versions for different .NET distributions - both x32 an x64. Make sure you're using the correct one, also set your target build for the corresponding .NET version you're using...
And yes, you should be doing :
using IrrKlang;
.just an idea...