OpenGL + Tiny C Compiler: “, expected”
Frage
I am working on a program and am using Tiny C Compiler with SDL and OpenGL. TCC doesn't include headers for opengl, so I tried copying them from both Visual C++ and MinGW. Both of them fail to compile with the following error:
v:/exe/tcc/include//GL/gl.h:1081: ',' expected
Line 1081 in both files is:
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 );
Expansion for 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
Expansion for APIENTRY:
/* APIENTRY */
#if !defined(APIENTRY)
# if defined(__WIN32__)
# define APIENTRY __stdcall
# else
# define APIENTRY
# endif
#endif
The only compiler flags I am setting are -b, -g, -Wall, and a few include directories.
Can I have some assistance with this? I will be happy to provide more information if needed.
Lösung 2
I'm not really sure how I have fixed this. I think it had to do with some of the include directories I was passing. Anyway, problem is gone.
Andere Tipps
To link with Windows system DLLs, TCC uses import definition files (.def) instead of libraries.
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.
I had a similar sort of problem (expecting semicolon instead though). Try to #include <windows.h>
before the OpenGL headers get imported; that seems to have fixed it for me.