FCF 2.0 development in progress...
> > > >
[News] [C++ Libraries API] [C++ Downloads] [Donate to the project] [Contacts]

FCF_BASIS_IMPLEMENTATION macro

FCF_BASIS_IMPLEMENTATION

Package: fcfBasis

File: macro.hpp

Available from version: 1.0.1

This macro is used to enable the implementation section within the header files.

When this macro is declared, the implementation of functions and methods is declared in header files. This macro should be included in only one CPP file per application, along with the fcfBasis/basis.hpp file, which will compile the necessary functions.

In a real application implementation, it is better to move the FCF_BASIS_IMPLEMENTATION macro to a separate .cpp file to avoid rebuilding the framework each time.

Example: Quickly enable macros

#include <iostream> // Define an implementation macro to include the implementation section in header files. #define FCF_BASIS_IMPLEMENTATION #include <fcfBasis/basis.hpp> int main() { fcf::Variant variant = "variant_string_value"; std::cout << "Variant value: " << variant << std::endl; return 0; }

Output:

Variant value: variant_string_value

Example: Example with a separate framework assembly file

#include <fcfBasis/basis.hpp> int main(){ fcf::Variant variant = "variant_string_value"; std::cout << "Variant value: " << variant << std::endl; return 0; }

impl2.cpp file:

#define FCF_BASIS_IMPLEMENTATION #include <fcfBasis/basis.hpp>

CMakeLists.txt file:

add_executable(app2 main2.cpp impl2.cpp) target_include_directories(app2 PRIVATE ../../..)

Output:

Variant value: variant_string_value