user1647753
user1647753

Reputation:

How to add a reference to a library

I have found a math parser Here. I have never added something like this to a program and was wondering what I need to do to add thing like this to a program. For example I want to know where to put the file and how to call it in the headers so that I can use the classes inside the file. I looking for general instructions that can be applied to other things as well.

Upvotes: 1

Views: 141

Answers (1)

undefined
undefined

Reputation: 34238

Sounds like you have come from a bit of a C background. C# is a little different in the way that we pull in external code, and its actually quite a bit easier than C.

To reference some code using Visual Studio, you will need to add a reference to that dll. once you have the dll included (via a reference) in your project you can use it in your code by adding a using statement and then instantiating objects from that library

MSDN docs around this are here: http://msdn.microsoft.com/en-us/library/wkze6zky.aspx

EDIT: if you are outside of VS as you have specified there's a few things you will need to do:

  • Let your compiler know where the assembly is so that it can correctly link
  • Add the assembly to your running directory (it should sit alongside your executable)
    • OR add your library to the GAC
    • OR manually load it with an Assembly.Load call

Upvotes: 2

Related Questions