Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

linking with cpp code #42

Open
tlapik123 opened this issue Apr 26, 2022 · 2 comments
Open

linking with cpp code #42

tlapik123 opened this issue Apr 26, 2022 · 2 comments

Comments

@tlapik123
Copy link

tlapik123 commented Apr 26, 2022

I had a problem with linking the library together with cpp code.
The error:
undefined reference to /* some function */

I resolved it using the solution below.
Would it be possible to add this to the repo [include files]?
Or is there other solution that I just didn't see?

Possible solution

#ifdef __cplusplus
extern "C" {
#endif

/* header declarations */

#ifdef __cplusplus
}
#endif
@nsz-arm
Copy link
Contributor

nsz-arm commented Apr 26, 2022

i think it makes sense to make the headers c++ compatible, for now you can do it in your c++ code (not tested):

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

@tlapik123
Copy link
Author

i think it makes sense to make the headers c++ compatible, for now you can do it in your c++ code (not tested):

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

Can confirm - this works as-well.
TY

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants