我用编辑器编辑的一段代码,文件名3.h
#include <windows.h>
int CALLBACK WinMain(HINSTANCE hInstance,HINSTANCE hPreInstance,LPSTR lpStr,int nCmdShow)
{
MessageBox(NULL,"OK","information",MB_OK);
return(0);
}
为什么用cl 3.h,产生如下错误:
I:\3>cl 3.c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8168 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.3.c
Microsoft (R) Incremental Linker Version 6.00.8168
Copyright (C) Microsoft Corp 1992-1998. All rights reserved./out:3.exe
3.obj
3.obj : error LNK2001: unresolved external symbol __imp__MessageBoxA@16
3.exe : fatal error LNK1120: 1 unresolved externals帮忙解释一下!谢谢!
#include <windows.h>
int CALLBACK WinMain(HINSTANCE hInstance,HINSTANCE hPreInstance,LPSTR lpStr,int nCmdShow)
{
MessageBox(NULL,"OK","information",MB_OK);
return(0);
}
为什么用cl 3.h,产生如下错误:
I:\3>cl 3.c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 12.00.8168 for 80x86
Copyright (C) Microsoft Corp 1984-1998. All rights reserved.3.c
Microsoft (R) Incremental Linker Version 6.00.8168
Copyright (C) Microsoft Corp 1992-1998. All rights reserved./out:3.exe
3.obj
3.obj : error LNK2001: unresolved external symbol __imp__MessageBoxA@16
3.exe : fatal error LNK1120: 1 unresolved externals帮忙解释一下!谢谢!
解决方案 »
- VS2008里SDI项目菜单怎么弄出来?
- 请问:Error executing c:\windows\system32\cmd.exe.错误提示怎么解决?
- 这段代码为什么出内存错误导致程序退出?
- 谁知道用SHELL调用KV2004时,传什么参数给KV2004,让它自动杀毒吗?
- 请问vc中文件及文件夹操作的问题
- CListCtrl的第一列可否固定?
- 那里有VC中ToolBar的小图标库提供?
- 怎么样能隐藏任务拦里的图标
- VC控制Excel,workbooks对象的Add()方法的参数如何写?
- 请问COM运行期的环境指何物? 举个例子???
- 如何编程向outlook的收件相中添加邮件?
- ado有关的问题
编译没有加入所需要的库, 你可以看一下一个正常的 win32 程序需要加入那些库. 这是摘抄:kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib 加入连接库设置在: Project -> Setting -> Line
编译没有加入所需要的库, 你可以看一下一个正常的 win32 程序需要加入那些库. 这是摘抄:kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib 加入连接库设置在: Project -> Setting -> Line
obj 是你一个程序中每一个 c, cpp 文件编译出来的结果, 所有 obj 连接到一起形成 exe 文件.