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

Duplicate Symbols #47

Open
MeijisIrlnd opened this issue Mar 29, 2020 · 4 comments
Open

Duplicate Symbols #47

MeijisIrlnd opened this issue Mar 29, 2020 · 4 comments

Comments

@MeijisIrlnd
Copy link

Hiya, this might be a dumb question, but I want to include tsf.h in a header file, then include that header in main, and its giving me 40 duplicate symbols when I do (I see you said to include it in one file, I've tried pragma onceing it etc etc and its still showing duplicates, any ways around this?

@schellingb
Copy link
Owner

Hi there
Feel free to just include tsf.h in many places, but in one single C/C++ file you need to have

#define TSF_IMPLEMENTATION
#include "tsf.h"

in there. Placement doesn't really matter but it should be after all other #include directives.
Make sure to remove the #pragma once because if you have it in a global header and then the TSF_IMPLEMENTATION define followed by a re-include it needs to allow multiple include'ing of the same file.

@MeijisIrlnd
Copy link
Author

cheers for your speedy reply, it's probably my xcode settings thanks for clarifying it isnt a one time include thing ahaha, will edit this if i get it sorted, thanks again!

@MeijisIrlnd
Copy link
Author

MeijisIrlnd commented Mar 29, 2020

Yeah so super weird, no idea why this wouldnt work, here's the error, the include in my header and then that header being included in main (Also just realised that is just not how you spell creator)
Screen Shot 2020-03-29 at 15 14 19
Screen Shot 2020-03-29 at 15 14 31
Screen Shot 2020-03-29 at 15 14 42

(EDIT: #define TSF_STATIC fixed the build, weird???

@schellingb
Copy link
Owner

Can't you try moving the #define TSF_IMPLEMENTATION and #include "tsf.h" below the line #include "SouncfontCreater.hpp"? Not sure if that solves linker errors though. And there is no #define TSF_IMPLEMENTATION anywhere else in all other c/h/cpp/hpp files?

If it's still not working, can you paste the whole build output and not just a screenshot?

#define TSF_STATIC might remove the errors for you but it's not really a great solution because you end up with multiple copies of the same function in the build output which would be avoided if it's resolved correctly.

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