当前位置:首页 » 编程软件 » oneurlvs编译

oneurlvs编译

发布时间: 2022-10-25 19:29:35

⑴ vs2010如何编译驱动

1、安装VS2010,安装WDK 7.0(DDK);

2、新建VC++->Empty Project

3、打开Configuration Manager 并新建一个名称为“ dirver ”的Solution Configuration 并将“dirver” 设为Active Solution Configuration .

4、打开View-> property Manager。

5、在"dirver" solution configuration 上点击右键,选择Add new property Sheet。取名为“dirverProperty”. 并对他进下以下设置。

5.1. C\C++ - General - Debug Information Format = Program Database (/Zi)
5.2. C\C++ - Preprocessor - Preprocessor Definitions = _X86_ [add also DBG for Debug config]
【WIN32;_DEBUG;_X86_;i386;STD_CALL;CONDITION_HANDLING;WIN32_LEAN_AND_MEAN;NT_UP;SRVDBG;DBG;_IDWBUILD;_WIN32_WINNT=0x0400;% (PreprocessorDefinitions)】
5.3. C\C++ - Code Generation - Enable C++ Exceptions = No
5.4. C\C++ - Code Generation - Basic Runtime Checks = Default
5.5. C\C++ - Code Generation - Buffer Security Check = No (/GS-)
5.6. C\C++ - Advanced - Calling Convention = __stdcall (/Gz)
5.7. C\C++ - Advanced - Compile As = Compile as C Code (/TC) [if you are going to use plain C]
5.8. Linker - General - Output File = $(OutDir)\$(ProjectName).sys
5.9. Linker - General - Enable Incremental Linking = Default
5.10. Linker - Input - Additional Dependencies = ntoskrnl.lib hal.lib $(NOINHERIT) [add here needed libs here e.g. ntoskrnl.lib hal.lib]
【不知道上面是不是笔误,应该为:ntoskrnl.lib;hal.lib;%(AdditionalDependencies)】
5.11. Linker - Input - Ignore All Default Libraries = Yes (/NODEFAULTLIB)
5.12. Linker - Manifest File - Generate Manifest = No
5.13. Linker - System - SubSystem = Native (/SUBSYSTEM:NATIVE)
5.14. Linker - System - Driver = Driver (/DRIVER)
5.15. Linker - Advanced - Entry Point = DriverEntry
5.16. Linker - Advanced - Base Address = 0x10000
5.17. Linker - Advanced - Randomized Base Address = Disable (/DYNAMICBASE:NO)
【这个也是错误的:应该置空】
5.18. Linker - Advanced - Data Execution Prevention (DEP) = Disable (/NXCOMPAT:NO)
【这个也是错误的:应该置空】

6. Config VC++ Directories
6.1 Open Open up property manager by clicking on Menu View->Property Manager.
6.2 Expand the project node and then the Configuration|Platform nodes, you will see "Microsoft.cpp.<Platform>.users" file for each Configuration|Platform. These are the files

for the global settings, similar to the old tools/Options/VC++ Directories.
6.3 Multi-Select "Microsoft.cpp.<Platform>.users", right click and bring up the property page window
6.4 In the property page window, click on "VC++ Directories" (for example) in the left pane, add new paths for the directories such as "Include Directories". separated by

semicolons
(eg:Include Directories config As:
$(ddkroot)\INC
$(ddkroot)\INC\WNET
$(ddkroot)\INC\DDK\WNET
Library Directories config As:
$(ddkroot)\LIB\WNET\I386
)
6.5 Make sure to save the settings before shutting down Visual Studio.
6.6 Re-launch Visual Studio and the new settings will be in effect.
6.7 Note: If you would like to only change the settings for one project, you can right click on the project and bring up the property page. Change the settings for “VC++

Directories”, these settings will be persisted to the project file.
七. OK. Have done. Now you can test it with simple code, e.g.:

#include "ntddk.h"

NTSTATUS
DriverEntry(PDRIVER_OBJECT DriverObject,PUNICODE_STRING RegistryPath)
{
return STATUS_UNSUCCESSFUL;
}

特别说明:
1.
Visual Studio 2010 在智能设备开发方面只支持Windows Phone OS 7.0。如果你要为Windows CE 5.0和Windows Mobile 6.5开发应用程序,请安装Visual Studio 2008。
2.
做驱动开发时,SDK的版本要和WDK的版本一致,即Win7 WDK要配Win7 SDK,否则会出现编译错误。VS2010里集成了Windows SDK 7.0A。
3.
如果出现类似如下编译错误,解决方法是:拷贝C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\sal.h,然后覆盖掉C:\WinDDK\7600.16385.1\inc\api\sal.h。

C:\Program Files\Microsoft Visual Studio 10.0\VC\include\crtdefs.h(550): error C2143: syntax error : missing ')' before 'const'
C:\Program Files\Microsoft Visual Studio 10.0\VC\include\crtdefs.h(550): error C2143: syntax error : missing '{' before 'const'
.......

⑵ VS2015专业版 C++编译中出现MSB4184错误

不会!!!!!

⑶ WIN7 64位系统,VS2010 x64中PCL all-in-one配置,编译时出现问题,具体如下列图片所示,求大神解答。

1、出现错误:fatal error LNK1123: 转换到 COFF 期间失败: 文件无效或损坏
解决方案:项目\属性\配置属性\清单工具\输入和输出\嵌入清单:原来是“是”,改成“否”。
Q:该方法治标不治本,每次新建一个项目时都要重新配置。还有为什么这么做就能解决该问题呢?
A:1)治本的方法:
<1>项目\属性\配置属性\清单工具\输入和输出\嵌入清单:原来是“是”,改成“否”。
<2>项目|项目属性|配置属性|连接器|清单文件|生成清单 “是”改为“否”。
<3>若以上两步后仍没解决问题,则按照以下方法解决:
查找是否有两个cvtres.exe。一个是C:\Program Files(x86)\Microsoft Visual Studio 10.0\vc\bin\cvtres.exe, 另一个是C:\Windows\Microsoft.NET\Framework\v4.0.30319\cvtres.exe。右键属性|详细信息 查看两者版本号,删除/重命名较旧的版本,或者重新设置Path变量。
删除旧版本的cvtres.exe后,就不需要每次都设置配置了。
2)为什么这么操作可以解决问题?笔者未查明原因,同仁们有清楚的可以给出评论。

2、1>lena.obj : error LNK2019: 无法解析的外部符号 _cvReleaseImage,该符号在函数 _main 中被引用
1>lena.obj : error LNK2019: 无法解析的外部符号 _cvDestroyWindow,该符号在函数 _main 中被引用
1>lena.obj : error LNK2019: 无法解析的外部符号 _cvWaitKey,该符号在函数 _main 中被引用
1>lena.obj : error LNK2019: 无法解析的外部符号 _cvShowImage,该符号在函数 _main 中被引用
1>lena.obj : error LNK2019: 无法解析的外部符号 _cvNamedWindow,该符号在函数 _main 中被引用
1>lena.obj : error LNK2019: 无法解析的外部符号 _cvLoadImage,该符号在函数 _main 中被引用
1>c:\users\yunyan\documents\visual studio 2010\Projects\lena\Debug\lena.exe : fatal error LNK1120: 6 个无法解析的外部命令
1>
1>生成失败。
1>
1>已用时间 00:00:01.52
========== 生成: 成功 0 个,失败 1 个,最新 0 个,跳过 0 个 ==========
解决方案:出现错误的原因可能有二,一种是系统配置不对(如x64位下仍使用Win32则错),另一种是少添加了库。笔者的是第一种原因,因为一直习惯了在x86下编写Win32程序,所以编译的时候仍使用了Win32,那么必然运行失败。该问题怎么破呢?如下:
右击项目名称,选择“属性”,弹出页面的最上方中间一项“平台”选择x64,在该平台下按照OpenCV中文网的配置过程。

c语言结构体初始化(编译系统vs2010)

.location 这种叫按名称初始化,是gun对c的扩展,只有gnu支持,就是linux下的编译器支持(gcc, g++)
程序员写代码的时候,最好使用被广泛支持的标准,尽量不要使用个别编译器的私有定义。

关注优酷上的 ”C学习指南“,在第10章里会讲这个问题。

⑸ 在VS中编译C++程序,发现数组中结束标记并非'\0',而是一个值为-52的特殊字符

这很正常,因为你申请了5个元素的空间,而你的字符串长度不够,没有充分利用这段空间。
恰巧你又工作在vc的debug模式下,在这个模式下,vc会自动把所有栈上数据填充成0xcc
"烫烫烫烫",也就是你看到的-52

热点内容
玉林电信dns服务器地址 发布:2025-07-04 07:17:34 浏览:435
用镜像压缩 发布:2025-07-04 07:17:31 浏览:633
lgg3如何设置锁屏密码 发布:2025-07-04 06:41:39 浏览:344
sqlserver2005命令 发布:2025-07-04 06:27:08 浏览:732
压缩文件啥样 发布:2025-07-04 06:21:42 浏览:298
linux的回车换行 发布:2025-07-04 06:21:39 浏览:132
c语言的窗口 发布:2025-07-04 06:20:54 浏览:983
androidk线图 发布:2025-07-04 06:19:15 浏览:131
华为荣耀6短信加密 发布:2025-07-04 06:18:30 浏览:815
sqlserver2008链接 发布:2025-07-04 06:15:54 浏览:909