关于#pragma comment

other123othe 2014-09-14 12:04:29

#pragma comment(linker,"/NODEFAULTLIB:LIBCMT.lib")
#pragma comment(linker,"/NODEFAULTLIB:LIBC.lib")


这两句话 什么意思?
...全文
596 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
赵4老师 2014-09-22
  • 打赏
  • 举报
回复
Linker Reference Home | Overview | How Do I | FAQ | Details LINK is a 32-bit tool that links Common Object File Format (COFF) object files and libraries to create a 32-bit executable (.EXE) file or dynamic-link library (DLL). Following is a comprehensive list of options for LINK.EXE. For information on how to specify an option, see Set Linker Options. This section also includes information on Compiler-Controlled LINK Options, LINK Input Files, and LINK Output. Option Action /ALIGN:number Specifies the alignment of each section /BASE:{address | @filename,key} Sets a base address for the program /COMMENT:["]comment["] Inserts a comment string into header /DEBUG Creates debugging information /DEBUGTYPE:CV /DEBUGTYPE:COFF /DEBUGTYPE:BOTH Creates particular formats of debugging information /DEF:filename Passes a module-definition (.DEF) file to the linker /DEFAULTLIB:library Searches specified library when resolving external references /DELAY Controls the delayed loading of DLLs /DELAYLOAD Causes the delayed loading of the specified DLL /DLL Builds a DLL /DRIVER[:UPONLY] Creates a Windows NT kernel mode driver /ENTRY:function Sets the starting address /EXETYPE:DYNAMIC Builds a virtual device driver /EXPORT Exports a function /FIXED[:NO] Creates a program that can be loaded only at its preferred base address /FORCE[:{MULTIPLE|UNRESOLVED}] Forces link to complete in spite of unresolved or multiply defined symbols /GPSIZE:# Specifies the size of communal variables for MIPS and Alpha platforms /HEAP:reserve[,commit] Sets the size of the heap in bytes /IMPLIB:filename Overrides the default import library name /INCLUDE:symbol Forces symbol references /INCREMENTAL:{YES|NO} Controls incremental linking /LARGEADDRESSAWARE Tells the compiler that the application supports addresses larger than two gigabytes. /LIBPATH:path Allows the user to override the environmental library path /LINK50COMPAT Generates import libraries in Visual C++ Version 5.0 format /MACHINE:{IX86|ALPHA|ARM|MIPS|MIPSR41XX|PPC|SH3|SH4} Specifies the target platform /MAP Creates a map file /MAPINFO:{EXPORTS|FIXUPS|LINES} Includes the specified information in the map file /MERGE:from=to Combines sections /NODEFAULTLIB[:library] Ignores all (or specified) default libraries when resolving external references /NOENTRY Creates a resource-only DLL /NOLOGO Suppresses startup banner /OPT:{REF|NOREF|ICF[,iterations]|NOICF} Controls LINK optimizations /ORDER:@filename Places COMDATs into the image in a predetermined order /OUT:filename Specifies the output file name /PDB:filename Creates a program database (.PDB) file /PDBTYPE:{con[solidate]|sept[ypes]} Specifies where to store the Program Database (PDB) debug type information. /PROFILE Enables profiling (creates a mapfile) /RELEASE Sets the checksum in the .EXE header /SECTION:name,attributes Overrides the attributes of a section /STACK:reserve[,commit] Sets the size of the stack in bytes /STUB:filename Attaches an MS-DOS stub program to a Win32 program /SUBSYSTEM:{CONSOLE|WINDOWS|NATIVE|POSIX|WINDOWSCE} [,major[.minor] ] Tells the operating system how to run the .EXE file /SWAPRUN:{NET|CD} Tells the operating system to copy the linker output to a swap file before running it /VERBOSE[:LIB] Prints linker progress messages /VERSION:major[.minor] Assigns a version number /VXD Creates a virtual device driver (VxD) /WARN[:level] Specifies warning level /WS:AGGRESSIVE Aggressively trim process memory For related information, see Compiler-Controlled LINK Options.
pipi20091001 2014-09-22
  • 打赏
  • 举报
回复
加载lib库的,也可以再设置环境里配置,如果多个之间必须用分号。对于调用第三方类包的,用这种方式很方便,再开发环境里设置比较麻烦。
dvlinker 2014-09-19
  • 打赏
  • 举报
回复
引用 2 楼 zwfgdlc 的回复:
正解!
Cherishe7 2014-09-19
  • 打赏
  • 举报
回复
加载库的,百度一下
feng6300 2014-09-19
  • 打赏
  • 举报
回复
#pragma ...是预处理指令,它的作用是设定编译器的状态或者是指示编译器完成一些特定的动作。 例如#pragma once:只要在头文件的最开始加入这条指令就能够保证头文件被编译一次。 例如#pragma hdrstop:表示预编译头文件到此为止,后面的头文件不进行预编译。 而#pragma comment的作用:该指令将一个注释记录放入一个对象文件或可执行文件中。 常用的lib关键字,可以帮我们连入一个库文件。如: #pragma comment(lib, "comctl32.lib") #pragma comment(lib, "vfw32.lib") #pragma comment(lib, "wsock32.lib") #pragma comment(linker,"/NODEFAULTLIB:LIBCMT.lib") #pragma comment(linker,"/NODEFAULTLIB:LIBC.lib") 这两行:就是忽略相关库的连接。 这是代码的实现,在IDE中的也可设置,就像2L和3L图示那样。 #pragma comment的作用具体请移步:http://baike.baidu.com/view/3487831.htm?fr=aladdin
other123othe 2014-09-15
  • 打赏
  • 举报
回复
引用 2 楼 zwfgdlc 的回复:
谢谢!
真相重于对错 2014-09-14
  • 打赏
  • 举报
回复
msdn 上有详细解释
zwfgdlc 2014-09-14
  • 打赏
  • 举报
回复

16,471

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC相关问题讨论
社区管理员
  • 基础类社区
  • Web++
  • encoderlee
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

        VC/MFC社区版块或许是CSDN最“古老”的版块了,记忆之中,与CSDN的年龄几乎差不多。随着时间的推移,MFC技术渐渐的偏离了开发主流,若干年之后的今天,当我们面对着微软的这个经典之笔,内心充满着敬意,那些曾经的记忆,可以说代表着二十年前曾经的辉煌……
        向经典致敬,或许是老一代程序员内心里面难以释怀的感受。互联网大行其道的今天,我们期待着MFC技术能够恢复其曾经的辉煌,或许这个期待会永远成为一种“梦想”,或许一切皆有可能……
        我们希望这个版块可以很好的适配Web时代,期待更好的互联网技术能够使得MFC技术框架得以重现活力,……

试试用AI创作助手写篇文章吧