EasyBMP icon indicating copy to clipboard operation
EasyBMP copied to clipboard

Link error

Open utmux opened this issue 1 year ago • 1 comments

It is recommended to separate the class definition and implementation into two files, otherwise, it may lead to multiple definitions, which can cause link errors. For example:

// head1.hpp
#include "EasyBMP.hpp"
// main.cpp
#include "head1.hpp"

By splitting the class definition (EasyBMP.hpp) and implementation (EasyBMP.cpp), you avoid issues such as multiple definitions when including the header in different files.

utmux avatar Sep 30 '24 09:09 utmux

It is recommended to separate the class definition and implementation into two files, otherwise, it may lead to multiple definitions, which can cause link errors. For example:

// head1.hpp
#include "EasyBMP.hpp"
// main.cpp
#include "head1.hpp"

By splitting the class definition (EasyBMP.hpp) and implementation (EasyBMP.cpp), you avoid issues such as multiple definitions when including the header in different files.

The purpose of this library was to be minimal and keep it in a single file. This could be solved by adding preprocessor definitions and conditionals. Does this solution fit your needs? If it's the case, feel free to fork and start a pull request.

izanbf1803 avatar Sep 30 '24 09:09 izanbf1803