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

Multiple definitions of raygui functions #409

Open
Vi-dot1 opened this issue Jun 17, 2024 · 1 comment
Open

Multiple definitions of raygui functions #409

Vi-dot1 opened this issue Jun 17, 2024 · 1 comment

Comments

@Vi-dot1
Copy link

Vi-dot1 commented Jun 17, 2024

I've been having problems implementing raygui 4 in my current raylib project in C++, each time I try to build it the terminal shows several lines like this for several functions inside raygui.h:

[build] C:/path../to../project../src/raygui.h:2839: multiple definition of `GuiValueBox'; CMakeFiles\RayDraw.dir/objects.a(gui.cpp.obj):C:/path../to../project../src/raygui.h:2839: first defined here

And so on for multiple Gui functions.

I implemented raygui on its own header file kind of like this:

#pragma once
/* gui.h */

extern "C"{
    #include"raylib.h"

    #define RAYGUI_IMPLEMENTATION
    #include"raygui.h"
}

void drawGui();

And a source file where I include the header and define the draw function. I tried changing RAYGUI_IMPLEMENTATION to RAYGUI_STATIC but that just makes makes the functions invisible to the compiler


I'm not sure if this is related, but I'm also getting a bunch of warnings about enum mismatches:

enumerated mismatch in conditional expression: 'GuiControlProperty' vs 'GuiDefaultProperty' [-Wenum-compare]

They seem to come from different places in raygui.h from these calls, which return values from two different enums depending on the result:

GetColor(GuiGetStyle(DEFAULT, (state == STATE_DISABLED)? BORDER_COLOR_DISABLED : LINE_COLOR))

That should probably go on its own issue, but I saying it here just in case is somehow related to my problem

@Futuremappermydud
Copy link

This is so Confusing!!! The Readme says you only need to define RAYGUI_IMPLEMENTATION once yet half the functions are only defined under RAYGUI_IMPLEMENTATION... Aghhhh!!!!

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