Code: Select all
/usr/bin/ld: libgame-lib.a(hello_world.cpp.o): in function `GuiEnable':
hello_world.cpp:(.text+0x0): multiple definition of `GuiEnable'; CMakeFiles/exe.dir/src/main.cpp.o:main.cpp:(.text+0x0): first defined here
Das Problem tritt nicht im Master-Zweig auf, wo nur ein Ziel direkt mit raygui.h verknüpft ist.
Dies sind die Dateien im Zweig, bei dem das Problem auftritt:
hello_world.hpp
Code: Select all
#include "raylib.h"
#define RAYGUI_IMPLEMENTATION
#include "raygui.h"
void hello_world();
Code: Select all
#include "hello_world.hpp"
void hello_world() {
InitWindow(300, 300, "Hello World with raylib.");
while (!WindowShouldClose()) {
BeginDrawing();
ClearBackground(BLACK);
DrawText("Hello World", 120, 150, 12, RED);
GuiButton((Rectangle) {115, 180, 80, 16}, "Hello World");
EndDrawing();
}
}
Code: Select all
#include "hello_world.hpp"
int main() {
hello_world();
return 0;
}
Mobile version