0

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.

4
  • 4
    What does GLAPI and APIENTRY expand into after the C preprocessor is finished? Commented Oct 24, 2011 at 22:53
  • 3
    and what are on lines 1080 and 1082? sometimes the error line number is propagated from a previous error. Commented Oct 24, 2011 at 22:57
  • $0.02 says either contains __declspec(dllimport). You can't just copy headers from other compilers and expect them to work. You're better off searching for a tiny C specific solution (or switching to another compiler). Or __stdcall. Commented Oct 24, 2011 at 23:48
  • Do you know what the final expanded values are for GLAPI and APIENTRY? The value of __WIN32__, WINGDIAPI, _MSC_VER, and __LCC__ are not obvious (although I'm guessing _MSC_VER is not being set by your compiler). Commented Oct 25, 2011 at 0:32

3 Answers 3

3

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.
Sign up to request clarification or add additional context in comments.

Comments

1

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.

Comments

1

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.