Difference between revisions of "Integrating Microsoft Visual C 6 with Code::Blocks IDE"

From CodeBlocks
Jump to: navigation, search
(Initial version (added content))
m (Attaching the compiler framework)
Line 16: Line 16:
 
1.) The path setup (tab "Programs") should be done as following:
 
1.) The path setup (tab "Programs") should be done as following:
  
** The "Compiler's installation directory" should be set to {YOUR_MSVC6}\VC98
+
** The "Compiler's installation directory" should be set to {YOUR_MSVC6}\VC98
** Under "Additional path's" add:
+
** Under "Additional path's" add:
*** {YOUR_MSVC6_COMMON}\MSDEV98\Bin
+
*** {YOUR_MSVC6_COMMON}\MSDEV98\Bin
*** {YOUR_MSVC6_COMMON}\Tools
+
*** {YOUR_MSVC6_COMMON}\Tools
  
 
2.) The compiler/linker setup (tab "Directories) should be done as following:
 
2.) The compiler/linker setup (tab "Directories) should be done as following:
  
** Under the tab "Compiler" add the following path's:
+
** Under the tab "Compiler" add the following path's:
*** {YOUR_MSVC6}\VC98\Include
+
*** {YOUR_MSVC6}\VC98\Include
*** {YOUR_MSVC6}\VC98\MFC\Include
+
*** {YOUR_MSVC6}\VC98\MFC\Include
*** {YOUR_MSVC6}\VC98\ATL\Include
+
*** {YOUR_MSVC6}\VC98\ATL\Include
  
** Under the tab "Linker" add the following path's:
+
** Under the tab "Linker" add the following path's:
*** {YOUR_MSVC6}\VC98\Lib
+
*** {YOUR_MSVC6}\VC98\Lib
*** {YOUR_MSVC6}\VC98\MFC\Lib
+
*** {YOUR_MSVC6}\VC98\MFC\Lib
  
** Under the tab "Resource compiler" add the following path's:
+
** Under the tab "Resource compiler" add the following path's:
*** {YOUR_MSVC6}\VC98\Include
+
*** {YOUR_MSVC6}\VC98\Include
*** {YOUR_MSVC6}\VC98\MFC\Include
+
*** {YOUR_MSVC6}\VC98\MFC\Include
*** {YOUR_MSVC6}\VC98\ATL\Include
+
*** {YOUR_MSVC6}\VC98\ATL\Include
  
 
That's it.
 
That's it.

Revision as of 20:24, 5 July 2006

Attaching the compiler framework

You are still using Microsoft Visual C++ version 6 (MSVC6) and wnat 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:

  • Make a copy of the Microsoft Visual C++ Toolkit 2003 as follows:

1.) Goto menu "Settings" -> "Compiler and debugger"

2.) Select the "Microsoft Visual C++ Toolkit 2003", click the "Copy" Button

3.) Save the copy e.g. under "Microsoft Visual C++ 6"

  • Setup the compiler as follows:

1.) 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

2.) 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".