环境变量的设置具有优先级,也就是相同环境变量名下的多个变量值之间的关系是前面的变量具有优先级。而watcom对于环境变量比较敏感,需要优先设置。比如对一个程序编译的时候: wcl386 -zq -bd -bt=os2 -l=os2v2_dll -I%WATCOM%\h\os2 hello.c -"option implib" wcl386 -zq -bt=os2 -l=os2v2 main.c hello.lib 经常提示的错误: WATCOM C/C++32 Compile and Link Utility Version 10.0 Copyright by WATCOM International Corp. 1988, 1994. All rights reserved. WATCOM is a trademark of WATCOM International Corp. wcc386 TEST.C WATCOM C32 Optimizing Compiler Version 10.0a Copyright by WATCOM International Corp. 1984, 1994. All rights reserved. WATCOM is a trademark of WATCOM International Corp. C:\VC98\INCLUDE\stdio.h(23): Error! E1091: ERROR: Only Mac or Win32 看到了吧,这是由于默认采用了VC进行了编译,解决方法: You have installed or are using Visual C++. (Installing other compilers may cause similar problems.) WATCOM can still be used when other compilers are installed, however the environment variables INCLUDE, LIB, and WATCOM need to be set to the default values set by WATCOM when it was first installed. The WATCOM variable will be untouched by other compilers, so its usually best to redefine the INCLUDE and LIB environment variables in terms of %WATCOM% from batch files or makefiles. For example in makefiles the .BEFORE directive can be used for this purpose: .BEFORE @set INCLUDE=.;$(%watcom)\H @set LIB=.;$(%watcom)\LIB386 也就是把watcom的变量更改到前面即可,eg: 由: F:\Program_Files\VC98\mfc\lib;F:\Program_Files\VC98\lib;%WATCOM%lib286;%WATCOM%lib286dos; 变为 .;%WATCOM%lib286;%WATCOM%lib286dos;F:\Program_Files\VC98\mfc\lib;F:\Program_Files\VC98\lib; 参考:http://www.azillionmonkeys.com/qed/watfaq.shtml
评论