Go back to Richel Bilderbeek's homepage.
Go back to Richel Bilderbeek's C++ page.
IDE: C++ Builder 6.0
Project type: Console
[Linker Fatal Error] Fatal: Oject file MyFile.OBJ is missing a section of class 2 |
This error occurs when:
Download a C++ Builder project with this error.
There are more.
Restructure the program so you will not need to use globals. If this fails, use the Singleton Design Pattern.
Go to 'Project | Options | Compiler | Pre-compiled headers' and select 'None'. Your error message will change to the following warning:
[Linker Warning] Public symbol '_x' defined in both module MyUnit1.OBJ and MyUnit2.OBJ |
This solution is not recommended, because one should not use global data [1-5], nor work in the global namespace [6].
Suppose you have declared an integer called 'x' in a header file (.h) like below:
int x; |
Put it into a namespace called 'global' like below:
namespace global |
Your error message will change to the following warning:
[Linker Warning] Public symbol 'global::x' defined in both module MyUnit1.OBJ and MyUnit2.OBJ |
This solution is not recommended, because one should not use global data [1-5], nor work in the global namespace [6].
Suppose you have declared an integer called 'x' in a header file (.h) like below:
int x; |
Make it static like below:
static int x; |
This solution is not recommended, because one should not use global data [1-5], nor work in the global namespace [6].
Go back to Richel Bilderbeek's C++ page.
Go back to Richel Bilderbeek's homepage.