error PRJ0003 : 生成“cl.exe”时出错 解决方案

本人已经安装了VS2010,但是同事给的项目是用VC2008写的,用到几个lib文件,路径也都正确,但就是无法正确解析,所以我怀疑是lib库生成的环境问题。所以考虑装个VC2008。但是我又不敢直接安装VS2008,怕破坏VS2010的环境,所以在网上找了个VC2008绿色精简版的包,下载地址:http://d1.amobbs.com/bbs_upload782111/files_50/ourdev_710509KTJTYR.rar,下载后根据说明进行安装,修改了必要的路径后,一切都很顺利。


但是编译程序出现标题中那种错误,真是莫名其妙。后来写了个Hello world程序,发现还是一样的问题。找来找去,摸索了很久,最终发现几个环境变量有问题,导致无法正确找到编译器及include目录等。


参考了下vc2010的安装目录,发现下载的这个包解压后的目录结构存在问题,难怪安装后不行。


调整目录结构,将以下目录移动到VC目录下:atlmfc、bin、crt、include、lib、redist,调整后的目录结构为:

D:\MICROSOFT\VC2008
├─Common7
│  ├─IDE
│  │  ├─2052
│  │  ├─ExceptionAssistantContent
│  │  │  └─2052
│  │  ├─Extensibility Projects
│  │  │  ├─CSharp
│  │  │  │  └─2052
│  │  │  ├─csharp-shared
│  │  │  ├─MCpp
│  │  │  │  └─2052
│  │  │  ├─VBasic
│  │  │  │  └─2052
│  │  │  ├─vbasic-shared
│  │  │  ├─VCATL
│  │  │  │  └─2052
│  │  │  └─vcatl-shared
│  │  ├─ItemTemplatesCache
│  │  ├─MacroProjectItems
│  │  ├─MacroProjects
│  │  ├─NewFileItems
│  │  ├─NewScriptItems
│  │  ├─PrivateAssemblies
│  │  │  ├─1033
│  │  │  ├─2052
│  │  │  └─zh-CHS
│  │  ├─Profiles
│  │  ├─ProjectTemplatesCache
│  │  ├─PublicAssemblies
│  │  │  ├─zh-CHS
│  │  │  └─zh-CN
│  │  ├─SolutionTemplates
│  │  ├─Themes
│  │  ├─VS SCC
│  │  │  └─2052
│  │  ├─Xml
│  │  │  ├─2052
│  │  │  └─zh-CHS
│  │  ├─zh-CHS
│  │  └─zh-CN
│  ├─Packages
│  │  ├─1033
│  │  │  └─schemas
│  │  ├─2052
│  │  │  └─schemas
│  │  │      └─CSS
│  │  ├─Debugger
│  │  │  ├─2052
│  │  │  ├─Visualizers
│  │  │  │  ├─Original
│  │  │  │  └─zh-CHS
│  │  │  └─x86
│  │  └─schemas
│  │      ├─html
│  │      └─xml
│  │          └─2052
│  └─Tools
│      ├─2052
│      ├─Deployment
│      │  ├─2052
│      │  ├─VsdDialogs
│      │  │  ├─0
│      │  │  ├─1028
│      │  │  ├─1031
│      │  │  ├─1033
│      │  │  ├─1036
│      │  │  ├─1040
│      │  │  ├─1041
│      │  │  ├─1042
│      │  │  ├─1046
│      │  │  ├─1049
│      │  │  ├─2052
│      │  │  └─3082
│      │  ├─VsdProjects
│      │  ├─VsdSchema
│      │  └─Vspkgs
│      │      └─2052
│      ├─Templates
│      │  ├─Database Project Items
│      │  └─Database Projects
│      └─VDT
│          └─2052
├─PlatformSDK
│  ├─Include
│  │  └─gl
│  └─Lib
├─ReportViewer
│  ├─zh-CHS
│  └─zh-CN
├─SDK
│  └─V6.0A
│      ├─bin
│      │  ├─en-us
│      │  ├─msitools
│      │  │  ├─Schemas
│      │  │  │  └─MSI
│      │  │  │      ├─100
│      │  │  │      ├─110
│      │  │  │      ├─120
│      │  │  │      └─intl
│      │  │  └─Templates
│      │  │      └─MSI
│      │  ├─vsstools
│      │  └─zh-CHS
│      └─Bootstrapper
│          ├─Engine
│          │  ├─de
│          │  ├─en
│          │  ├─es
│          │  ├─fr
│          │  ├─it
│          │  ├─ja
│          │  ├─ko
│          │  ├─pt-BR
│          │  ├─ru
│          │  ├─zh-CHS
│          │  └─zh-CHT
│          ├─Packages
│          │  ├─DotNetFX
│          │  │  └─zh-CHS
│          │  ├─DotNetFX30
│          │  │  └─zh-CHS
│          │  ├─DotNetFX35
│          │  │  └─zh-CHS
│          │  ├─ReportViewer
│          │  │  └─zh-CHS
│          │  ├─SqlExpress
│          │  │  └─zh-CHS
│          │  ├─VBPowerPacks
│          │  │  └─zh-CHS
│          │  ├─vcredist_x64
│          │  │  └─zh-CHS
│          │  ├─vcredist_x86
│          │  │  └─zh-CHS
│          │  ├─VSTOR30
│          │  │  └─zh-chs
│          │  └─WindowsInstaller3_1
│          │      └─zh-CHS
│          └─Schemas
├─System
│  ├─assembly
│  ├─Common Files
│  │  ├─CAPICOM
│  │  ├─Designer
│  │  ├─Merge Modules
│  │  ├─MSDesigners8
│  │  │  └─Resources
│  │  │      └─2052
│  │  ├─MSEnv
│  │  │  ├─2052
│  │  │  ├─PublicAssemblies
│  │  │  │  └─zh-CN
│  │  │  └─zh-CHS
│  │  ├─MSI Tools
│  │  ├─SQL Debugging
│  │  ├─Visual Database Tools
│  │  ├─VS7Debug
│  │  │  └─2052
│  │  ├─VSA
│  │  │  └─9.0
│  │  │      ├─Common
│  │  │      │  ├─2052
│  │  │      │  └─VSAProjectItems
│  │  │      │      └─Project Items
│  │  │      └─VsaEnv
│  │  │          ├─2052
│  │  │          ├─Packages
│  │  │          │  ├─2052
│  │  │          │  └─Debugger
│  │  │          │      └─2052
│  │  │          ├─SolutionTemplates
│  │  │          └─zh-CHS
│  │  ├─VsDeploy
│  │  └─WMI
│  ├─symbols
│  │  └─dll
│  └─System32
│      └─2052
├─VC
│  ├─atlmfc
│  │  ├─include
│  │  │  ├─l.chs
│  │  │  ├─l.cht
│  │  │  └─res
│  │  ├─lib
│  │  └─src
│  │      ├─atl
│  │      │  └─atls
│  │      │      └─INTEL
│  │      ├─mfc
│  │      │  ├─intel
│  │      │  ├─l.chs
│  │      │  └─l.cht
│  │      └─mfcm
│  │          ├─INTEL
│  │          └─interfaces
│  ├─bin
│  │  ├─2052
│  │  └─zh-CHS
│  ├─crt
│  │  └─src
│  │      ├─cliext
│  │      ├─intel
│  │      │  ├─dll_lib
│  │      │  │  ├─clr_obj
│  │      │  │  └─pure_obj
│  │      │  ├─mt_lib
│  │      │  ├─xdll_lib
│  │      │  │  ├─clr_obj
│  │      │  │  └─pure_obj
│  │      │  └─xmt_lib
│  │      ├─msclr
│  │      │  └─com
│  │      └─sys
│  ├─include
│  │  ├─cliext
│  │  ├─CodeAnalysis
│  │  ├─msclr
│  │  │  └─com
│  │  └─sys
│  ├─lib
│  ├─redist
│  │  ├─Debug_NonRedist
│  │  │  └─x86
│  │  │      ├─Microsoft.VC90.DebugCRT
│  │  │      ├─Microsoft.VC90.DebugMFC
│  │  │      └─Microsoft.VC90.DebugOpenMP
│  │  └─x86
│  │      ├─Microsoft.VC90.ATL
│  │      ├─Microsoft.VC90.CRT
│  │      ├─Microsoft.VC90.MFC
│  │      ├─Microsoft.VC90.MFCLOC
│  │      └─Microsoft.VC90.OPENMP
│  ├─VCAddClass
│  │  ├─ATL
│  │  │  └─WMI
│  │  ├─Generic
│  │  ├─MFC
│  │  └─VCNet
│  ├─VCContextItems
│  ├─VCNewItems
│  ├─VcPackages
│  │  └─2052
│  ├─VCProjectDefaults
│  ├─VcProjectitems
│  │  ├─Code
│  │  ├─Data
│  │  ├─PropertySheets
│  │  ├─Resource
│  │  ├─UI
│  │  ├─Utility
│  │  └─Web
│  ├─VcProjects
│  │  ├─ATL
│  │  ├─General
│  │  ├─MFC
│  │  ├─vcNET
│  │  └─Win32
│  ├─VCResourceTemplates
│  │  └─2052
│  └─VCWizards
│      ├─1033
│      │  └─Images
│      ├─2052
│      ├─AppWiz
│      │  ├─.NET
│      │  │  ├─ClassLibrary
│      │  │  │  ├─Scripts
│      │  │  │  │  └─2052
│      │  │  │  └─Templates
│      │  │  │      └─2052
│      │  │  ├─Console
│      │  │  │  ├─Scripts
│      │  │  │  │  └─2052
│      │  │  │  └─Templates
│      │  │  │      └─2052
│      │  │  ├─ControlLibrary
│      │  │  │  ├─scripts
│      │  │  │  │  └─2052
│      │  │  │  └─templates
│      │  │  │      └─2052
│      │  │  ├─EmptyProject
│      │  │  │  └─Scripts
│      │  │  │      └─2052
│      │  │  ├─WinForm
│      │  │  │  ├─scripts
│      │  │  │  │  └─2052
│      │  │  │  └─templates
│      │  │  │      └─2052
│      │  │  └─WinService
│      │  │      ├─scripts
│      │  │      │  └─2052
│      │  │      └─templates
│      │  │          └─2052
│      │  ├─ATL
│      │  │  └─ATLProject
│      │  │      ├─html
│      │  │      │  └─2052
│      │  │      ├─Images
│      │  │      ├─scripts
│      │  │      │  └─2052
│      │  │      └─templates
│      │  │          └─2052
│      │  ├─Generic
│      │  │  ├─Application
│      │  │  │  ├─html
│      │  │  │  │  └─2052
│      │  │  │  ├─images
│      │  │  │  ├─scripts
│      │  │  │  │  └─2052
│      │  │  │  └─templates
│      │  │  │      └─2052
│      │  │  ├─CustomWizard
│      │  │  │  ├─HTML
│      │  │  │  │  └─2052
│      │  │  │  ├─Images
│      │  │  │  ├─Scripts
│      │  │  │  │  └─2052
│      │  │  │  └─Templates
│      │  │  │      └─2052
│      │  │  └─MakefileProject
│      │  │      ├─HTML
│      │  │      │  └─2052
│      │  │      ├─Images
│      │  │      ├─Scripts
│      │  │      │  └─2052
│      │  │      └─Templates
│      │  │          └─2052
│      │  └─MFC
│      │      ├─Application
│      │      │  ├─html
│      │      │  │  └─2052
│      │      │  ├─images
│      │      │  ├─scripts
│      │      │  │  └─2052
│      │      │  └─templates
│      │      │      ├─1028
│      │      │      ├─1031
│      │      │      ├─1033
│      │      │      ├─1036
│      │      │      ├─1040
│      │      │      ├─1041
│      │      │      ├─1042
│      │      │      ├─2052
│      │      │      └─3082
│      │      ├─Control
│      │      │  ├─html
│      │      │  │  └─2052
│      │      │  ├─images
│      │      │  ├─scripts
│      │      │  │  └─2052
│      │      │  └─templates
│      │      │      └─2052
│      │      └─Library
│      │          ├─html
│      │          │  └─2052
│      │          ├─Images
│      │          ├─scripts
│      │          │  └─2052
│      │          └─templates
│      │              └─2052
│      └─CodeWiz
│          ├─.NET
│          │  ├─Component
│          │  │  ├─scripts
│          │  │  │  └─2052
│          │  │  └─templates
│          │  │      └─2052
│          │  ├─Installer
│          │  │  ├─scripts
│          │  │  │  └─2052
│          │  │  └─templates
│          │  │      └─2052
│          │  ├─UserControl
│          │  │  ├─scripts
│          │  │  │  └─2052
│          │  │  └─templates
│          │  │      └─2052
│          │  ├─WinForm
│          │  │  ├─Scripts
│          │  │  │  └─2052
│          │  │  └─Templates
│          │  │      └─2052
│          │  └─XMLSchema
│          │      ├─Scripts
│          │      │  └─2052
│          │      └─Templates
│          │          └─2052
│          ├─ATL
│          │  ├─AddToMFC
│          │  │  ├─Images
│          │  │  ├─Scripts
│          │  │  │  └─2052
│          │  │  └─Templates
│          │  │      └─2052
│          │  ├─ASP
│          │  │  ├─HTML
│          │  │  │  └─2052
│          │  │  ├─Images
│          │  │  ├─Scripts
│          │  │  │  └─2052
│          │  │  └─Templates
│          │  │      └─2052
│          │  ├─Consumer
│          │  │  ├─HTML
│          │  │  │  └─2052
│          │  │  ├─Images
│          │  │  ├─Scripts
│          │  │  │  └─2052
│          │  │  └─Templates
│          │  │      └─2052
│          │  ├─Control
│          │  │  ├─HTML
│          │  │  │  └─2052
│          │  │  ├─Images
│          │  │  ├─Scripts
│          │  │  │  └─2052
│          │  │  └─Templates
│          │  │      └─2052
│          │  ├─DLG
│          │  │  ├─HTML
│          │  │  │  └─2052
│          │  │  ├─Images
│          │  │  ├─Scripts
│          │  │  │  └─2052
│          │  │  └─Templates
│          │  │      └─2052
│          │  ├─Event
│          │  │  ├─HTML
│          │  │  │  └─2052
│          │  │  ├─Images
│          │  │  ├─Scripts
│          │  │  │  └─2052
│          │  │  └─Templates
│          │  │      └─2052
│          │  ├─ImplementInterface
│          │  │  ├─HTML
│          │  │  │  └─2052
│          │  │  ├─Images
│          │  │  ├─Scripts
│          │  │  │  └─2052
│          │  │  └─Templates
│          │  │      └─2052
│          │  ├─Instance
│          │  │  ├─HTML
│          │  │  │  └─2052
│          │  │  ├─Images
│          │  │  ├─Scripts
│          │  │  │  └─2052
│          │  │  └─Templates
│          │  │      └─2052
│          │  ├─Method
│          │  │  ├─HTML
│          │  │  │  └─2052
│          │  │  ├─Images
│          │  │  └─Scripts
│          │  │      └─2052
│          │  ├─MTS
│          │  │  ├─HTML
│          │  │  │  └─2052
│          │  │  ├─Images
│          │  │  ├─scripts
│          │  │  │  └─2052
│          │  │  └─Templates
│          │  │      └─2052
│          │  ├─PPG
│          │  │  ├─HTML
│          │  │  │  └─2052
│          │  │  ├─Images
│          │  │  ├─Scripts
│          │  │  │  └─2052
│          │  │  └─Templates
│          │  │      └─2052
│          │  ├─Property
│          │  │  ├─HTML
│          │  │  │  └─2052
│          │  │  ├─Images
│          │  │  └─Scripts
│          │  │      └─2052
│          │  ├─Provider
│          │  │  ├─HTML
│          │  │  │  └─2052
│          │  │  ├─Images
│          │  │  ├─Scripts
│          │  │  │  └─2052
│          │  │  └─Templates
│          │  │      └─2052
│          │  ├─Simple
│          │  │  ├─HTML
│          │  │  │  └─2052
│          │  │  ├─Images
│          │  │  ├─Scripts
│          │  │  │  └─2052
│          │  │  └─Templates
│          │  │      └─2052
│          │  └─SRFFile
│          │      ├─Scripts
│          │      │  └─2052
│          │      └─Templates
│          │          └─2052
│          ├─Generic
│          │  ├─Class
│          │  │  ├─HTML
│          │  │  │  └─2052
│          │  │  ├─Images
│          │  │  └─Scripts
│          │  │      └─2052
│          │  ├─DEFFile
│          │  │  ├─Scripts
│          │  │  │  └─2052
│          │  │  └─Templates
│          │  │      └─2052
│          │  ├─PropertySheet
│          │  │  ├─Scripts
│          │  │  │  └─2052
│          │  │  └─Templates
│          │  │      └─2052
│          │  ├─RCFile
│          │  │  ├─Scripts
│          │  │  │  └─2052
│          │  │  └─Templates
│          │  │      └─2052
│          │  └─ResourceScript
│          │      ├─scripts
│          │      │  └─2052
│          │      └─Templates
│          │          └─2052
│          └─MFC
│              ├─AxControl
│              │  ├─HTML
│              │  │  └─2052
│              │  ├─Images
│              │  ├─Scripts
│              │  │  └─2052
│              │  └─Templates
│              │      └─2052
│              ├─CommandHandler
│              │  ├─HTML
│              │  │  └─2052
│              │  ├─Images
│              │  └─Scripts
│              │      └─2052
│              ├─Consumer
│              │  ├─HTML
│              │  │  └─2052
│              │  ├─Images
│              │  ├─Scripts
│              │  │  └─2052
│              │  └─Templates
│              │      └─2052
│              ├─Event
│              │  ├─HTML
│              │  │  └─2052
│              │  ├─Images
│              │  └─Scripts
│              │      └─2052
│              ├─Function
│              │  ├─HTML
│              │  │  └─2052
│              │  ├─Images
│              │  └─Scripts
│              │      └─2052
│              ├─Simple
│              │  ├─HTML
│              │  │  └─2052
│              │  ├─Images
│              │  ├─scripts
│              │  │  └─2052
│              │  └─Templates
│              │      └─2052
│              ├─Typelib
│              │  ├─HTML
│              │  │  └─2052
│              │  ├─Images
│              │  ├─Scripts
│              │  │  └─2052
│              │  └─Templates
│              │      └─2052
│              └─Variable
│                  ├─HTML
│                  │  └─2052
│                  ├─Images
│                  ├─Scripts
│                  │  └─2052
│                  └─Templates
│                      └─2052
└─Xml
    ├─2052
    │  └─Snippets
    │      ├─xsd
    │      │  ├─Attributes
    │      │  ├─ComplexTypes
    │      │  ├─Elements
    │      │  ├─Extensions
    │      │  ├─Misc
    │      │  └─SimpleTypes
    │      └─xslt
    │          ├─html
    │          └─xslTags
    └─Schemas
        └─2052
            └─MSBuild

经过以上调整后,再安装VC2008,编译Hello world成功。后来又建立了一个基于对话框的MFC程序,又出了问题。。。。。。


总之一句话,只要好好设置各个include, lib等目录,相信一定可以解决问题的!我就是那样解决的!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值