| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1796 人关注过本帖
标题:[求助]用命令行运行cl.exe来编译的问题
只看楼主 加入收藏
woodhead
Rank: 3Rank: 3
等 级:新手上路
威 望:9
帖 子:1124
专家分:0
注 册:2005-7-18
收藏
 问题点数:0 回复次数:6 
[求助]用命令行运行cl.exe来编译的问题
编译console程序没事。

winapi视窗程序的时候,在link时

hello.obj :error LNK2019:无法解析的外部符号 __imp__DispatchMessageA@4 , 该符号在函数 _WinMain@16 中被引用

还有很多,看起来都是api调用方面的,我的path, include, lib参数都已经设定了

INCLUDE = D:\program files\VC2003\include;D:\program files\VC2003\PlatformSDK\Include;D:\program files\VC2003\atlmfc\include

LIB = D:\program files\VC2003\lib;D:\program files\VC2003\PlatformSDK\Lib;D:\program files\VC2003\atlmfc\lib

PATH = D:\program files\VC2003\bin

???
搜索更多相关主题的帖子: exe 命令 编译 运行 
2006-08-27 13:23
maoguoqing
Rank: 6Rank: 6
来 自:重庆
等 级:贵宾
威 望:28
帖 子:2980
专家分:19
注 册:2005-12-5
收藏
得分:0 
最好能把程序给出来。。。

天行健,君子以自强不息!!QQ:68660681
2006-08-28 12:22
woodhead
Rank: 3Rank: 3
等 级:新手上路
威 望:9
帖 子:1124
专家分:0
注 册:2005-7-18
收藏
得分:0 
就是一个hello win 的程序,记得以前在别的编译器上成功了。
想用它试试vctoolkit,似乎找不到winapi的库。

[CODE]#include <windows.h>

LRESULT CALLBACK WndProc( HWND, UINT, WPARAM, LPARAM );

int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
PSTR szCmdLine, int iCmdShow )
{
static TCHAR szAppName[ ] = TEXT( "HelloWin" );
HWND hwnd;
MSG msg;
WNDCLASS wndclass;
wndclass.style = CS_HREDRAW | CS_VREDRAW;
wndclass.lpfnWndProc = WndProc;
wndclass.cbClsExtra = 0;
wndclass.cbWndExtra = 0;
wndclass.hInstance = hInstance;
wndclass.hIcon = LoadIcon( NULL, IDI_APPLICATION );
wndclass.hCursor = LoadCursor( NULL, IDC_ARROW );
wndclass.hbrBackground =( HBRUSH ) GetStockObject( WHITE_BRUSH );
wndclass.lpszMenuName = NULL;
wndclass.lpszClassName = szAppName;


if( ! RegisterClass( & wndclass ) )
return 0;
hwnd = CreateWindow( szAppName, // window class name
TEXT( "The Hello Program" ), // window caption
WS_OVERLAPPEDWINDOW, // window style
CW_USEDEFAULT, // initial x position
CW_USEDEFAULT, // initial y position
CW_USEDEFAULT, // initial x size
CW_USEDEFAULT, // initial y size
NULL, // parent window handle
NULL, // window menu handle
hInstance, // program instance handle
NULL ); // creation parameters

ShowWindow( hwnd, iCmdShow );
UpdateWindow( hwnd );

while( GetMessage( & msg, NULL, 0, 0 ) )
{
TranslateMessage( & msg );
DispatchMessage( & msg );
}
return msg.wParam;
}

LRESULT CALLBACK WndProc( HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam )
{
HDC hdc;
PAINTSTRUCT ps;
RECT rect;

switch( message )
{
case WM_PAINT :
hdc = BeginPaint( hwnd, & ps );
GetClientRect( hwnd, & rect );
DrawText( hdc, TEXT( "Hello, Windows 98!" ), - 1, & rect,
DT_SINGLELINE | DT_CENTER | DT_VCENTER );
EndPaint( hwnd, & ps );
return 0;

case WM_DESTROY :
PostQuitMessage( 0 );
return 0;
}
return DefWindowProc( hwnd, message, wParam, lParam );
}
[/CODE]

2006-08-28 13:35
maoguoqing
Rank: 6Rank: 6
来 自:重庆
等 级:贵宾
威 望:28
帖 子:2980
专家分:19
注 册:2005-12-5
收藏
得分:0 
程序没错,我在VC上运行也没错,至于为什么?不好意思我也不知道了。。。

天行健,君子以自强不息!!QQ:68660681
2006-08-28 14:24
baidu
Rank: 3Rank: 3
等 级:新手上路
威 望:8
帖 子:3811
专家分:0
注 册:2005-11-4
收藏
得分:0 
cl /?

偶放弃所有文章版权,偶在BCCN论坛任何贴子,可转贴,可散发,可抄袭,可复制,可被冒名顶替,可被任何人引用到任何文章中且不写出引文出处,偶分文不取。
2006-08-29 05:50
yeshirow
Rank: 4
等 级:贵宾
威 望:10
帖 子:854
专家分:0
注 册:2006-6-8
收藏
得分:0 

將編譯選項寫出來呀


原來朋友仔感情再天真, 亦是我永遠也會愛惜的人, 明日愛他人, 也記住學會不要緊; 原來朋友比戀人更高分, 亦讓我開始懂得不記恨, 若大家都敏感, 我更要永遠記得拒絕再因小事怪人, 爲何沒有這條校訓...Twins-朋友仔 MCSD Training
2006-08-29 08:19
woodhead
Rank: 3Rank: 3
等 级:新手上路
威 望:9
帖 子:1124
专家分:0
注 册:2005-7-18
收藏
得分:0 
把这个事给忘了,是我platform sdk,安装的不好,原来曾经想用vctoolkit+platformSDK来学习,现在已经不用了,不好意思。


2006-09-14 09:21
快速回复:[求助]用命令行运行cl.exe来编译的问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.011486 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved