Integrating Microsoft Visual C 6 with Code::Blocks IDE

From Code::Blocks
Revision as of 19:26, 5 July 2006 by MortenMacFly (talk | contribs) (redesigned layout)
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

Attaching the compiler framework

You are still using Microsoft Visual C++ version 6 (MSVC6) and want to shift to Code::Blocks? Here are the steps to integrate the (commercial!) Microsoft Visual C++ version 6 compiler into Code::Blocks.

The following steps are required:

1.) Make a copy of the Microsoft Visual C++ Toolkit 2003 as follows:

  • Goto menu "Settings" -> "Compiler and debugger"
  • Select the "Microsoft Visual C++ Toolkit 2003", click the "Copy" Button
  • Save the copy e.g. under "Microsoft Visual C++ 6"

2.) Setup the compiler as follows:

  • The path setup (tab "Programs") should be done as following:
    • The "Compiler's installation directory" should be set to {YOUR_MSVC6}\VC98
    • Under "Additional path's" add:
      • {YOUR_MSVC6_COMMON}\MSDEV98\Bin
      • {YOUR_MSVC6_COMMON}\Tools
  • The compiler/linker setup (tab "Directories) should be done as following:
    • Under the tab "Compiler" add the following path's:
      • {YOUR_MSVC6}\VC98\Include
      • {YOUR_MSVC6}\VC98\MFC\Include
      • {YOUR_MSVC6}\VC98\ATL\Include
    • Under the tab "Linker" add the following path's:
      • {YOUR_MSVC6}\VC98\Lib
      • {YOUR_MSVC6}\VC98\MFC\Lib
    • Under the tab "Resource compiler" add the following path's:
      • {YOUR_MSVC6}\VC98\Include
      • {YOUR_MSVC6}\VC98\MFC\Include
      • {YOUR_MSVC6}\VC98\ATL\Include

That's it.

Working with "legacy" MSVC6 workspaces/projects

Code::Blocks offers the ability to import Visual C++ 6 workspaces and projects. To import a MSVC6 workspace do the following: Menu "Project" -> "Import" -> "MS Visual C++ workspace". Code::Blocks will ask you if it should apply the default compiler or ask for each project which compiler to chose. Choose the second option. Now Code::Blocks will present a compiler selection dialog for each project of the workspace. Choose your newly created compiler ("Microsoft Visual C++ 6") for each project. Usually this should import your workspace just fine.

Now there is some finetuning required:

1.) Code::Blocks may have imported the include path's for compiler and linker as absolute path's. This you should verify and setup to relative apth's where apropriate.

2.) Code::Blocks may have imported the libraries to link against with absolute path's. This you should change to just present the libraries name (e.g. just "MyLib" for the "D:\MyPath\MyOtherPath\MyLib.lib" library). For own libraries there maybe an additional linker include path to be setup for the compiler to find this library.

3.) Code::Blocks usually does not import the "common" MSVC6 libraries you need to link your project against. Thus you will receive linker erros for unresolved symbols. The MSDN will help you to tell which of the "common" library you need to link against. For example: If the linker issues an "unresolved symbol RegCloseKey" a look in the MSDN will reveal that this is part of the "advapi32.lib". Thus just add "advapi32" (without the lib extension) to the libraries to link your project against. This may take a while but if you just start from the first unresolved symbol linking another common library will usually resolve a whole list of unresolved symbols.

Troubleshooting

For troubleshooting enable the "Full command line" Under menu "Settings" -> "Compiler" -> "Other" tab, "Compiler logging".