Custom build
-
Hello, I have a Lib which has some objects which are compiled depending on whether certain macros are defined or not. I was wondering if it is possible to have multiple builds of the Lib for the different scenarios and have Visual C++ automatically choose between the correct version of the Lib to use? Example:
In the Lib:
#ifdef _MACROA
class A
{
.
:
.
};
#endif // defined(_MACROA)This means that we have two possible versions of the Lib: one for when _MACROA is defined and another for when it's not. So the question is how to configure the project settings in the (implementation) App - if such a thing is possible at all - to make it choose the correct version of the Lib depending on whether the macro is defined or not. Perhaps I should adopt a different strategy? All insights on the question in hand will be greatly appreciated. David
-
Hello, I have a Lib which has some objects which are compiled depending on whether certain macros are defined or not. I was wondering if it is possible to have multiple builds of the Lib for the different scenarios and have Visual C++ automatically choose between the correct version of the Lib to use? Example:
In the Lib:
#ifdef _MACROA
class A
{
.
:
.
};
#endif // defined(_MACROA)This means that we have two possible versions of the Lib: one for when _MACROA is defined and another for when it's not. So the question is how to configure the project settings in the (implementation) App - if such a thing is possible at all - to make it choose the correct version of the Lib depending on whether the macro is defined or not. Perhaps I should adopt a different strategy? All insights on the question in hand will be greatly appreciated. David
You could use a method such as:
#ifdef _DEBUG #pragma comment(lib,"SomeLibrary_D.lib") // Use debug build of library #else #pragma comment(lib,"SomeLibrary.lib") // Use release build of library #endif
Depending on which build of your program you will be using, these #pragma definitions will use the corresponding build of the dependent dll.
I Dream of Absolute Zero
-
Hello, I have a Lib which has some objects which are compiled depending on whether certain macros are defined or not. I was wondering if it is possible to have multiple builds of the Lib for the different scenarios and have Visual C++ automatically choose between the correct version of the Lib to use? Example:
In the Lib:
#ifdef _MACROA
class A
{
.
:
.
};
#endif // defined(_MACROA)This means that we have two possible versions of the Lib: one for when _MACROA is defined and another for when it's not. So the question is how to configure the project settings in the (implementation) App - if such a thing is possible at all - to make it choose the correct version of the Lib depending on whether the macro is defined or not. Perhaps I should adopt a different strategy? All insights on the question in hand will be greatly appreciated. David
You could also always add a new 'configuration'. The 2 defaults are Win32 Release and Win32 Debug, but you can add others, which allows you to define specific project settings for each one. You can create different output files, use different preprocessor macros, include different libraries, etc. You you could have Win32 Release With MacroA Win32 Release No MacroA Win32 Debug With MAcroA Win32 Debug No MAcroA for example. On the VC 6.0 'Build' menu there is an item labeled 'Configurations...' that invokes a dialog that allows you to add/remove configurations. Then, when you want to work on a specific configuration, you use the Build|Set Active Configuraiton... menu item to specifically define the one you are working on. You can use Build|Batch Build... menu item to make all of them at once.
-
You could also always add a new 'configuration'. The 2 defaults are Win32 Release and Win32 Debug, but you can add others, which allows you to define specific project settings for each one. You can create different output files, use different preprocessor macros, include different libraries, etc. You you could have Win32 Release With MacroA Win32 Release No MacroA Win32 Debug With MAcroA Win32 Debug No MAcroA for example. On the VC 6.0 'Build' menu there is an item labeled 'Configurations...' that invokes a dialog that allows you to add/remove configurations. Then, when you want to work on a specific configuration, you use the Build|Set Active Configuraiton... menu item to specifically define the one you are working on. You can use Build|Batch Build... menu item to make all of them at once.
Great! That's exactly what I was looking for! Thank you very much for replying. David
-
Great! That's exactly what I was looking for! Thank you very much for replying. David
You are welcome, glad the information helped. It is a handy feature to make custom builds of your software for different customers or target audiances.