Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: [Solved] Problem compiling SFML 2.3.2 with MinGW32  (Read 3835 times)

0 Members and 1 Guest are viewing this topic.

gunchleoc

  • Newbie
  • *
  • Posts: 3
    • View Profile
[Solved] Problem compiling SFML 2.3.2 with MinGW32
« on: November 15, 2015, 04:13:09 pm »
Hi all,

I have a problem compiling under Windows 7, 64 bit with MinGW32. I used the current source code archive downloaded from the website. I get the same problem if I drop the pre-built GCC 4.9.2 MinGW (DW2) - 32-bit package into the appropriate path. It seems to be a problem with OpenGL, but couldn't find any solutions on the web. Any help would be appreciated :)

ETA: Problems occur with sfml‑window and sfml‑graphics only.

Commands used to build SFML:

$ mkdir build
$ cd build
$ cmake -G "MSYS Makefiles" ..
$ make sfml‑window

Console output:
<snip>
[ 44%] Built target sfml-system
[ 47%] Building CXX object src/SFML/Window/CMakeFiles/sfml-window.dir/GlContext.
cpp.obj
In file included from C:/tp-dev/SFML-2.3.2/include/SFML/OpenGL.hpp:46:0,
                 from c:/tp-dev/SFML-2.3.2/src/SFML/Window/GlContext.cpp:33:
c:\mingw\include\gl\gl.h:1587:20: error: expected initializer before 'glAccum'
 extern void WINAPI glAccum (GLenum op, GLfloat value);
                    ^
c:\mingw\include\gl\gl.h:1588:20: error: expected initializer before 'glActiveTe
xtureARB'
 extern void WINAPI glActiveTextureARB (GLenum texture);
                    ^
c:\mingw\include\gl\gl.h:1589:20: error: expected initializer before 'glAlphaFun
c'
 extern void WINAPI glAlphaFunc (GLenum func, GLclampf ref);
                    ^
c:\mingw\include\gl\gl.h:1590:25: error: expected initializer before 'glAreTextu
resResident'
 extern GLboolean WINAPI glAreTexturesResident (GLsizei n, const GLuint *texture
s, GLboolean *residences);
                         ^
c:\mingw\include\gl\gl.h:1591:25: error: expected initializer before 'glAreTextu
resResidentEXT'
 extern GLboolean WINAPI glAreTexturesResidentEXT (GLsizei n, const GLuint *text
ures, GLboolean *residences);
                         ^
c:\mingw\include\gl\gl.h:1592:20: error: expected initializer before 'glArrayEle
ment'
 extern void WINAPI glArrayElement (GLint i);
                    ^
c:\mingw\include\gl\gl.h:1593:20: error: expected initializer before 'glArrayEle
mentEXT'
 extern void WINAPI glArrayElementEXT (GLint i);
                    ^
c:\mingw\include\gl\gl.h:1594:20: error: expected initializer before 'glBegin'
 extern void WINAPI glBegin (GLenum mode);
                    ^
c:\mingw\include\gl\gl.h:1595:20: error: expected initializer before 'glBindText
ure'
 extern void WINAPI glBindTexture (GLenum target, GLuint texture);
                    ^
c:\mingw\include\gl\gl.h:1596:20: error: expected initializer before 'glBitmap'
 extern void WINAPI glBitmap (GLsizei width, GLsizei height, GLfloat xorig, GLfl
oat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap);
                    ^
In file included from C:/tp-dev/SFML-2.3.2/include/SFML/OpenGL.hpp:46:0,
                 from c:/tp-dev/SFML-2.3.2/src/SFML/Window/GlContext.cpp:33:
c:\mingw\include\gl\gl.h:1597:20: error: expected initializer before 'glBlendCol
or'
 extern void WINAPI glBlendColor (GLclampf red, GLclampf green, GLclampf blue, G
Lclampf alpha);
                    ^
c:\mingw\include\gl\gl.h:1598:20: error: expected initializer before 'glBlendEqu
ation'
 extern void WINAPI glBlendEquation (GLenum mode);
                    ^
c:\mingw\include\gl\gl.h:1599:20: error: expected initializer before 'glBlendFun
c'
 extern void WINAPI glBlendFunc (GLenum sfactor, GLenum dfactor);
                    ^
c:\mingw\include\gl\gl.h:1600:20: error: expected initializer before 'glCallList
'
 extern void WINAPI glCallList (GLuint list);
                    ^
c:\mingw\include\gl\gl.h:1601:20: error: expected initializer before 'glCallList
s'
 extern void WINAPI glCallLists (GLsizei n, GLenum type, const GLvoid *lists);
                    ^
c:\mingw\include\gl\gl.h:1602:20: error: expected initializer before 'glClear'
 extern void WINAPI glClear (GLbitfield mask);
                    ^
c:\mingw\include\gl\gl.h:1603:20: error: expected initializer before 'glClearAcc
um'
 extern void WINAPI glClearAccum (GLfloat red, GLfloat green, GLfloat blue, GLfl
oat alpha);
                    ^
c:\mingw\include\gl\gl.h:1604:20: error: expected initializer before 'glClearCol
or'
 extern void WINAPI glClearColor (GLclampf red, GLclampf green, GLclampf blue, G
Lclampf alpha);
                    ^
c:\mingw\include\gl\gl.h:1605:20: error: expected initializer before 'glClearDep
th'
 extern void WINAPI glClearDepth (GLclampd depth);
                    ^
c:\mingw\include\gl\gl.h:1606:20: error: expected initializer before 'glClearInd
ex'
 extern void WINAPI glClearIndex (GLfloat c);
                    ^
c:\mingw\include\gl\gl.h:1607:20: error: expected initializer before 'glClearSte
ncil'
 extern void WINAPI glClearStencil (GLint s);
                    ^
c:\mingw\include\gl\gl.h:1608:20: error: expected initializer before 'glClientAc
tiveTextureARB'
 extern void WINAPI glClientActiveTextureARB (GLenum texture);
                    ^
c:\mingw\include\gl\gl.h:1609:20: error: expected initializer before 'glClipPlan
e'
 extern void WINAPI glClipPlane (GLenum plane, const GLdouble *equation);
                    ^
c:\mingw\include\gl\gl.h:1610:20: error: expected initializer before 'glColor3b'

 extern void WINAPI glColor3b (GLbyte red, GLbyte green, GLbyte blue);
                    ^
c:\mingw\include\gl\gl.h:1611:20: error: expected initializer before 'glColor3bv
'
 extern void WINAPI glColormake[3]: *** [src/SFML/Window/CMakeFiles/sfml-window.
dir/GlContext.cpp.obj] Error 3
<snip>
« Last Edit: November 15, 2015, 05:04:48 pm by gunchleoc »

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: Problem compiling SFML 2.3.2 with MinGW32
« Reply #1 on: November 15, 2015, 04:26:54 pm »
Seems like WINAPI is not defined (which it should be, when Windows headers are correctly included). The conditional compilation branch here only includes <windows.h> for MSVC, i.e. not in your case. Still, MinGW usually seems to work.

Why don't you use the MinGW Makefiles generator?
Why not make install?
« Last Edit: November 15, 2015, 04:31:40 pm by Nexus »
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

gunchleoc

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Problem compiling SFML 2.3.2 with MinGW32
« Reply #2 on: November 15, 2015, 04:34:08 pm »
Thanks for your fast reply :)

ETA: You hit the nail on he head - removing the #ifdef _MSC_VER fixed it.

MinGW doesn't work at all for me:

$ cmake -G "MinGW Makefiles" ..
CMake Error at C:/Program Files (x86)/CMake/share/cmake-3.4/Modules/CMakeMinGWFi
ndMake.cmake:22 (message):
  sh.exe was found in your PATH, here:

  C:/MinGW/msys/1.0/bin/sh.exe

  For MinGW make to work correctly sh.exe must NOT be in your path.

  Run cmake from a shell that does not have sh.exe in your PATH.

  If you want to use a UNIX shell, then use MSYS Makefiles.

Call Stack (most recent call first):
  CMakeLists.txt:35 (project)


CMake Error: CMake was unable to find a build program corresponding to "MinGW Ma
kefiles".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a differe
nt build tool.
CMake Error: CMake was unable to find a build program corresponding to "MinGW Ma
kefiles".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a differe
nt build tool.
CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
-- Configuring incomplete, errors occurred!

I have been unable to find out how to remove anything from PATH or Path. I went into the Control Panel to fix things up and remove it, but it's still there in MinGW. Opening a new Msys.bat didn't help there either.

make install has the exact same problem as make.
« Last Edit: November 15, 2015, 04:40:07 pm by gunchleoc »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Problem compiling SFML 2.3.2 with MinGW32
« Reply #3 on: November 15, 2015, 04:36:36 pm »
If you use MSYS you should also use the MSYS Makefiles generator. ;)
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

gunchleoc

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Problem compiling SFML 2.3.2 with MinGW32
« Reply #4 on: November 15, 2015, 04:42:03 pm »
I have no idea how to do that - I'm a noob concerning MinGW. I usually do my stuff in Linux.

However, removing the #ifdef _MSC_VER in  include/SFML/OpenGL.hpp fixed it, so I can work from there :)

Thank you both for your help!

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: [Solved] Problem compiling SFML 2.3.2 with MinGW32
« Reply #5 on: November 15, 2015, 05:55:15 pm »
We should fix that in SFML. But I'm sure there's a reason for this #ifdef, and it seems to work for MinGW. How do MinGW and MSYS CMake generators behave differently in this respect?
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
[Solved] Problem compiling SFML 2.3.2 with MinGW32
« Reply #6 on: November 15, 2015, 06:22:48 pm »
I've built SFML with a dozen different MinGW distros and never had issues, so I have to assume it's not a problem with SFML...

The difference between MinGW and MSYS is just that one complaints when sh.exe is in PATH and the other doesn't, or rather one made for MSYS and the other isn't.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything