KHR/khrplatform.h

Hi,

Am trying to solve this problem that unfortunately has surfaced in my program. My program is to start an OpenGl platform, but then I launch it I get the error:
 
C:\...\glfw_opengl\xtoll\src\include\eglew.h:106:29: fatal error: KHR/khrplatform.h: No such file or directory


Now admittedly operator error is mostly to blame. I copied some includes to a more "organized" folder hierarchy without bringing along its dependencies (in this case khrplatform). Or so I thought: I've made the file universally available<KHR/khrplatform.h> and the compiler still can't find it.

proj - in progress
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include<windows.h>
#include<iostream>
// GLEW

//#define GLEW_STATIC
#include <stdio.h>
#include <GL/glew.h>
// GLFW
#include <GLFW/glfw3.h>
#include <KHR/khrplatform.h>

using namespace std;

int main()
{
    glfwInit();
    glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
   // glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
  //  glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
    //glfwWindowHint(GLFW_RESIZABLE, GL_FALSE);

    return 0;
}

Last edited on
Where is the file absolutely? Where is the preprocessor looking?
absolute file location: \Users\...\Marble\glfw_opengl\xtoll\src\include\khrplatform

The preprocessor area is blank; I've also never had to use it, so I don't know how useful my response is on that.

My edit: I wanted to clarify that the eclipse IDE has a "Preprocessor" tab I have never used but I have used the linker, etc.
Last edited on
It's the preprocessor's job to find that file while processing the translation unit (...which is then given to the compiler.) I'm not sure what the GUI looks like, but you need to point the preprocessor to your file using the -I option:

https://msdn.microsoft.com/en-us/library/73f9s62w.aspx
Last edited on
Thank you, now its not reporting the same error, reason being: IDK. Instead, something went right. I reverted back to including where the files were rather than gathering and moving them, I righted the dependency issue that would otherwise have resurfaced with khrplatform.

Except now I am getting:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
g++ "-LC:\\Users\\Technologist\\Marble\\glfw_opengl\\xtoll_opengl\\bin" -o xtoll_opengl.exe "src\\main.o" -lglew32 -lglfw3 -lglu32 -lopengl32 
C:\Users\Technologist\Marble\glfw_opengl\xtoll_opengl\bin/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x3f6): undefined reference to `CreateDCW@16'
C:\Users\Technologist\Marble\glfw_opengl\xtoll_opengl\bin/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x40b): undefined reference to `GetDeviceCaps@8'
C:\Users\Technologist\Marble\glfw_opengl\xtoll_opengl\bin/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x420): undefined reference to `GetDeviceCaps@8'
C:\Users\Technologist\Marble\glfw_opengl\xtoll_opengl\bin/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x43d): undefined reference to `DeleteDC@4'
C:\Users\Technologist\Marble\glfw_opengl\xtoll_opengl\bin/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x5db): undefined reference to `CreateDCW@16'
C:\Users\Technologist\Marble\glfw_opengl\xtoll_opengl\bin/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x5f2): undefined reference to `GetDeviceCaps@8'
C:\Users\Technologist\Marble\glfw_opengl\xtoll_opengl\bin/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x60b): undefined reference to `GetDeviceCaps@8'
C:\Users\Technologist\Marble\glfw_opengl\xtoll_opengl\bin/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0x62c): undefined reference to `DeleteDC@4'
C:\Users\Technologist\Marble\glfw_opengl\xtoll_opengl\bin/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0xba6): undefined reference to `CreateDCW@16'
C:\Users\Technologist\Marble\glfw_opengl\xtoll_opengl\bin/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0xbbb): undefined reference to `GetDeviceGammaRamp@8'
C:\Users\Technologist\Marble\glfw_opengl\xtoll_opengl\bin/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0xbc6): undefined reference to `DeleteDC@4'
C:\Users\Technologist\Marble\glfw_opengl\xtoll_opengl\bin/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0xe35): undefined reference to `CreateDCW@16'
C:\Users\Technologist\Marble\glfw_opengl\xtoll_opengl\bin/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0xe46): undefined reference to `SetDeviceGammaRamp@8'
C:\Users\Technologist\Marble\glfw_opengl\xtoll_opengl\bin/libglfw3.a(win32_monitor.c.obj):win32_monitor.c:(.text+0xe51): undefined reference to `DeleteDC@4'
C:\Users\Technologist\Marble\glfw_opengl\xtoll_opengl\bin/libglfw3.a(win32_window.c.obj):win32_window.c:(.text+0xc1): undefined reference to `CreateDIBSection@24'
C:\Users\Technologist\Marble\glfw_opengl\xtoll_opengl\bin/libglfw3.a(win32_window.c.obj):win32_window.c:(.text+0x10e): undefined reference to `CreateBitmap@20'
C:\Users\Technologist\Marble\glfw_opengl\xtoll_opengl\bin/libglfw3.a(win32_window.c.obj):win32_window.c:(.text+0x1a9): undefined reference to `DeleteObject@4'
C:\Users\Technologist\Marble\glfw_opengl\xtoll_opengl\bin/libglfw3.a(win32_window.c.obj):win32_window.c:(.text+0x1b4): undefined reference to `DeleteObject@4'
C:\Users\Technologist\Marble\glfw_opengl\xtoll_opengl\bin/libglfw3.a(win32_window.c.obj):win32_window.c:(.text+0x239): undefined reference to `DeleteObject@4'
C:\Users\Technologist\Marble\glfw_opengl\xtoll_opengl\bin/libglfw3.a(wgl_context.c.obj):wgl_context.c:(.text+0x151): undefined reference to `SwapBuffers@4'
C:\Users\Technologist\Marble\glfw_opengl\xtoll_opengl\bin/libglfw3.a(wgl_context.c.obj):wgl_context.c:(.text+0x424): undefined reference to `DescribePixelFormat@16'
C:\Users\Technologist\Marble\glfw_opengl\xtoll_opengl\bin/libglfw3.a(wgl_context.c.obj):wgl_context.c:(.text+0x4fb): undefined reference to `DescribePixelFormat@16'
C:\Users\Technologist\Marble\glfw_opengl\xtoll_opengl\bin/libglfw3.a(wgl_context.c.obj):wgl_context.c:(.text+0x635): undefined reference to `DescribePixelFormat@16'
C:\Users\Technologist\Marble\glfw_opengl\xtoll_opengl\bin/libglfw3.a(wgl_context.c.obj):wgl_context.c:(.text+0x656): undefined reference to `SetPixelFormat@12'
C:\Users\Technologist\Marble\glfw_opengl\xtoll_opengl\bin/libglfw3.a(wgl_context.c.obj):wgl_context.c:(.text+0x105d): undefined reference to `ChoosePixelFormat@8'
C:\Users\Technologist\Marble\glfw_opengl\xtoll_opengl\bin/libglfw3.a(wgl_context.c.obj):wgl_context.c:(.text+0x1070): undefined reference to `SetPixelFormat@12'
collect2.exe: error: ld returned 1 exit status


Is this an includes problem or ? My strategies are in want of a shift.
Last edited on
Remember that the build process for most components is a three-stage process involving preprocessing, compilation and linking. This error comes from the linker stage (the program name is ld), so that implies that both the compilation and pre-processing steps have succeeded.

This particular issue is that the linker can't find a definition for the symbols named in the error messages. This means usually that you did not link whatever object code (libraries, etc.) that contain that definition.

In your case, the function CreateDC exists in gdi32.lib
This information is available in the documentation here:
https://msdn.microsoft.com/en-us/library/windows/desktop/dd183490(v=vs.85).aspx

You would need -lgdi32 to instruct the linker to link that library. System libraries should be in the search path by default, but if not, you can fix that with -L path basically as you did with -I for the include search path.
Last edited on
Will apply it and see. It begs the question why the system file isn't linked/ found in the first place or causing an error or whatever: in all of the internet I haven't seen many discussions about this type of linker error and opengl/GLFW.
Last edited on
Topic archived. No new replies allowed.