1

I want to use OpenGL GLEW library. I have the binary downloaded and its folder is in the folder with my .cpp file. My .cpp file uses #include <eglew.h>.

How should I format my command for MinGW to compile my .cpp file? Do I compile with the .lib file like g++ -L./path/to/lib/file.lib test.cpp -o test or do I do something else like link to the header files g++ -I./path/to/headers test.cpp -o test?

2
  • you can try: g++ -L./path/to/lib/file.lib -I./path/to/headers test.cpp -o test, change your include <eglew.h> to "eglew.h" may helps. Commented Jul 13, 2020 at 3:54
  • You seem to have to wrong binary. MinGW normally works with .a, no .lib. Commented Jul 13, 2020 at 11:38

1 Answer 1

1

To better understand things maybe it's better to split compiling and linking steps. If you get errors then you will also know in which step the problem occurs.

I'm assuming you have the following folders/files:

/path/to/eglew/include/GL/eglew.h /path/to/eglew/lib/libglew32.a 

Compiling:

g++ -Wall -c -o test.o test.cpp -I/path/to/eglew/include/GL 

Linking:

g++ -o test.exe test.o -L/path/to/eglew/lib -lglew32 

Though I would expect to see #include <GL/eglew.h> in which case the linker include flag should be -I/path/to/eglew/include.

Sign up to request clarification or add additional context in comments.

1 Comment

It is good habit to ask for warnings from the compiler

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.