User's Guide For VCpp 6.0

From WxWiki
Jump to: navigation, search
This article applies to the following versions
Platform wxWidgets Visual C++
Windows XP 2.6.2 6
Status: Out of Date
  1. Unzip wxWidgets 2.6.2 files to a directory (uncompress the files for instance to C:\Personal\projects\components\Vc6\src\wx262 - so, try to generalise the dir name)
  2. Open C:\Personal\projects\components\Vc6\src\wx262\build\msw\wx.dsw
  3. Then select "Projects | Settings..." .
  4. In the settings window, select the first project (adv) and then click the C++ tab.
    Note: you can also select all projects and continue with step 5. This will save you from executing step 7 (thanks to Jan Vanhoutte for this tip!).
  5. Then Select "Code Generation" in the the "Category" Combobox.
    Make sure "Settings For" Combo is selected as "Win32 Debug".
  6. In the "Use Runtime Library" combobox, select "Debug Multithreaded" (and not "Debug Multithreaded DLL", which is selected as default)
  7. Continue doing that for all the other projects.
    Note: if you have selected all projects in step 4, then you can skip step 7, since it's all set in one go.
  8. Click 'Ok' to save the settings, don't forget this action!
  9. Then follow step 3 and this time you should select "Win32 Release" and select "Multithreaded" for the Runtime settings.
  10. Then do a batch build of "all" projects in the workspace, if you want the libs generated for all possible targets (unicode, non-unicode, debug, release, dll, non-dll,...).
    This is a lengthy process and you will have some projects that will fail. This is because some libs needed by those projects are not compiled yet (dependency issue).
    However, running a second time the batch build (not rebuild all, just build!) should result in no errors anymore (the previously failed projects will now nicely link and generate their lib(s)).
    Note: if you're not interested in building all libs, you can select "Build | Batch Build..." and select only the targets you're interested in (personally, I only want the Win32 Release/Debug and Win32 DLL Release/Debug, that makes the building process significanlty shorter...)
  11. Once all builds are done and error free, open the options Window ("Tools | Options") and select the "Directories" tab.
  12. Add the wx include path ("C:\Personal\projects\components\Vc6\src\wx262\include\") and Lib directory ("C:\Personal\projects\components\Vc6\src\wx262\lib\vc_lib") in the corresponding window and save the options.
  13. Then go to C:\Personal\projects\components\Vc6\src\wx262\lib\vc_lib\mswd\wx and copy the file "setup.h" to "C:\Personal\projects\components\Vc6\src\wx262\include\wx'.
  14. Create a new empty 'Win32 project' and then select ("Project | Settings...") and change the runtime settings to "Multithreaded".
  15. Add the following lib file names to the "Object/libary modules" editbox in the "Link" tab, "General Category": "wxmsw26d_core.lib wxbase26d.lib wxtiffd.lib wxjpegd.lib wxpngd.lib wxzlibd.lib wxregexd.lib wxexpatd.lib kernel32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib winmm.lib shell32.lib comctl32.lib ole32.lib oleaut32.lib uuid.lib rpcrt4.lib advapi32.lib wsock32.lib oleacc.lib odbc32.lib"
    It's obvious this is for the Win32 Debug target, since the "d" is part of all the wxWidgets libs. If you want to build a Win32 Release target, take the same line, but remove the "d" from the wxWidgets libs. You can leave the other settings.
  16. Then Select the "Input" item from the "Category" combobox (in the same "Link " tab).
    Add "LIBCMT.lib" to the "Ignore libraries:" section (this is to make sure the default Non Debuggable C Runtime library is ignored). Hint: Just found the statment: NEVER IGNORE LIBS! Make sure you have the same settings in Code Generation when you compile the wx libs as you have in an application that uses these libs. If you get trouble with the linker about "already defined functions" you probably did this mistake. If everything is compiled under the same Code Generation settings you won't have to ignore a lib!
  17. Then compile and link your project, this should make your program run under the Vc++ debugger (To get the 'XP themes effects', you simply have to copy the XP themes '.manifest' file into the folder containing the executable (mostly /Release or /Debug): see here for more info about XP themes and here for a practical implementation by Jiang Hong )