Quantcast
Channel: Active questions tagged gcc - Stack Overflow
Viewing all articles
Browse latest Browse all 22162

How to use C++ libs in C that provide the bindings? [duplicate]

$
0
0

I'm new to C. I want to use the imgui library that was written in C++ with it's base+internal+glfw+opengl3 extensions in my C project that uses glfw and opengl3 libraries. I'm aware of two projects that provide the bindings for imgui namely,

I'm running linux (debian) but I couldn't understand how to use the binding cpp files present in these binding repositories within my C project. This is the makefile of my C project,

CC=gccCFLAGS=-Wall -std=c11 -ggdb -march=native -fno-omit-frame-pointer -fdiagnostics-show-option -I./include/LIBS=-lm -lGL -lglfw -lGLEWSOURCES=./src/main.c ./src/shader.c ./src/callback.cOBJECTS={$SOURCES:.c=.o}all: mainmain: $(SOURCES)    $(CC) $(CFLAGS) -o main $(SOURCES) $(LIBS)main.o:    $(CC) $(CFLAGS) -c ./src/main.c $(LIBS)shader.o:    $(CC) $(CFLAGS) -c ./src/shader.c $(LIBS)callback.o:    $(CC) $(CFLAGS) -c ./src/callback.c $(LIBS)clean:    rm -f main $(OBJECTS)

Edit: I was looking for the steps to properly call a function defined in the C++ library but from within my C project. I don't know how to use the "cpp" files (present in the binding projects above like dear-bindings and cimgui) in my C project. I'm using gcc to compile the project.


Viewing all articles
Browse latest Browse all 22162

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>