如何在 Visual Studio 中将 pjsip 构建为 DLL?

Posted

技术标签:

【中文标题】如何在 Visual Studio 中将 pjsip 构建为 DLL?【英文标题】:How to build pjsip as DLL in Visual studio? 【发布时间】:2014-11-20 07:57:49 【问题描述】:

我按照此处的说明进行操作 http://www.pjsip.org/pjlib/docs/html/group__pj__dll__target.htm

但我得到了错误,经过一些网络研究后,我找到了以下答案。但这也会产生更多错误。

来自互联网的回答:http://comments.gmane.org/gmane.comp.voip.pjsip/16764

I managed to build pjsua.dll some time ago and wrote down a simple 
how-to. Maybe you will be lucky with that. It is in doxygen:

 <at> subsubsection subsubsec-pjsip-1x Building PJSIP version 1.x
-# Download sources from http://www.pjsip.org/.
-# Open solution in Visual Studio.
    If you use VS2010 (and maybe newer), do not open the  <at> c .sln file, but
     <at> c .dsw file for older Visual C++ since it does not contain mobile targets
    preventing from import.
-# Create empty file  <at> c pjlib/include/pj/config_site.h
    or copy it from  <at> c config_site_sample.h and add following code:
 <at> code
#define PJ_DLL  1
#ifdef _LIB
#   define PJ_EXPORTING 1
#endif
 <at> endcode
    This will build PJProject using shared libraries.
-# Choose configuration according to your needs: statically or dynamically
    linked release or debug LIBC. Recommended: <b>Release-Dynamic</b>. Do 
not forget
    to set Win32 platform.
-# At project  <at> c pjsua_lib, set Configuration type to DLL and check 
dependencies
    to the same values as in  <at> c libpjproject.
    Add  <at> c ws2_32.lib into linker input libraries. Put  <at> c 
_pjmedia_tonegen_create2
    into Linker > Input > Force Symbol References and
     <at> c pjsua_lib.dll into Linker > General > Output file.
    (Otherwise some symbols would not be exported... ask me why.)
-# Build  <at> c pjsua_lib.
-# Copy  <at> c .lib and  <at> c .dll from  <at> c pjsip/bin to  <at> c 
your/location/sip/pjsua_lib.lib
    and  <at> c pjsua_lib.dll. Note that  <at> c .dll may have  <at> c .exe extension by 
mistake.
-# Copy (merge) all contents of  <at> c include directories of projects
     <at> c pjlib,  <at> c pjlib-util,  <at> c pjmedia,  <at> c pjnath,  <at> c pjsip into
     <at> c your/location/sip/include.

Process to build branch 2.x should be similar I guess, but there is no 
.dsw any more. I can provide you with a php script that removes mobile 
targets from .sln and .vcproj files which are then readable by Visual 
Studio, even 2010.

Good luck!
- Vali

我遵循了所有步骤。但是我遇到了 600 多个错误。我使用的是最新的 pjsip 版本 2.x。

提前感谢!!!

【问题讨论】:

github.com/siniypin/pjsip4net/issues/15 我认为我们必须按照pjsip构建准备来构建pjsua.dll。trac.pjsip.org/repos/wiki/Getting-Started/Windows 【参考方案1】:

在 VS2015 中:右键单击项目 -> 构建依赖项 -> 添加依赖项。 另外在VS 2013中:右键单击项目->属性->通用属性->参考->添加新参考 可以复制需要引用的项目列表,例如来自 libproject PJSIP 项目。

【讨论】:

以上是关于如何在 Visual Studio 中将 pjsip 构建为 DLL?的主要内容,如果未能解决你的问题,请参考以下文章

如何在 Visual Studio 2010 中将数据保存到本地数据库?

如何在 Visual Studio 中将 pjsip 构建为 DLL?

如何在 Visual Studio 中将源附加到引用的程序集

如何在 Visual Studio for Mac 中将参数传递给 Main() C#

如何在 Visual Studio 2015 调试中将“%”符号作为命令行参数 (argv) 传递?

如何在 Visual Studio 2012 中将数据添加到 Access 数据库