Compiling Notes: Difference between revisions
Jump to navigation
Jump to search
Line 98: | Line 98: | ||
(MPARAM) WinQuerySysPointer (HWND_DESKTOP, SPTR_APPICON, (BOOL) FALSE), | (MPARAM) WinQuerySysPointer (HWND_DESKTOP, SPTR_APPICON, (BOOL) FALSE), | ||
NULL) ; | NULL) ; | ||
</PRE> | |||
===warning: missing braces around initializer=== | |||
;Warning | |||
<PRE> | |||
vectfont.c:55:34: warning: missing braces around initializer [-Wmissing-braces] | |||
55 | vectfont [] = { | |||
| ^ | |||
</PRE> | |||
;Fix | |||
Changed | |||
<PRE> | |||
vectfont [] = { | |||
IDM_NOTHING, NULL, | |||
IDM_24POINT, Display_24Point, | |||
IDM_MIRROR, Display_Mirror, | |||
IDM_STRETCH, Display_Stretch, | |||
IDM_CHARANGLE, Display_CharAngle, | |||
IDM_ROTATE, Display_Rotate, | |||
IDM_CHARSHEAR, Display_CharShear, | |||
IDM_SHADOW, Display_Shadow, | |||
IDM_HOLLOW, Display_Hollow, | |||
IDM_DROPSHADOW, Display_DropShadow, | |||
IDM_BLOCK, Display_Block, | |||
IDM_NEON, Display_Neon, | |||
IDM_FADE, Display_Fade, | |||
IDM_SPOKES, Display_Spokes, | |||
IDM_WAVY, Display_Wavy, | |||
IDM_MODSPOKES, Display_ModSpokes | |||
} ; | |||
</PRE> | |||
To | |||
<PRE> | |||
vectfont [] = { | |||
{IDM_NOTHING, NULL}, | |||
{IDM_24POINT, Display_24Point}, | |||
{IDM_MIRROR, Display_Mirror}, | |||
{IDM_STRETCH, Display_Stretch}, | |||
{IDM_CHARANGLE, Display_CharAngle}, | |||
{IDM_ROTATE, Display_Rotate}, | |||
{IDM_CHARSHEAR, Display_CharShear}, | |||
{IDM_SHADOW, Display_Shadow}, | |||
{IDM_HOLLOW, Display_Hollow}, | |||
{IDM_DROPSHADOW, Display_DropShadow}, | |||
{IDM_BLOCK, Display_Block}, | |||
{IDM_NEON, Display_Neon}, | |||
{IDM_FADE, Display_Fade}, | |||
{IDM_SPOKES, Display_Spokes}, | |||
{IDM_WAVY, Display_Wavy}, | |||
{IDM_MODSPOKES, Display_ModSpokes} | |||
} ; | |||
</PRE> | </PRE> | ||
Revision as of 16:29, 27 April 2023
This are some set of light notes I took while trying to compile some old PM samples on 2023.
Enviroment
RPM Packages
I always confuse the RPM packages that I use to compile things with GCC. I want to use as much as open source tools available. Here it is what I install:
- yum install git gcc make libc-devel binutils
- watcom-wrc
- watcom-wlink-hll
Checking the Enviroments
Execute %INCLUDE% and see if soemthing shows up.
PM Code Errors/Warnings with GCC
CHAR * {aka char *}
- Warning
gcc -Wall -Zomf -c -O2 bitcat2.c -o bitcat2.obj bitcat2.c: In function 'main': bitcat2.c:36:29: warning: pointer targets in passing argument 2 of 'WinRegisterClass' differ in signedness [-Wpointer-sign] 36 | WinRegisterClass(hab, szClientClass, ClientWndProc, CS_SIZEREDRAW, 0); | | | | CHAR * {aka char *} In file included from W:/usr/include/os2.h:39, from bitcat2.c:4: W:/usr/include/os2emx.h:6138:47: note: expected 'PCSZ' {aka 'const unsigned char *'} but argument is of type 'CHAR *' {aka 'char *'}
- Fix
I replaced
static CHAR szClientClass[] = "BitCat2";
for
unsigned char szClientClass[] = "BitCat2";
and warnings were removed.
'WinCreateStdWindow' makes integer from pointer without a cast [-Wint-conversion]
vectfont.c:33:38: warning: passing argument 7 of 'WinCreateStdWindow' makes integer from pointer without a cast [-Wint-conversion] 33 | NULL, ID_RESOURCE, &hwndClient) ; | ^~~~ | | | void *
- Fix
I replaced the NULL by 0
weakld: error: Unresolved symbol (UNDEF)
- Error
weakld: error: Unresolved symbol (UNDEF) '_max'. weakld: info: The symbol is referenced by: C:\dev\DEV-SAMPLES-PM-VectFont\vf00.obj C:\dev\DEV-SAMPLES-PM-VectFont\vf14.obj weakld: error: Unresolved symbol (UNDEF) '_min'. weakld: info: The symbol is referenced by: C:\dev\DEV-SAMPLES-PM-VectFont\vf00.obj C:\dev\DEV-SAMPLES-PM-VectFont\vf05.obj C:\dev\DEV-SAMPLES-PM-VectFont\vf14.obj Ignoring unresolved externals reported from weak prelinker. Warning! W1058: file ldgVmPcu.: line(35): protmode option not valid for an OS/2 EMX executable Error! E2028: _max is an undefined reference Error! E2028: _min is an undefined reference file C:\dev\DEV-SAMPLES-PM-VectFont\vf00.obj(vf00.obj): undefined symbol _max file C:\dev\DEV-SAMPLES-PM-VectFont\vf00.obj(vf00.obj): undefined symbol _min
- Fix
??
'WinSendMsg' makes pointer from integer without a cast
- Warning
vectfont.c:36:18: warning: passing argument 3 of 'WinSendMsg' makes pointer from integer without a cast [-Wint-conversion] 36 | WinQuerySysPointer (HWND_DESKTOP, SPTR_APPICON, FALSE), | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | | | HPOINTER {aka long unsigned int} In file included from C:/usr/include/os2.h:39, from vectfont.c:7: C:/usr/include/os2emx.h:5819:59: note: expected 'MPARAM' {aka 'void *'} but argument is of type 'HPOINTER' {aka 'long unsigned int'} 5819 | MRESULT APIENTRY WinSendMsg (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2); | ~~~~~~~^~~
- Fix
Changed:
WinSendMsg (hwndFrame, WM_SETICON, WinQuerySysPointer (HWND_DESKTOP, SPTR_APPICON, FALSE), NULL) ;
To:
WinSendMsg (hwndFrame, WM_SETICON, (MPARAM) WinQuerySysPointer (HWND_DESKTOP, SPTR_APPICON, (BOOL) FALSE), NULL) ;
warning: missing braces around initializer
- Warning
vectfont.c:55:34: warning: missing braces around initializer [-Wmissing-braces] 55 | vectfont [] = { | ^
- Fix
Changed
vectfont [] = { IDM_NOTHING, NULL, IDM_24POINT, Display_24Point, IDM_MIRROR, Display_Mirror, IDM_STRETCH, Display_Stretch, IDM_CHARANGLE, Display_CharAngle, IDM_ROTATE, Display_Rotate, IDM_CHARSHEAR, Display_CharShear, IDM_SHADOW, Display_Shadow, IDM_HOLLOW, Display_Hollow, IDM_DROPSHADOW, Display_DropShadow, IDM_BLOCK, Display_Block, IDM_NEON, Display_Neon, IDM_FADE, Display_Fade, IDM_SPOKES, Display_Spokes, IDM_WAVY, Display_Wavy, IDM_MODSPOKES, Display_ModSpokes } ;
To
vectfont [] = { {IDM_NOTHING, NULL}, {IDM_24POINT, Display_24Point}, {IDM_MIRROR, Display_Mirror}, {IDM_STRETCH, Display_Stretch}, {IDM_CHARANGLE, Display_CharAngle}, {IDM_ROTATE, Display_Rotate}, {IDM_CHARSHEAR, Display_CharShear}, {IDM_SHADOW, Display_Shadow}, {IDM_HOLLOW, Display_Hollow}, {IDM_DROPSHADOW, Display_DropShadow}, {IDM_BLOCK, Display_Block}, {IDM_NEON, Display_Neon}, {IDM_FADE, Display_Fade}, {IDM_SPOKES, Display_Spokes}, {IDM_WAVY, Display_Wavy}, {IDM_MODSPOKES, Display_ModSpokes} } ;
Linkers
Change to WLINK
You need to add:
set EMXOMFLD_TYPE=WLINK set EMXOMFLD_LINKER=wl.exe
Remember that the Wacom Linker is "wl.exe" and is on the "watcom-wlink-hll" RPM package.
Resource Compiler
- Error 1
Reading binary resource file walker.res (0) RC: error - Only integer TYPE allowed (). RC: 1 error detected make: *** [walker.exe] Error 1
- It is possible of an error on the SET INCLUDE directory. Type %INCLUDE% and check if it is pointing to the directory that contains OS2.H
- Error 2
[E:\PROJECTS\SAMPLEPACK\PMWALKER]make 2>&1 | tee make.out wrc -r walker.rc Open Watcom Windows and OS/2 Resource Compiler Version 2.0beta1 LA Portions Copyright (c) 1993-2002 Sybase, Inc. All Rights Reserved. Source code is available under the Sybase Open Watcom Public License. See http://www.openwatcom.org/ for details. walker.rc(2): Error! E062: Unable to open 'os2.h' make: *** [walker.res] Error 9
- It is possible of an error on the SET INCLUDE directory. Type %INCLUDE% and check if it is pointing to the directory that contains OS2.H