简体   繁体   English

通过TCC编译C时出现GLFW gl.h错误

[英]GLFW gl.h error when compiling C via TCC

When I try to compile a simple GLFW program with TCC, I get an error in the gl.h header. 当我尝试使用TCC编译简单的GLFW程序时,在gl.h标头中出现错误。

The command I'm using for the compile is 我用于编译的命令是

tcc -L./ -lglfw3 -Iglfw/include main.c

Here's the full output of this command 这是此命令的完整输出

>tcc -L./ -lglfw3 -Iglfw/include main.c
In file included from main.c:1:
In file included from glfw/include/GLFW/glfw3.h:153:
c:/tcc/include/GL/gl.h:1152: error: declaration for parameter '__stdcall' but no such parameter

And here's the simple program I'm trying to compile 这是我要编译的简单程序

#include <GLFW/glfw3.h>

int main()
{
    glfwInit();
    glfwTerminate();
}

Am I linking something wrong? 我链接有问题吗? Or not linking something I'm supposed to be linking? 还是不链接我应该链接的东西? What's wrong with my compile parameters? 我的编译参数有什么问题?

I had the exact same problem as you, I had to include the windows.h file before GLFW to fix it I managed to compile and run this program. 我遇到了与您完全相同的问题,我不得不在GLFW之前包含windows.h文件来修复它,因此我设法编译并运行了该程序。 Program code 程式码

I had to create a .def file for the glfw3.dll and link against it, I also had to put the dll in the same folder as the compiled exe to run the program. 我必须为glfw3.dll创建一个.def文件并对其进行链接,我还必须将该dll与已编译的exe放在同一文件夹中,以运行该程序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM