﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-浪迹天涯-随笔分类-Lib</title><link>http://www.cppblog.com/qiujian5628/category/7463.html</link><description>唯有努力...
&lt;br&gt;努力....再努力...</description><language>zh-cn</language><lastBuildDate>Fri, 24 Apr 2009 11:28:47 GMT</lastBuildDate><pubDate>Fri, 24 Apr 2009 11:28:47 GMT</pubDate><ttl>60</ttl><item><title>VC一步一步编译OpenVPN</title><link>http://www.cppblog.com/qiujian5628/archive/2008/10/21/64613.html</link><dc:creator>浪迹天涯</dc:creator><author>浪迹天涯</author><pubDate>Tue, 21 Oct 2008 07:00:00 GMT</pubDate><guid>http://www.cppblog.com/qiujian5628/archive/2008/10/21/64613.html</guid><wfw:comment>http://www.cppblog.com/qiujian5628/comments/64613.html</wfw:comment><comments>http://www.cppblog.com/qiujian5628/archive/2008/10/21/64613.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.cppblog.com/qiujian5628/comments/commentRss/64613.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/qiujian5628/services/trackbacks/64613.html</trackback:ping><description><![CDATA[最近在研究openvpn，已经部署好服务器和客户端了。想对代码进行研究，故想跟踪调试openvpn代码看看。<br>下载openvpn最新版本，目前稳定版本是openvpn-2.0.9&nbsp;&nbsp;&nbsp; http://openvpn.net/
<br><br>我的机器环境是:vc6.0 + vc2003 platform_sdk<br>下载以后解压，main函数在openvpn.c文件中，vc6打开这文件，将其它*.h *.c文件全部加入到工程中，编译运行，报一大堆错:<br>
<div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; background-color: #eeeeee; font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: #000000;"></span><span style="color: #000000;">include\winsock2.h(</span><span style="color: #000000;">109</span><span style="color: #000000;">)&nbsp;:&nbsp;error&nbsp;C2011:&nbsp;</span><span style="color: #000000;">'</span><span style="color: #000000;">fd_set</span><span style="color: #000000;">'</span><span style="color: #000000;">&nbsp;:&nbsp;</span><span style="color: #000000;">'</span><span style="color: #000000;">struct</span><span style="color: #000000;">'</span><span style="color: #000000;">&nbsp;type&nbsp;redefinition<br></span><span style="color: #000000;">include\winsock2.h(</span><span style="color: #000000;">144</span><span style="color: #000000;">)&nbsp;:&nbsp;warning&nbsp;C4005:&nbsp;</span><span style="color: #000000;">'</span><span style="color: #000000;">FD_SET</span><span style="color: #000000;">'</span><span style="color: #000000;">&nbsp;:&nbsp;macro&nbsp;redefinition<br></span><span style="color: #000000;">include\winsock.h(</span><span style="color: #000000;">88</span><span style="color: #000000;">)&nbsp;:&nbsp;see&nbsp;previous&nbsp;definition&nbsp;of&nbsp;</span><span style="color: #000000;">'</span><span style="color: #000000;">FD_SET</span><span style="color: #000000;">'</span><span style="color: #000000;"><br></span><span style="color: #000000;">include\winsock2.h(</span><span style="color: #000000;">153</span><span style="color: #000000;">)&nbsp;:&nbsp;error&nbsp;C2011:&nbsp;</span><span style="color: #000000;">'</span><span style="color: #000000;">timeval</span><span style="color: #000000;">'</span><span style="color: #000000;">&nbsp;:&nbsp;</span><span style="color: #000000;">'</span><span style="color: #000000;">struct</span><span style="color: #000000;">'</span><span style="color: #000000;">&nbsp;type&nbsp;redefinition<br></span><span style="color: #000000;">include\winsock2.h(</span><span style="color: #000000;">209</span><span style="color: #000000;">)&nbsp;:&nbsp;error&nbsp;C2011:&nbsp;</span><span style="color: #000000;">'</span><span style="color: #000000;">hostent</span><span style="color: #000000;">'</span><span style="color: #000000;">&nbsp;:&nbsp;</span><span style="color: #000000;">'</span><span style="color: #000000;">struct</span><span style="color: #000000;">'</span><span style="color: #000000;">&nbsp;type&nbsp;redefinition<br></span><span style="color: #000000;">include\winsock2.h(</span><span style="color: #000000;">222</span><span style="color: #000000;">)&nbsp;:&nbsp;error&nbsp;C2011:&nbsp;</span><span style="color: #000000;">'</span><span style="color: #000000;">netent</span><span style="color: #000000;">'</span><span style="color: #000000;">&nbsp;:&nbsp;</span><span style="color: #000000;">'</span><span style="color: #000000;">struct</span><span style="color: #000000;">'</span><span style="color: #000000;">&nbsp;type&nbsp;redefinition<br></span><span style="color: #000000;">include\winsock2.h(</span><span style="color: #000000;">229</span><span style="color: #000000;">)&nbsp;:&nbsp;error&nbsp;C2011:&nbsp;</span><span style="color: #000000;">'</span><span style="color: #000000;">servent</span><span style="color: #000000;">'</span><span style="color: #000000;">&nbsp;:&nbsp;</span><span style="color: #000000;">'</span><span style="color: #000000;">struct</span><span style="color: #000000;">'</span><span style="color: #000000;">&nbsp;type&nbsp;redefinition<br></span><span style="color: #000000;">include\winsock2.h(</span><span style="color: #000000;">241</span><span style="color: #000000;">)&nbsp;:&nbsp;error&nbsp;C2011:&nbsp;</span><span style="color: #000000;">'</span><span style="color: #000000;">protoent</span><span style="color: #000000;">'</span><span style="color: #000000;">&nbsp;:&nbsp;</span><span style="color: #000000;">'</span><span style="color: #000000;">struct</span><span style="color: #000000;">'</span><span style="color: #000000;">&nbsp;type&nbsp;redefinition<br></span><span style="color: #000000;">include\winsock2.h(</span><span style="color: #000000;">397</span><span style="color: #000000;">)&nbsp;:&nbsp;error&nbsp;C2011:&nbsp;</span><span style="color: #000000;">'</span><span style="color: #000000;">sockaddr_in</span><span style="color: #000000;">'</span><span style="color: #000000;">&nbsp;:&nbsp;</span><span style="color: #000000;">'</span><span style="color: #000000;">struct</span><span style="color: #000000;">'</span><span style="color: #000000;">&nbsp;type&nbsp;redefinition<br></span><span style="color: #000000;">include\winsock2.h(</span><span style="color: #000000;">407</span><span style="color: #000000;">)&nbsp;:&nbsp;error&nbsp;C2011:&nbsp;</span><span style="color: #000000;">'</span><span style="color: #000000;">WSAData</span><span style="color: #000000;">'</span><span style="color: #000000;">&nbsp;:&nbsp;</span><span style="color: #000000;">'</span><span style="color: #000000;">struct</span><span style="color: #000000;">'</span><span style="color: #000000;">&nbsp;type&nbsp;redefinition<br>.................................<br></span></div>
<br>这是由于&lt;config-win32.h&gt;文件中包含了
<div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; background-color: #eeeeee; font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: #000000;">#include&nbsp;</span><span style="color: #000000;">&lt;</span><span style="color: #000000;">windows.h</span><span style="color: #000000;">&gt;</span><span style="color: #000000;"><br>#include&nbsp;</span><span style="color: #000000;">&lt;</span><span style="color: #000000;">winsock2.h</span><span style="color: #000000;">&gt;</span><span style="color: #000000;"><br></span></div>
windows.h中又包含了&lt;winsock.h&gt;导致和winsock2.h冲突，解决方法是在include&lt;windows.h&gt;之前添加宏:
<div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; background-color: #eeeeee; font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: #0000ff;">#define</span><span style="color: #000000;">&nbsp;WIN32_LEAN_AND_MEAN</span><span style="color: #000000;"><br>#include&nbsp;</span><span style="color: #000000;">&lt;</span><span style="color: #000000;">windows.h</span><span style="color: #000000;">&gt;</span><span style="color: #000000;"><br>#include&nbsp;</span><span style="color: #000000;">&lt;</span><span style="color: #000000;">winsock2.h</span><span style="color: #000000;">&gt;</span></div>
因为用到了winsock2.h 所以必须加入lib文件:ws2_32.lib
<br>再次编译，出现如下错误:<br>
<div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; background-color: #eeeeee; font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: #000000;">mudp.c<br></span><span style="color: #0000ff;">this</span><span style="color: #000000;">&nbsp;compiler&nbsp;appears&nbsp;to&nbsp;lack&nbsp;vararg&nbsp;macros&nbsp;which&nbsp;will&nbsp;cause&nbsp;a&nbsp;significant&nbsp;degradation&nbsp;</span><span style="color: #0000ff;">in</span><span style="color: #000000;">&nbsp;efficiency<br>e:\libtools\openvpn</span><span style="color: #000000;">-</span><span style="color: #000000;">2.0</span><span style="color: #000000;">.</span><span style="color: #000000;">9</span><span style="color: #000000;">\lzo.h(</span><span style="color: #000000;">32</span><span style="color: #000000;">)&nbsp;:&nbsp;fatal&nbsp;error&nbsp;C1083:&nbsp;Cannot&nbsp;open&nbsp;include&nbsp;file:&nbsp;</span><span style="color: #000000;">'</span><span style="color: #000000;">lzo1x.h</span><span style="color: #000000;">'</span><span style="color: #000000;">:&nbsp;No&nbsp;such&nbsp;file&nbsp;or&nbsp;directory<br>multi.c<br></span><span style="color: #0000ff;">this</span><span style="color: #000000;">&nbsp;compiler&nbsp;appears&nbsp;to&nbsp;lack&nbsp;vararg&nbsp;macros&nbsp;which&nbsp;will&nbsp;cause&nbsp;a&nbsp;significant&nbsp;degradation&nbsp;</span><span style="color: #0000ff;">in</span><span style="color: #000000;">&nbsp;efficiency<br>e:\libtools\openvpn</span><span style="color: #000000;">-</span><span style="color: #000000;">2.0</span><span style="color: #000000;">.</span><span style="color: #000000;">9</span><span style="color: #000000;">\lzo.h(</span><span style="color: #000000;">32</span><span style="color: #000000;">)&nbsp;:&nbsp;fatal&nbsp;error&nbsp;C1083:&nbsp;Cannot&nbsp;open&nbsp;include&nbsp;file:&nbsp;</span><span style="color: #000000;">'</span><span style="color: #000000;">lzo1x.h</span><span style="color: #000000;">'</span><span style="color: #000000;">:&nbsp;No&nbsp;such&nbsp;file&nbsp;or&nbsp;directory<br>ntlm.c<br></span><span style="color: #0000ff;">this</span><span style="color: #000000;">&nbsp;compiler&nbsp;appears&nbsp;to&nbsp;lack&nbsp;vararg&nbsp;macros&nbsp;which&nbsp;will&nbsp;cause&nbsp;a&nbsp;significant&nbsp;degradation&nbsp;</span><span style="color: #0000ff;">in</span><span style="color: #000000;">&nbsp;efficiency<br>occ.c<br></span><span style="color: #0000ff;">this</span><span style="color: #000000;">&nbsp;compiler&nbsp;appears&nbsp;to&nbsp;lack&nbsp;vararg&nbsp;macros&nbsp;which&nbsp;will&nbsp;cause&nbsp;a&nbsp;significant&nbsp;degradation&nbsp;</span><span style="color: #0000ff;">in</span><span style="color: #000000;">&nbsp;efficiency<br>e:\libtools\openvpn</span><span style="color: #000000;">-</span><span style="color: #000000;">2.0</span><span style="color: #000000;">.</span><span style="color: #000000;">9</span><span style="color: #000000;">\lzo.h(</span><span style="color: #000000;">32</span><span style="color: #000000;">)&nbsp;:&nbsp;fatal&nbsp;error&nbsp;C1083:&nbsp;Cannot&nbsp;open&nbsp;include&nbsp;file:&nbsp;</span><span style="color: #000000;">'</span><span style="color: #000000;">lzo1x.h</span><span style="color: #000000;">'</span><span style="color: #000000;">:&nbsp;No&nbsp;such&nbsp;file&nbsp;or&nbsp;directory<br>openvpn.c</span></div>
<br>
<div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; background-color: #eeeeee; font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: #000000;">#ifdef&nbsp;USE_LZO<br><br>#ifdef&nbsp;LZO_HEADER_DIR<br>#include&nbsp;</span><span style="color: #000000;">"</span><span style="color: #000000;">lzo/lzoutil.h</span><span style="color: #000000;">"</span><span style="color: #000000;"><br>#include&nbsp;</span><span style="color: #000000;">"</span><span style="color: #000000;">lzo/lzo1x.h</span><span style="color: #000000;">"</span><span style="color: #000000;"><br></span><span style="color: #0000ff;">#else</span><span style="color: #000000;"><br>#include&nbsp;</span><span style="color: #000000;">"</span><span style="color: #000000;">lzoutil.h</span><span style="color: #000000;">"</span><span style="color: #000000;"><br>#include&nbsp;</span><span style="color: #000000;">"</span><span style="color: #000000;">lzo1x.h</span><span style="color: #000000;">"</span><span style="color: #000000;"><br></span><span style="color: #0000ff;">#endif</span></div>
<br>因为openvpn默认配置用到了lzo压缩库，所以下载lzo压缩包:lzo-2.03,并且将lzo-2.03包中的include文件加入到工程中，注意文件目录层次，我是额外定义了lzo文件夹，将头文件全部加入进去的，因此必须加上编译选项:LZO_HEADER_DIR<br>另额外编译lzo lib:<br>&nbsp;&nbsp;&nbsp; 将lzo解压至C盘根目录，在命令行中跳至该目录，运行b\win32\mc120.bat，编译成功后生成lzo.lib<br>将生成的lzo.lib添加到工程中。<br>另如果不是用lzo可以修改&lt;config_win32.h&gt;头文件: (openssl ssl crypto也可以不使用，视具体情况)<br>
<div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; background-color: #eeeeee; font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: #008000;">/*</span><span style="color: #008000;">&nbsp;Use&nbsp;OpenSSL&nbsp;crypto&nbsp;library&nbsp;</span><span style="color: #008000;">*/</span><span style="color: #000000;"><br></span><span style="color: #0000ff;">#define</span><span style="color: #000000;">&nbsp;USE_CRYPTO&nbsp;1</span><span style="color: #000000;"><br><br></span><span style="color: #008000;">/*</span><span style="color: #008000;">&nbsp;Use&nbsp;LZO&nbsp;compression&nbsp;library&nbsp;</span><span style="color: #008000;">*/</span><span style="color: #000000;"><br></span><span style="color: #0000ff;">#define</span><span style="color: #000000;">&nbsp;USE_LZO&nbsp;1</span><span style="color: #000000;"><br><br></span><span style="color: #008000;">/*</span><span style="color: #008000;">&nbsp;Use&nbsp;OpenSSL&nbsp;SSL&nbsp;library&nbsp;</span><span style="color: #008000;">*/</span><span style="color: #000000;"><br></span><span style="color: #0000ff;">#define</span><span style="color: #000000;">&nbsp;USE_SSL&nbsp;1</span><span style="color: #000000;"><br><br></span><span style="color: #008000;">/*</span><span style="color: #008000;">&nbsp;Version&nbsp;number&nbsp;of&nbsp;package&nbsp;</span><span style="color: #008000;">*/</span><span style="color: #000000;"><br></span><span style="color: #0000ff;">#define</span><span style="color: #000000;">&nbsp;VERSION&nbsp;PACKAGE_VERSION</span><span style="color: #000000;"><br></span></div>
<br><br>接着如果使用OpenSSL，那么首先要下载OpenSSL库，然后编译:<br>&nbsp;&nbsp;&nbsp; a.将OpenSSL解压到C盘根目录下；<br>&nbsp;&nbsp;&nbsp; b.在命令提示行中进入该目录，输入perl Configure VC-WIN32，检验perl是否正确安装；<br>&nbsp;&nbsp;&nbsp; c.命令行中输入ms\do_ms；<br>&nbsp;&nbsp;&nbsp; d.命令行中转到Microsoft Visual Studio\VC98\bin，运行vcvars32.bat以配置环境变量。<br>&nbsp;&nbsp;&nbsp; e.命令行OpenSSL目录下，执行nmake &#8211;f ms\ntdll.mak 编译成功后，在out32dll目录下，会有四个文件libeay32.dll libeay32.lib ssleay32.dll和 ssleay32.lib,将编译成功的lzo.lib libeay32.lib ssleay32.lib添加到工程中，并将libeay32.dll ssleay32.dll拷贝到Debug目录下,并且加入openssl的头文件到工程中，和lzo库类似的过程。<br><br>另外因为VC中不识别unsigned long long int类型，需改为_int64。修改&lt;common.h&gt;头文件: <br>
<div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; background-color: #eeeeee; font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: #000000;">#ifdef&nbsp;USE_64_BIT_COUNTERS<br></span><span style="color: #008000;">//</span><span style="color: #008000;">&nbsp;&nbsp;typedef&nbsp;unsigned&nbsp;long&nbsp;long&nbsp;int&nbsp;counter_type;</span><span style="color: #008000;"><br></span><span style="color: #000000;">typedef&nbsp;_int64&nbsp;counter_type;&nbsp;&nbsp;</span><span style="color: #008000;">//</span><span style="color: #008000;">qj&nbsp;modify</span><span style="color: #008000;"><br></span><span style="color: #000000;"><br>#&nbsp;ifdef&nbsp;WIN32<br>#&nbsp;&nbsp;define&nbsp;counter_format&nbsp;&nbsp;</span><span style="color: #000000;">"</span><span style="color: #000000;">%I64u</span><span style="color: #000000;">"</span><span style="color: #000000;"><br>#&nbsp;</span><span style="color: #0000ff;">else</span><span style="color: #000000;"><br>#&nbsp;&nbsp;define&nbsp;counter_format&nbsp;&nbsp;</span><span style="color: #000000;">"</span><span style="color: #000000;">%llu</span><span style="color: #000000;">"</span><span style="color: #000000;"><br>#&nbsp;endif<br></span><span style="color: #0000ff;">#else</span><span style="color: #000000;"><br>&nbsp;&nbsp;typedef&nbsp;unsigned&nbsp;</span><span style="color: #0000ff;">int</span><span style="color: #000000;">&nbsp;counter_type;<br>#&nbsp;define&nbsp;counter_format&nbsp;&nbsp;&nbsp;</span><span style="color: #000000;">"</span><span style="color: #000000;">%u</span><span style="color: #000000;">"</span><span style="color: #000000;"><br></span><span style="color: #0000ff;">#endif</span></div>
<br>再次编译，发现错误少多了，而且全部只是一些link错误了:<br>
<div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; background-color: #eeeeee; font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: #000000;">Linking<img src="http://www.cppblog.com/Images/dot.gif"><br>LINK&nbsp;:&nbsp;warning&nbsp;LNK4098:&nbsp;defaultlib&nbsp;</span><span style="color: #000000;">"</span><span style="color: #000000;">MSVCRT</span><span style="color: #000000;">"</span><span style="color: #000000;">&nbsp;conflicts&nbsp;with&nbsp;use&nbsp;of&nbsp;other&nbsp;libs;&nbsp;use&nbsp;</span><span style="color: #000000;">/</span><span style="color: #000000;">NODEFAULTLIB:library<br>cryptoapi.obj&nbsp;:&nbsp;error&nbsp;LNK2001:&nbsp;unresolved&nbsp;external&nbsp;symbol&nbsp;__imp__CertFreeCertificateContext@</span><span style="color: #000000;">4</span><span style="color: #000000;"><br>cryptoapi.obj&nbsp;:&nbsp;error&nbsp;LNK2001:&nbsp;unresolved&nbsp;external&nbsp;symbol&nbsp;__imp__CryptAcquireCertificatePrivateKey@</span><span style="color: #000000;">24</span><span style="color: #000000;"><br>cryptoapi.obj&nbsp;:&nbsp;error&nbsp;LNK2001:&nbsp;unresolved&nbsp;external&nbsp;symbol&nbsp;__imp__CertCloseStore@</span><span style="color: #000000;">8</span><span style="color: #000000;"><br>cryptoapi.obj&nbsp;:&nbsp;error&nbsp;LNK2001:&nbsp;unresolved&nbsp;external&nbsp;symbol&nbsp;__imp__CertOpenStore@</span><span style="color: #000000;">20</span><span style="color: #000000;"><br>cryptoapi.obj&nbsp;:&nbsp;error&nbsp;LNK2001:&nbsp;unresolved&nbsp;external&nbsp;symbol&nbsp;__imp__CertFindCertificateInStore@</span><span style="color: #000000;">24</span><span style="color: #000000;"><br>route.obj&nbsp;:&nbsp;error&nbsp;LNK2001:&nbsp;unresolved&nbsp;external&nbsp;symbol&nbsp;_GetIpForwardTable@</span><span style="color: #000000;">12</span><span style="color: #000000;"><br>route.obj&nbsp;:&nbsp;error&nbsp;LNK2001:&nbsp;unresolved&nbsp;external&nbsp;symbol&nbsp;_CreateIpForwardEntry@</span><span style="color: #000000;">4</span><span style="color: #000000;"><br>route.obj&nbsp;:&nbsp;error&nbsp;LNK2001:&nbsp;unresolved&nbsp;external&nbsp;symbol&nbsp;_DeleteIpForwardEntry@</span><span style="color: #000000;">4</span><span style="color: #000000;"><br>tun.obj&nbsp;:&nbsp;error&nbsp;LNK2001:&nbsp;unresolved&nbsp;external&nbsp;symbol&nbsp;_GetAdaptersInfo@</span><span style="color: #000000;">8</span><span style="color: #000000;"><br>tun.obj&nbsp;:&nbsp;error&nbsp;LNK2001:&nbsp;unresolved&nbsp;external&nbsp;symbol&nbsp;_IpReleaseAddress@</span><span style="color: #000000;">4</span><span style="color: #000000;"><br>tun.obj&nbsp;:&nbsp;error&nbsp;LNK2001:&nbsp;unresolved&nbsp;external&nbsp;symbol&nbsp;_GetInterfaceInfo@</span><span style="color: #000000;">8</span><span style="color: #000000;"><br>tun.obj&nbsp;:&nbsp;error&nbsp;LNK2001:&nbsp;unresolved&nbsp;external&nbsp;symbol&nbsp;_IpRenewAddress@</span><span style="color: #000000;">4</span><span style="color: #000000;"><br>tun.obj&nbsp;:&nbsp;error&nbsp;LNK2001:&nbsp;unresolved&nbsp;external&nbsp;symbol&nbsp;_AddIPAddress@</span><span style="color: #000000;">20</span><span style="color: #000000;"><br>tun.obj&nbsp;:&nbsp;error&nbsp;LNK2001:&nbsp;unresolved&nbsp;external&nbsp;symbol&nbsp;_FlushIpNetTable@</span><span style="color: #000000;">4</span><span style="color: #000000;"><br>tun.obj&nbsp;:&nbsp;error&nbsp;LNK2001:&nbsp;unresolved&nbsp;external&nbsp;symbol&nbsp;_DeleteIPAddress@</span><span style="color: #000000;">4</span><span style="color: #000000;"><br>tun.obj&nbsp;:&nbsp;error&nbsp;LNK2001:&nbsp;unresolved&nbsp;external&nbsp;symbol&nbsp;_GetAdapterIndex@</span><span style="color: #000000;">8</span><span style="color: #000000;"><br>Debug</span><span style="color: #000000;">/</span><span style="color: #000000;">openvpn.exe&nbsp;:&nbsp;fatal&nbsp;error&nbsp;LNK1120:&nbsp;</span><span style="color: #000000;">16</span><span style="color: #000000;">&nbsp;unresolved&nbsp;externals<br>Error&nbsp;executing&nbsp;link.exe.<br><br>openvpn.exe&nbsp;</span><span style="color: #000000;">-</span><span style="color: #000000;">&nbsp;</span><span style="color: #000000;">17</span><span style="color: #000000;">&nbsp;error(s),&nbsp;</span><span style="color: #000000;">1</span><span style="color: #000000;">&nbsp;warning(s)</span></div>
<br>&nbsp;首先解决crytoapi.obj的lnk错误，找到crytoapi.c文件中的CertFreeCertificateContext
函数，找到其声明:WinCrypt.h文件，<br>
<div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; background-color: #eeeeee; font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: #000000;">#include&nbsp;</span><span style="color: #000000;">&lt;</span><span style="color: #000000;">wincrypt.h</span><span style="color: #000000;">&gt;</span><span style="color: #000000;">&nbsp;&nbsp;</span><span style="color: #008000;">//</span><span style="color: #008000;">需要装PLATFORM&nbsp;SDK</span><span style="color: #008000;"><br></span><span style="color: #000000;">#pragma&nbsp;comment&nbsp;(lib,&nbsp;</span><span style="color: #000000;">"</span><span style="color: #000000;">crypt32.lib</span><span style="color: #000000;">"</span><span style="color: #000000;">)</span></div>
&nbsp;然后解决route.obj tun.obj的问题，也是通过route.c文件中的 GetIpForwardTable等其中一个link错误的函数，找到其声明文件:IPHlpApi.h<br>
<div style="border: 1px solid #cccccc; padding: 4px 5px 4px 4px; background-color: #eeeeee; font-size: 13px; width: 98%;"><!--<br><br>Code highlighting produced by Actipro CodeHighlighter (freeware)<br>http://www.CodeHighlighter.com/<br><br>--><span style="color: #000000;">#include&nbsp;</span><span style="color: #000000;">&lt;</span><span style="color: #000000;">iphlpapi.</span><span style="color: #000000;">h&gt;</span><span style="color: #000000;"><br>#pragma&nbsp;comment&nbsp;(lib,&nbsp;</span><span style="color: #000000;">"</span><span style="color: #000000;">iphlpapi.lib</span><span style="color: #000000;">"</span><span style="color: #000000;">)</span></div>
<br><br>最后再次编译，OK，开始你的openvpn代码调试吧！！！<br> <img src ="http://www.cppblog.com/qiujian5628/aggbug/64613.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/qiujian5628/" target="_blank">浪迹天涯</a> 2008-10-21 15:00 <a href="http://www.cppblog.com/qiujian5628/archive/2008/10/21/64613.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>libcurl上传文件实例</title><link>http://www.cppblog.com/qiujian5628/archive/2008/07/03/55212.html</link><dc:creator>浪迹天涯</dc:creator><author>浪迹天涯</author><pubDate>Thu, 03 Jul 2008 08:49:00 GMT</pubDate><guid>http://www.cppblog.com/qiujian5628/archive/2008/07/03/55212.html</guid><wfw:comment>http://www.cppblog.com/qiujian5628/comments/55212.html</wfw:comment><comments>http://www.cppblog.com/qiujian5628/archive/2008/07/03/55212.html#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://www.cppblog.com/qiujian5628/comments/commentRss/55212.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/qiujian5628/services/trackbacks/55212.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: 简单演示如何使用libcurl上传文件，并且使用tomcat，利用SmartUpload组件搭建了上传页面的测试环境，经测试libcurl成功POST文件......&nbsp;&nbsp;<a href='http://www.cppblog.com/qiujian5628/archive/2008/07/03/55212.html'>阅读全文</a><img src ="http://www.cppblog.com/qiujian5628/aggbug/55212.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/qiujian5628/" target="_blank">浪迹天涯</a> 2008-07-03 16:49 <a href="http://www.cppblog.com/qiujian5628/archive/2008/07/03/55212.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>libcurl使用心得</title><link>http://www.cppblog.com/qiujian5628/archive/2008/06/28/54873.html</link><dc:creator>浪迹天涯</dc:creator><author>浪迹天涯</author><pubDate>Sat, 28 Jun 2008 06:50:00 GMT</pubDate><guid>http://www.cppblog.com/qiujian5628/archive/2008/06/28/54873.html</guid><wfw:comment>http://www.cppblog.com/qiujian5628/comments/54873.html</wfw:comment><comments>http://www.cppblog.com/qiujian5628/archive/2008/06/28/54873.html#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://www.cppblog.com/qiujian5628/comments/commentRss/54873.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/qiujian5628/services/trackbacks/54873.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: libcurl的使用心得，比那个简明心得要更加具体。相信看了这个心得后，你应该对libcrul会有更加了解......&nbsp;&nbsp;<a href='http://www.cppblog.com/qiujian5628/archive/2008/06/28/54873.html'>阅读全文</a><img src ="http://www.cppblog.com/qiujian5628/aggbug/54873.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/qiujian5628/" target="_blank">浪迹天涯</a> 2008-06-28 14:50 <a href="http://www.cppblog.com/qiujian5628/archive/2008/06/28/54873.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>gsoap使用心得!</title><link>http://www.cppblog.com/qiujian5628/archive/2008/06/19/54019.html</link><dc:creator>浪迹天涯</dc:creator><author>浪迹天涯</author><pubDate>Thu, 19 Jun 2008 07:26:00 GMT</pubDate><guid>http://www.cppblog.com/qiujian5628/archive/2008/06/19/54019.html</guid><wfw:comment>http://www.cppblog.com/qiujian5628/comments/54019.html</wfw:comment><comments>http://www.cppblog.com/qiujian5628/archive/2008/06/19/54019.html#Feedback</comments><slash:comments>15</slash:comments><wfw:commentRss>http://www.cppblog.com/qiujian5628/comments/commentRss/54019.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/qiujian5628/services/trackbacks/54019.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: gsoap的一些使用心得，实际操作过程中遇到的一些问题，属于gsoap入门文章......&nbsp;&nbsp;<a href='http://www.cppblog.com/qiujian5628/archive/2008/06/19/54019.html'>阅读全文</a><img src ="http://www.cppblog.com/qiujian5628/aggbug/54019.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/qiujian5628/" target="_blank">浪迹天涯</a> 2008-06-19 15:26 <a href="http://www.cppblog.com/qiujian5628/archive/2008/06/19/54019.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>