VS2012无法解析printf,
VS2012 fails to resolve printf,
我刚刚重新安装了VS2012,当试图编译一个简单的"hello world"时,它找不到最基本的函数,我尝试过通过链接选项或编译器选项为c++寻找nostd或GCC中的一些类似选项,但未能做到
有人能告诉我我缺了什么吗?这显然是一个配置问题,我似乎无法解决
只是为了澄清一下,当我从命令行"cl test.cpp-o test.exe"中使用cl时,它是有效的,这意味着这是一些配置问题,我缺少
有人能帮忙吗?
1>------ Build started: Project: test, Configuration: Debug Win32 ------
1>Build started 8/24/2013 1:52:58 PM.
1>InitializeBuildStatus:
1> Touching "Debugtest.unsuccessfulbuild".
1>ClCompile:
1> test.cpp
1>LINK : warning LNK4044: unrecognized option '/map(filename)'; ignored
1>test.obj : error LNK2019: unresolved external symbol __imp__printf referenced in function _main
1>test.obj : error LNK2019: unresolved external symbol __RTC_CheckEsp referenced in function _main
1>test.obj : error LNK2001: unresolved external symbol __RTC_InitBase
1>test.obj : error LNK2001: unresolved external symbol __RTC_Shutdown
1>LINK : error LNK2001: unresolved external symbol _mainCRTStartup
1>C:_projectscodectestDebugtest.exe : fatal error LNK1120: 5 unresolved externals
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.47
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
添加子系统和入口点后出现相同错误
1>------ Build started: Project: test, Configuration: Debug Win32 ------
1>Build started 8/24/2013 2:37:29 PM.
1>InitializeBuildStatus:
1> Touching "Debugtest.unsuccessfulbuild".
1>ClCompile:
1> All outputs are up-to-date.
1>LINK : warning LNK4044: unrecognized option '/map(filename)'; ignored
1>LINK : warning LNK4075: ignoring '/INCREMENTAL' due to '/RELEASE' specification
1>main.obj : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/OPT:LBR' specification
1>main.obj : error LNK2019: unresolved external symbol __imp__printf referenced in function _main
1>main.obj : error LNK2019: unresolved external symbol __RTC_CheckEsp referenced in function _main
1>main.obj : error LNK2001: unresolved external symbol __RTC_InitBase
1>main.obj : error LNK2001: unresolved external symbol __RTC_Shutdown
1>C:_projectscodeCtestDebugtest.exe : fatal error LNK1120: 4 unresolved externals
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.17
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
需要注意的是,这是一个控制台项目
链接器选项:
/OUT:"C:_projectscodeCtestDebugtest.exe" /MANIFEST /NXCOMPAT /PDB:"C:_projectscodeCtestDebugtest.pdb" /DYNAMICBASE "kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "odbc32.lib" "odbccp32.lib" /DEBUG /MACHINE:X86 /ENTRY:"_tmain" /INCREMENTAL /PGD:"C:_projectscodeCtestDebugtest.pgd" /SUBSYSTEM:WINDOWS /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /ManifestFile:"Debugtest.exe.intermediate.manifest" /ERRORREPORT:PROMPT /NOLOGO /TLBID:1
c/c++选项:
/Yu"stdafx.h" /MP /GS /analyze- /W3 /Zc:wchar_t /ZI /Gm /Od /sdl /Fd"Debugvc110.pdb" /fp:precise /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_UNICODE" /D "UNICODE" /fp:except- /errorReport:prompt /WX- /Zc:forScope /RTC1 /GR- /Gd /Oy- /MDd /Fa"Debug" /nologo /Fo"Debug" /Fp"Debugtest.pch"
这里已经问了好几次了,但问题是您没有选择"Console"应用程序类型,而是选择了win32 gui。您也需要小心选择正确的链接器。
相关文章:
- 为什么在C的循环中使用printf的Rust代码不显示输出,而在C++的循环中显示std::cout
- 内联程序集printf将整数解释为地址
- 为什么mpfr_printf与十六进制浮点(%a转换说明符)的printf不同
- C++ Setter/Getter,cout 工作,printf 失败
- Printf 命令不打印时添加了查找常见除数的新代码
- SIGSEGV, 分段错误. 而 printf() 数组索引的值
- 为什么在包含iostream时可以使用printf()?
- 创建具有验证和语法突出显示的自定义 printf
- 0x%08lx 格式说明符在 printf 语句到 cout
- C printf 无法从终端按预期工作
- Printf 和 Echo 提供不同的输出
- C++ - scanf() 和 printf() 执行顺序不对
- cout 打印不准确的结果,printf 打印准确的结果
- 了解 printf 格式规范中的 %03.3u
- redefine printf(), sprintf(), etc. arm-none-eabi toolchain
- 为什么 printf 在 C++ 中的执行速度比 cout 快?另外scanf比cin慢,为什么?
- C++, printf vs cout performance
- printf 数据类型说明符复杂问题
- 在"printf"中使用标签"h"或"hh"是否涉及未定义的
- VS2012无法解析printf,