Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.
2 of 3
added 213 characters in body
nonsensickle
  • 4.6k
  • 2
  • 37
  • 64

You need to wrap the C code like so

extern "C" { #include "sample1.h" } 

A better way to do it is like in this StackOverflow question, in the C header files.

use:

#ifdef __cplusplus extern "C" { #endif 

At the start of all C header files.

and use:

#ifdef __cplusplus } #endif 

At the end of all C header files.

nonsensickle
  • 4.6k
  • 2
  • 37
  • 64