如何在VC下将mak文件导入 .

本文介绍如何使用VC将一堆.cpp和.h文件编译成库的方法,适用于VC6及更早版本。文章提供了具体步骤,包括配置环境、生成Makefile并利用Visual Studio进行编译。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 

转载自 http://blog.youkuaiyun.com/lantian1099/article/details/1833241

以下的内容只适合于EVC VC6,在VC2003版本以上不适用

参考代码下载地址

http://www.rayfile.com/zh-cn/files/8fa2a8a6-6fe5-11e1-b99b-0015c55db73d/

最近学校申请的项目立项了,总得做点什么,开始动手找一些经典的开源代码,下来一个,结果只有一堆.cpp和.h文件外加一个.mak文件,这一下子傻了,以前还从来没有碰到过这种东西,下来的都是.dsw或者.sin结尾的工程文件。

     那怎么样用VC把这些文件编译成库呢?问了几个人,也没什么进展。硬着头皮网上找资料,搜了N久,也没有找到合适的资料。突然想,这个代码的作者会不会考虑到我的痛苦,给出什么指点呢?于是乎,敲进URL,进去瞧了一下,真的有,下面是作者原话,我按照他的做法就可以了。
     How to configure and build the code on Windows
  1. Unpack and extract the '.tar.gz' file (using an application such as "WinZip").
  2. If the 'tools' directory on your Windows machine is something other than "c:/Program Files/DevStudio/Vc", change the "TOOLS32 =" line in the file "win32config".
  3. In a command shell, 'cd' to the "live" directory, and run
     genWindowsMakefiles
This will generate - in each subdirectory - a "*.mak" makefile suitable for use by (e.g.) Microsoft Visual Studio.
  • Alternatively, if you're starting from a Unix machine, you can generate the Windows Makefiles by running
     ./genWindowsMakefiles  
    (after - if necessary - changing the "TOOLS32 =" line in the file "win32config", as noted above). Then, copy the "live" directories and its subdirectories (in ASCII mode) to a Windows machine.
  • To use these Makefiles from within Visual Studio, use the "Open Workspace" menu command, then (in the file selection dialog) for "Files of type", choose "Makefiles (.mak)". Visual Studio should then prompt you, asking if you want to use this Makefile to set up a new project. Say "OK".
  • Doug Kosovic notes: Visual C++ 2003 no longer comes with the old I/O Streams headers iostreams.h et al, or the corresponding library msvcirt.lib. So anybody trying to build the LIVE555 code with VC++ 2003 might find the following useful: A non-sourcecode modification workaround for VC++ 2003 is to copy the missing headers and msvcirt.lib from VC++ 2002. In file 'win32config' add an extra -I switch to COMPILE_OPTS to find the old headers and a -LIBPATH: switch to LINK_OPTS_0 to find msvcirt.lib  
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值