Building Penrose2 for Win 2000, VC++ 7.0 by N. J. Van Schooenderwoert, Feb, 2004 This doc tells what changes I made to get penrose2 built from source and running on my Win2000 (Svc pack 3) PC under Microsoft Visual Studio 7.0. All mods I did in the source code I have commented, and I've appended details about those commented lines at the end of this doc. ---------------- Notes for building paintlib ---------------- Starting with the notes given here- http://www.westmaster.com/zidek/research/ the first step to building the penrose2 app is to get the paintlib sources and build paintlib.lib. At http://www.paintlib.de/paintlib/ the "links" section gives this as the place to get libpng: http://www.libpng.org/pub/png/src/ But the library's zip file is not there. I really got libpng from http://sourceforge.net/project/showfiles.php?group_id=5624 I got vers 1.2.5 , file = lpng125.zip Trying the build now... It worked but only after changes. All the changes were of the nature of removing a dir underneath otherlibs/libtiff/tiff-xxx/xxx.c and having it say otherlibs/libtiff/xxx.c instead. These extra sub dirs came in automatically when unzipping the source files into otherlibs/libtiff/, for example. No changes needed to be made to paintlib source code. ------------- Notes for building Penrose2 --------------- Source code for penrose2 files had to be changed because many paintlib include files names had "pl" added to start of their name after this penrose2 code was written. Appendix A lists those changes. After the above mods were done, there were still build errors in penrose2. The issue seems to be that it was originally a VC++ 6.0 app and I am using VC++ 7.0. Visual Studio converted the app to version 7.0 but I suspect an error in the conversion because of these compilation problems: 3 Compilation issues: warning C4005: 'IDC_HAND' : macro redefinition error C2440: 'static_cast' : cannot convert from 'BOOL (__thiscall CStaticFilespec::* )(WPARAM,LPARAM)' to 'LRESULT (__thiscall CWnd::* )(WPARAM,LPARAM)' warning C4717: 'CZoomView::OnDraw' : recursive on all control paths, function will cause runtime stack overflow RESOLUTION OF ABOVE ISSUES -------------------------- ------C4005: Leave alone and see if program executes ok. Some info on the problem: resource.h contains #define IDC_HAND 136 penrose2.rc contains IDC_HAND CURSOR DISCARDABLE "res\\cursor1.cur" Framework file WinUser.h contains #define IDC_HAND MAKEINTRESOURCE(32649) ------C2440: Comment-out the affected code for now, as follows: Error was caused at StaticFilespec.cpp line 27 "ON_MESSAGE(...." in framework code. PenSettings1.h, .cpp - commented out the lines involving CStaticFilespec. StaticFilespec.cpp - commented out the message map contents. Details given in Appendix B. ------C4717: Let's see what happens. Can set breakpoint at OnDraw if it crashes. =========================== Attempt to fix penrose2 build errors ========== NOTE - IN VC++ penrose2 project linker general options, had to set lib path to ..\paintlib\paintlib-2.5.0\lib\Debug (It was previously at paintlib\lib\Debug, so couldn't link to paintlib.lib) New error... LINK : fatal error LNK1104: cannot open file 'Debug/htmlhelp.lib' ??? This isn't anywhere in the project files. I copied it from C:\Program Files\Microsoft Visual Studio .NET\Vc7\PlatformSDK\lib to ..\Debug Now the thing built, and it executes ok in spite of warning C4717. All the draw and zoom functionality seems ok even though nothing was done about the 2 warnings. The executable is much smaller (860KB) than the pre-built one I downloaded (1,145KB). Must be due to the differences between VC++ 6.0 and 7.0. See Appendix B for the source code mods that allowed penrose2 to build and run ok. =========== Appendix A. penrose2 source mods to compile with paintlib ======== C:\njv\Penrose_software\penrose2_source\src\MainFrm.cpp(205): //njv?? HtmlHelp(m_hWnd, AfxGetApp()->m_pszHelpFilePath, HH_DISPLAY_TOC, nCmd == HELP_CONTEXT ? dwData : 0); C:\njv\Penrose_software\penrose2_source\src\MainFrm.cpp(206): HtmlHelp(dwData, nCmd == HELP_CONTEXT ? dwData : 0); // njv, changed line C:\njv\Penrose_software\penrose2_source\src\penrose2View.cpp(11): #include "pltiffencex.h" // njv - added "pl" prefix to file name C:\njv\Penrose_software\penrose2_source\src\penrose2View.cpp(12): #include "pljpegenc.h" // njv - added "pl" prefix to file name C:\njv\Penrose_software\penrose2_source\src\penrose2View.cpp(13): #include "plpngenc.h" // njv - added "pl" prefix to file name C:\njv\Penrose_software\penrose2_source\src\penrose2View.cpp(15): #include "plwinbmp.h" // njv - added "pl" prefix to file name C:\njv\Penrose_software\penrose2_source\src\penrose2View.cpp(16): #include "planydec.h" // njv - added "pl" prefix to file name C:\njv\Penrose_software\penrose2_source\src\penrose2View.cpp(1142): //njv CWinBmp Bmp; C:\njv\Penrose_software\penrose2_source\src\penrose2View.cpp(1143): PLWinBmp Bmp; // njv changed type CWinBmp to PLWinBmp C:\njv\Penrose_software\penrose2_source\src\penrose2View.cpp(1174): //njv CJPEGEncoder Encoder; C:\njv\Penrose_software\penrose2_source\src\penrose2View.cpp(1175): PLJPEGEncoder Encoder; // njv changed from CJPEGEncoder to PLJPEGEncoder C:\njv\Penrose_software\penrose2_source\src\penrose2View.cpp(1180): //njv CTIFFEncoder Encoder; C:\njv\Penrose_software\penrose2_source\src\penrose2View.cpp(1181): PLTIFFEncoder Encoder; // njv changed CTIFFEncoder to PLTIFFEncoder C:\njv\Penrose_software\penrose2_source\src\penrose2View.cpp(1186): //njv CPNGEncoder Encoder; C:\njv\Penrose_software\penrose2_source\src\penrose2View.cpp(1187): PLPNGEncoder Encoder; // njv changed CPNGEncoder to PLPNGEncoder C:\njv\Penrose_software\penrose2_source\src\PenSettings1.h(11): //njv #include "StaticFilespec.h" C:\njv\Penrose_software\penrose2_source\src\PenSettings1.h(35): // njv CStaticFilespec m_ctlPercent; C:\njv\Penrose_software\penrose2_source\src\resource.h(5): #ifndef _Resource_h // njv - added line C:\njv\Penrose_software\penrose2_source\src\resource.h(6): #define _Resource_h // njv - added line C:\njv\Penrose_software\penrose2_source\src\colorbtn.h(92): //njv? static void Serialize( CArchive& ar ); C:\njv\Penrose_software\penrose2_source\src\colorbtn.h(93): void Serialize( CArchive& ar ); // njv removed 'static' keyword C:\njv\Penrose_software\penrose2_source\src\penrose2View.h(16): //njv #include "tiffencex.h" C:\njv\Penrose_software\penrose2_source\src\penrose2View.h(18): #include "pljpegenc.h" // njv - added "pl" prefix to file name C:\njv\Penrose_software\penrose2_source\src\penrose2View.h(19): #include "plpngenc.h" // njv - added "pl" prefix to file name C:\njv\Penrose_software\penrose2_source\src\penrose2View.h(21): #include "plwinbmp.h" // njv - added "pl" prefix to file name =========== Appendix B. penrose2 source mods to fix VC++ 6.0 vs 7.0 compatibility ======== The changes all consist of lines commented-out, no additional code. Each commented-out line has the string "njv" added to note the change. Only 2 files are affected, as described below. Here is PenSettings1.cpp(116 - 126) // njv m_ctlPercent.SubclassDlgItem(IDC_PERCENT,this); // njv m_ctlPercent.SetFormat (DT_RIGHT | DT_VCENTER); char buffer[200]; _itoa( m_stripe_width, buffer, 10 ); // njv m_ctlPercent.SetWindowText((char*)&buffer); // pen_col_btn.SubclassDlgItem(IDC_PICK_BORDER_COL,this); CDialog::OnInitDialog(); Here is PenSettings1.cpp(147 - 151) _itoa( m_stripe_width, buffer, 10 ); // njv m_ctlPercent.SetWindowText((char*)&buffer); // Default(); Here is StaticFilespec.cpp(25 - 31) BEGIN_MESSAGE_MAP(CStaticFilespec, CWnd) //{{AFX_MSG_MAP(CStaticFilespec) //njv ON_MESSAGE( WM_SETTEXT, OnSetText ) //njv ON_WM_ERASEBKGND() //njv ON_WM_PAINT() //}}AFX_MSG_MAP END_MESSAGE_MAP() ============ END ============