I am working with a C# version of ncurses called Curses Sharp. So far, I've been following the instructions on how to properly install it.
Through these instructions, I've been able to generate the following files:
When I try to add these as project references in Visual Studio 2019, however, only CursesSharp.dll will import. Attempting to import CursesWrapper.dll results in this error:
This file is necessary for the functioning of CursesSharp. However, I can't find anything online about how to properly import a wrapper into Visual Studio, or what I'm doing wrong. Any help is much appreciated.
Attempting to add just CursesSharp resulted in this error:
You don't need to reference that library directly. It appears tha CursesWrapper.dll is a C++ library that's imported by CursesSharp.dll via P/Invoke (native calls). Just reference CursesSharp.dll and you will be fine. The other library just needs to be present, but it is found automatically.
Related
I am trying to import a dll into my Unity project. I have the dll copied into the Assets folder. When I try to "Add Reference" in Visual Studio, I keep getting this error.
Can anyone point to what issue may be causing this error? The dll in question is from the Native SDK for the Varjo headset. I am trying to import it so I can use the Native API from within my Unity project (requires functionality the Unity plugin does not provide).
Don't add the .dll to the references in visual project. Just drop it into your assets folder (better yet some subfolder).
To be able to use the relevant APIs from C# you will need to write a wrapper class similar to the one shown in this example:
https://docs.unity3d.com/Manual/NativePlugins.html
If you want you can give me a few examples of methods you want to call and I can show you how to expose them to c#.
I'm going to create my first managed plugin for Unity (2018.2) using Visual Studio Community for Mac (7.6.11 build 9).
I've read the documentation but I think that the step-by-step instructions are not meant to be followed on Visual Studio Community for Mac.
As you can see in the screenshot below, I've created several projects using each and every library template available.
All of them compiled successfully to a DLL targeting versions of .NET framework that are incompatible with Unity.
The only project I could change the .NET framework version to match Unity's 3.5 is the one based on the Other > .NET > Library.
Everything works fine but I'd like to know if the assumptions, the process and the final result are correct. Can you tell me, please?
I don't know the difference between the "Class" and the "Class Library" option but you're supposed to use the "Class Library" option. This is not the main point of this answer.
Two future issues you haven't solved yet:
1. Referencing Unity's API.
If you ever have to use any Unity library or API in youir plugin such as Vector3, you need to add Unity's UnityEngine.dll to your library settings. If you don't, you will run-time exceptions.
Go to Project --> Add Reference ---> Browse ---> Browse Button
then select <UnityInstallationDirecory>\Editor\Data\Managed\UnityEngine.dll. You can now build your managed plugin. Since you're using Mac, this path is different on your OS. On Mac, this could be /Applications/Unity/Unity.app/Contents/Frameworks/Managed/UnityEngine.dll. You just have to find where UnityEngine.dll is located.
2. Invisible stack trace
With your current setup, if you run into error with your managed plugin, the stack trace won't be there. You won't have the file names and line numbers and this makes is very hard to debug your plugin code.
When you build the project, Visual Studio generates a PDB file instead of an MDB file. Unity can't use this directly. You have to convert the PDB files into MDB files.
From command line, run this:
<UnityInstallationDirecory>\Data\MonoBleedingEdge\lib\mono\4.5\pdb2mdb.exe UnmanagedPlugin.dll
Again, the path might be different on Mac, you just need to find "pdb2mdb.exe" that converts the PDB files into MDB files.
After that, copy the MDB and dll file into the "Assets" folder in your Unity project.
i am using microsoft visual studio 2010 for developing an application. Additionally I am using the QT3D library as an external library.
The QT 3D library is sucessfuly installed and integrated with visual studio. I know this because I can compile and run the examples.
but when I try to write my own code, the visual studio compiler gives me the following error
c4272 : 'function' : is marked __declspec(dllimport); must specify native calling convention when importing a function.
The error message is received a few hundred times, for each of the member functions which are present in the classes in the library header files.
I suspect, that problem has something to do with the linking of the libraries. In the Additional include files the Path is given as follows
"$(QTDIR)\include";"$(QTDIR)\include\Qt3D";"$(QTDIR)\include\QtGui";"$(QTDIR)\include\QtCore";".moc\debug_shared";$(QTDIR)\mkspecs\win32-msvc2010;%(AdditionalIncludeDirectories)
When I iclude the header files, the auto complete option can detect these libraries.
the additional library file paths are given as follows.
$(QTDIR)\lib;C:/qt/5.0.1-x64/qtbase/lib;%(AdditionalLibraryDirectories)
any ideas?
Best Regards
tdk.
I am trying to use the gloox library (C++) to create a Windows XMPP application. It seems simple enough, except I don't know how to import gloox into Visual Studio 2010 so I can include it in my application project.
I've looked at the instructions provided in the read-me (shown below), but when I try to compile the library, I get this error:
Cannot open source file: 'src\tlsgnutlsserver.cpp': No such file or directory
Instructions provided in the read-me file:
Building gloox on MSVC++
use the included project file or create your own
adjust include + library paths if necessary
to receive any debug output you should use the LogSink facilities (this is not win32-specific)
build
Does anyone have experience using Gloox with VS10? If yes, can you please help me out? Thanks!
I assume you're using the official 1.0 tarball? I had the same problem (missing source file) and had to acquire the source from SVN instead. I used the 1.0 branch.
I encountered a few other build problems, namely
the release build configuration was set to build an Application (.exe) instead of Dynamic library (.dll) (Project->Properties->General->Configuration Type)
I needed to add DLL_EXPORT to the preprocessor definitions (Project->Properties->Configuration Properties->C/C++ ->Properties->Preprocessor)
src\atomicrefcount.cpp needed to be added to the project's source files. (Project->Add Existing Item)
This worked for me in express editions of both VC++ 2010 and VC++ 2008.
Hopefully it helps you as well.
This question to which I already found the answer is posted here in case of someone else encounters it. I decided to post the Q&A here so that SO has something about this error, since I don't know if it's been here before.
This occured after an update of the .NET Framework. Before the update, everything compiled just fine! After the update, I could compile nothing!
The error message is:
Error 1 - Could not find file 'Microsoft.Windows.CommonLanguageRuntime, Version=2.0.50727.0'.
This is a problem within Visual Studio 2005. This occurs after an update of the .NET Framework 2.0 and is due to project reference within a single solution.
For example, when you're writing a test library which will test your assembly within the same solution, you will most likely reference the project. Then, this error may occur.
To solve this error, simply reference the file binary of your project, either the DLL or the EXE within which resides the code you want to test. This is called a file reference.
Let's suppose we have two projects called:
Company.Project.ApplicationName;
Company.Project.ApplicationName.Tests.
When adding the reference to our Company.Project.ApplicationName project within our Company.Project.Application.Tests project, we can either use the Browse or the Project tab. When using the Project tab, you create a project reference. We don't want to use this if this error occurs. What we want to use is Browse, so that we can make a file reference.
Here's a link to the Microsoft Support Website that explains this issue.
You may receive a "Could not find file 'Microsoft.Windows.CommonLanguageRuntime" error message when you build a solution of a Visual Basic 2005 Windows Application project in Visual Studio 2005