0

我正在开发一个程序,并且正在使用带有 SDL 和 OpenGL 的 Tiny C 编译器。TCC 不包含 opengl 的标头,因此我尝试从 Visual C++ 和 MinGW 复制它们。它们都无法编译并出现以下错误:

v:/exe/tcc/include//GL/gl.h:1081: ',' expected

两个文件中的第 1081 行是:

GLAPI void APIENTRY glVertex4s( GLshort x, GLshort y, GLshort z, GLshort w );
GLAPI void APIENTRY glVertex2dv( const GLdouble *v ); // <-- line 1081
GLAPI void APIENTRY glVertex2fv( const GLfloat *v );

GLAPI 扩展:

/* GLAPI, part 1 (use WINGDIAPI, if defined) */
#if defined(__WIN32__) && defined(WINGDIAPI)
#  define GLAPI WINGDIAPI
#endif

/* GLAPI, part 2 */
#if !defined(GLAPI)
#  if defined(_MSC_VER)                        /* Microsoft Visual C++ */
#    define GLAPI __declspec(dllimport)
#  elif defined(__LCC__) && defined(__WIN32__) /* LCC-Win32 */
#    define GLAPI __stdcall
#  else                                        /* Others (e.g. MinGW, Cygwin, non-win32) */
#    define GLAPI extern
#  endif
#endif

APIENTRY 的扩展:

/* APIENTRY */
#if !defined(APIENTRY)
#  if defined(__WIN32__)
#    define APIENTRY __stdcall
#  else
#    define APIENTRY
#  endif
#endif

我设置的唯一编译器标志是 -b、-g、-Wall 和一些包含目录。

我能得到一些帮助吗?如果需要,我很乐意提供更多信息。

4

3 回答 3

3

为了与 Windows 系统 DLL 链接,TCC 使用导入定义文件 (.def) 而不是库。

The included 'tiny_impdef' program may be used to make additional 
.def files for any DLL. For example:

    tiny_impdef.exe opengl32.dll

Put opengl32.def into the tcc/lib directory.  Specify -lopengl32 at
the TCC commandline to link a program that uses opengl32.dll.
于 2012-11-03T04:48:36.513 回答
1

我有一个类似的问题(虽然期待分号)。尝试#include <windows.h>在 OpenGL 头文件被导入之前;这似乎已经为我解决了。

于 2012-01-13T20:07:06.437 回答
1

我不确定我是如何解决这个问题的。我认为这与我传递的一些包含目录有关。无论如何,问题已经过去了。

于 2011-10-26T00:56:33.180 回答