watcom是在版主的网站上下的
/* 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
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 等等。
这些函数在那能下载,怎么使用呀?特别是图形库