| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 3846 人关注过本帖
标题:watcom 编译器怎么使用呀?
只看楼主 加入收藏
RockCarry
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:版主
威 望:13
帖 子:662
专家分:58
注 册:2005-8-5
收藏
得分:0 
支持下
等以后有时间我也开始研究下WC。
2007-07-19 23:56
beyondabcd
Rank: 1
等 级:新手上路
帖 子:112
专家分:0
注 册:2007-5-19
收藏
得分:0 
watcom在XP下新建选dos-32->dos/4GW
把程序写好了后,Targets->make 也没有错误,run可一闪就过了,写getch()了呀?
2007-07-20 17:20
beyondabcd
Rank: 1
等 级:新手上路
帖 子:112
专家分:0
注 册:2007-5-19
收藏
得分:0 

/* Svga64k.bgi 测试文件 */

#include "graphics.h"
#include "Svga256.h"
#include "stdio.h"
#include "fcntl.h"
#include "malloc.h"
#include "io.h"

int huge Return_SVGA256(void)
{
return(SVGA320x200x256); /* 返回各种分辨率的对应编号 0~6 宏定义参见 Svga256.h */
}

int main(void)
{
int width, height, i=DETECT, j=0, x0, y0, fp;
unsigned char fix, *buffer, pix24b[4];
DacPalette256 dac256;
installuserdriver("Svga256", Return_SVGA256); /* 对于svga256必需执行该函数以安装BGI驱动 */
initgraph(&i, &j, ""); /* 执行TC默认的BGI初始化函数 */

if((fp = open("xy_256.bmp", O_RDONLY | O_BINARY)) == -1)
{
puts("Can't find file ""xy_256.bmp"".");
return 1;
}
lseek(fp, 18, SEEK_SET);
read(fp, &width, 4);
read(fp, &height, 4);
fix = (width % 4) ? (4 - width % 4) : 0;
x0 = (320 - width) / 2;
y0 = (200 - height) / 2;
lseek(fp, 54, SEEK_SET);
for(i = 0; i < 256; i++) /* 按照该图片的DAC色表设置色彩寄存器 */
{
read(fp, pix24b, 4); /* 读取DAC分量信息 */
/* 设置调色板 */
dac256[i][0] = pix24b[2] >> 2;
dac256[i][1] = pix24b[1] >> 2;
dac256[i][2] = pix24b[0] >> 2;
}
setvgapalette256(&dac256); /* 应用调色板, 定义参见 Svga256.h */
buffer = (unsigned char *)malloc(width);
for(j = height - 1; j >= 0; j--)
{
read(fp, buffer, width);
lseek(fp, fix, SEEK_CUR);
for(i = 0; i < width; i++)
putpixel(x0+i, y0+j, buffer[i]);
}
free(buffer);
close(fp);
getch();
closegraph();
return 0;
}

----------------------------------------------------------------------------
这是win-tc下一个第三方BGI的一个程序,在win-tc好使,但到了watcom就出现下面的错误了,一些头文件,我已经 拷入到C:\WATCOM\h中去了,svga256.bgi和程序文件也在同一个目录下,怎么会出现错误呢?


cd C:\PROGRA~1\WIN-TC\PROJECTS\第三方~1
wmake -f "C:\PROGRA~1\WIN-TC\PROJECTS\第三方~1\NONAME.mk" -h -e "C:\PROGRA~1\WIN-TC\PROJECTS\第三方~1\NONAME.exe"
wcc386 256_test.c -i=C:\WATCOM\h -w4 -e25 -zq -od -d2 -6r -bt=dos -mf
C:\WATCOM\h\graphics.h(376): Warning! W138: No newline at end of file
C:\WATCOM\h\dos.h(251): Warning! W138: No newline at end of file
C:\WATCOM\h\stdarg.h(24): Warning! W138: No newline at end of file
C:\WATCOM\h\stdio.h(186): Warning! W138: No newline at end of file
C:\WATCOM\h\fcntl.h(52): Warning! W138: No newline at end of file
C:\WATCOM\h\malloc.h(58): Warning! W138: No newline at end of file
C:\WATCOM\h\io.h(70): Warning! W138: No newline at end of file
256_test.c(54): Warning! W131: No prototype found for function 'getch'
wlink name NONAME d all SYS dos4g op m op maxe=25 op q op symf @NONAME.lk1
Error! E2028: installuserdriver_ is an undefined reference
Error! E2028: initgraph_ is an undefined reference
Error! E2028: putpixel_ is an undefined reference
Error! E2028: closegraph_ is an undefined reference
file 256_test.obj(C:\PROGRA~1\WIN-TC\PROJECTS\第三方~1\256_test.c): undefined symbol installuserdriver_
file 256_test.obj(C:\PROGRA~1\WIN-TC\PROJECTS\第三方~1\256_test.c): undefined symbol initgraph_
file 256_test.obj(C:\PROGRA~1\WIN-TC\PROJECTS\第三方~1\256_test.c): undefined symbol putpixel_
file 256_test.obj(C:\PROGRA~1\WIN-TC\PROJECTS\第三方~1\256_test.c): undefined symbol closegraph_
Error(E42): Last command making (C:\PROGRA~1\WIN-TC\PROJECTS\第三方~1\NONAME.exe) returned a bad status
Error(E02): Make execution terminated
Execution complete

2007-07-20 17:21
beyondabcd
Rank: 1
等 级:新手上路
帖 子:112
专家分:0
注 册:2007-5-19
收藏
得分:0 

WC提供的函数库除了提供标准C\c++库的函数外还拥有
Heap Functions / Process Primitive Functions / Process Environment / Operating System I/O Functions /Console I/O Functions / Default Windowing Functions / BIOS Functions /DOS-Specific Functions / Intel 80x86 Architecture-Specific Functions / Intel Pentium Multimedia Extension Functions等其他函数
WC的支持库包括:
图形库 : SciTech's MGL; wxWindows;WGT Watcom C/C++ ;Xlib Watcom C/C++; Watcom C/C++ ModeX;PD Curses; IFF Software;JLIB ;Zephyr's ZSVGA ;gkit ;StelSOFT GDK ;Allegro D-Flat;OWL NExt ;Turbo Vision+ ;libpng ;
音频库 : VAT Watcom C/C++ ;SMIX Watcom C/C++ ;DSIK Watcom C/C++
及其他工具库dllPower ;STLPort ;XBase ;zlib 等等。

这些函数在那能下载,怎么使用呀?特别是图形库

2007-07-20 17:21
一笔苍穹
Rank: 1
等 级:新手上路
帖 子:640
专家分:0
注 册:2006-5-25
收藏
得分:0 
那段程序肯定不行的,光是#include "graphics.h"在OW下就没有,到哪个山头唱哪支喝,TC有些私有的并非放之四海皆可的。
那些函数OW自带的,那些图形库可以到google上找,也可以关注
http://www.ds0101.com
现在已经有一些了,我会陆续更新这方面的东东进去。
2007-07-20 17:36
beyondabcd
Rank: 1
等 级:新手上路
帖 子:112
专家分:0
注 册:2007-5-19
收藏
得分:0 
你说的“OW的文档”是指它的IDE文档吗?
2007-07-22 16:45
一笔苍穹
Rank: 1
等 级:新手上路
帖 子:640
专家分:0
注 册:2006-5-25
收藏
得分:0 
不单是IDE的文档,OW 1.6会在开始菜单里建立一个子菜单,里面应该有近十个帮助文件,涉及到C库函数、C++类库、IDE使用、调试方法、用户手册等等等等。可谓很全面了,只不过都是E文的。
2007-07-22 18:44
vfdff
Rank: 6Rank: 6
等 级:侠之大者
威 望:8
帖 子:2172
专家分:425
注 册:2005-7-15
收藏
得分:0 
cd C:\PROGRA~1\WIN-TC\PROJECTS\第三方~1
wmake -f "C:\PROGRA~1\WIN-TC\PROJECTS\第三方~1\NONAME.mk" -h -e "C:\PROGRA~1\WIN-TC\PROJECTS\第三方~1\NONAME.exe"
wcc386 256_test.c -i=C:\WATCOM\h -w4 -e25 -zq -od -d2 -6r -bt=dos -mf
C:\WATCOM\h\graphics.h(376): Warning! W138: No newline at end of file
C:\WATCOM\h\dos.h(251): Warning! W138: No newline at end of file
C:\WATCOM\h\stdarg.h(24): Warning! W138: No newline at end of file
C:\WATCOM\h\stdio.h(186): Warning! W138: No newline at end of file
C:\WATCOM\h\fcntl.h(52): Warning! W138: No newline at end of file
C:\WATCOM\h\malloc.h(58): Warning! W138: No newline at end of file
C:\WATCOM\h\io.h(70): Warning! W138: No newline at end of file
256_test.c(54): Warning! W131: No prototype found for function 'getch'
wlink name NONAME d all SYS dos4g op m op maxe=25 op q op symf @NONAME.lk1
Error! E2028: installuserdriver_ is an undefined reference
Error! E2028: initgraph_ is an undefined reference<BR>Error! E2028: putpixel_ is an undefined reference
Error! E2028: closegraph_ is an undefined reference<BR>file 256_test.obj(C:\PROGRA~1\WIN-TC\PROJECTS\第三方~1\256_test.c): undefined symbol installuserdriver_
file 256_test.obj(C:\PROGRA~1\WIN-TC\PROJECTS\第三方~1\256_test.c): undefined symbol initgraph_
file 256_test.obj(C:\PROGRA~1\WIN-TC\PROJECTS\第三方~1\256_test.c): undefined symbol putpixel_
file 256_test.obj(C:\PROGRA~1\WIN-TC\PROJECTS\第三方~1\256_test.c): undefined symbol closegraph_
Error(E42): Last command making (C:\PROGRA~1\WIN-TC\PROJECTS\第三方~1\NONAME.exe) returned a bad status
Error(E02): Make execution terminated<BR>Execution complete

这些错误是因为环境变量没有正确配置导致的吗 ?
2008-09-04 08:38
快速回复:watcom 编译器怎么使用呀?
数据加载中...
 
   



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

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