C coding tip

There’s nothing wrong with having 6 lines more in your header files even if you don’t need them right now.

You wil maybe spare a lot of time debugging build/linking problems in the future with them.

#ifdef __cplusplus
extern “C” {
#endif

#ifndef YOUR_HEADER_
#define YOUR_HEADER_

int main(int argc, char ** argv) {

}

#endif 

#ifdef __cplusplus
}
#endif

This is needed if you want to use your lib in C++.

Leave a Reply