[英]How to include libraries (such as fastJSON) in a c# (gmcs) project
Disclaimer: I just made by hello world with gmcs
yesterday 免责声明:我昨天刚刚用
gmcs
用hello world gmcs
I want to use fastJSON in my project using gmcs. 我想用FASTJSON使用的GMC在我的项目。
How do I 我如何
cd ~/fastJSON
gmcs --blahblah=fastJSON.csproj
cd ~/myProject
gmcs --yadayada=static ~/fastJSON/fastJSON.lib main.cs
The easiest solution is to use xbuild to build the fastJSON project: 最简单的解决方案是使用xbuild构建fastJSON项目:
cd path/to/fastJSON
xbuild fastJSON.csproj
This will build a library (.dll) somewhere (typically in the bin/Debug subdirectory, but it can be changed in the project file so it may be somewhere else for fastJSON). 这将在某处构建一个库(.dll)(通常在bin / Debug子目录中,但它可以在项目文件中更改,因此它可能在fastJSON的其他位置)。
Now you have the library, and you reference it like this when compiling your code: 现在你有了库,在编译代码时你会像这样引用它:
gmcs -r:path/to/fastJSON.dll mycode.cs
You don't need to install the fastJSON library on your system, just put it next to your executable. 您不需要在系统上安装fastJSON库,只需将其放在可执行文件旁边即可。
根据手册页 ,您需要使用-r
命令行选项:
gmcs -r ~/fastJSON/fastJSON.dll main.cs
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.