FLTK logo

[fltk.general] Building Examples on Windows: GLEW on MSVC -- Linker errors

FLTK matrix user chat room
(using Element browser app)   FLTK gitter user chat room   GitHub FLTK Project   FLTK News RSS Feed  
  FLTK Apps      FLTK Library      Forums      Links     Login 
 All Forums  |  Back to fltk.general  ]
 
Previous Message ]New Message | Reply ]Next Message ]

Building Examples on Windows: GLEW on MSVC -- Linker errors Gonzalo Garramuño 02:50 Apr 25  
 
I have glew2.2.0 win64 downloaded from:

https://sourceforge.net/projects/glew/files/glew/2.2.0/glew-2.2.0-win32.zip/download

I unzipped it and the location of the x64 builds is in:

D:/code/lib/glew-2.2.0/bin/Release/x64
D:/code/lib/glew-2.2.0/lib/Release/x64

I moved the .lib and .dlls to the main directories (standard MSVC dirs):

cd D:/code/lib/glew-2.2.0/bin/Release/x64
mv *.dll ../..

cd D:/code/lib/glew-2.2.0/lib/Release/x64
mv *.lib ../..

I had to call cmake with all this (this needs work in the CMakeLists files):

cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=D:/code/lib/glew-2.2.0 -DFLTK_BUILD_EXAMPLES=ON -DCMAKE_CXX_FLAGS=-ID:/code/lib/glew-2.2.0/include

CMake does find glew32.
CMake compiles properly.

CMake does not link properly with the glew32.lib (DLL), getting errors like (maybe I am missing a preprocessor definition of the OpenGL3test is missing #include "windows.h"?

LINK: command "C:\PROGRA~1\MICROS~1\2022\COMMUN~1\VC\Tools\MSVC\1439~1.335\bin\Hostx64\x64\link.exe /nologo examples\CMakeFiles\OpenGL3test.dir\OpenGL3test.cxx.obj /out:bin\examples\OpenGL3test.exe /implib:bin\examples\OpenGL3test.lib /pdb:bin\examples\OpenGL3test.pdb /version:0.0 /machine:x64 /INCREMENTAL:NO /subsystem:windows -LIBPATH:D:\code\applications\mrv2\BUILD-Msys-amd64\Release\FLTK-prefix\src\FLTK\build\src\..\lib lib\fltk_gl.lib D:\code\lib\glew-2.2.0\lib\glew32.lib opengl32.lib glu32.lib lib\fltk.lib comctl32.lib ws2_32.lib gdiplus.lib kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib /MANIFEST /MANIFESTFILE:bin\examples\OpenGL3test.exe.manifest" failed (exit code 1120) with the following output: OpenGL3test.cxx.obj : error LNK2019: símbolo externo __glewBindBuffer sin resolver al que se hace referencia en la función "public: virtual void __cdecl SimpleGL3Window::draw(void)" (?draw@SimpleGL3Window@@UEAAXXZ)

I modified FLTK's CMake files:

diff --git a/CMake/resources.cmake b/CMake/resources.cmake
index e5d6f8c9f..e755f89db 100644
--- a/CMake/resources.cmake
+++ b/CMake/resources.cmake
@@ -152,7 +152,7 @@ endif((NOT APPLE) OR FLTK_BACKEND_X11)
 find_library(LIB_freetype freetype)
 find_library(LIB_GL GL)
 find_library(LIB_MesaGL MesaGL)
-find_library(LIB_GLEW NAMES GLEW glew32)
+find_library(LIB_GLEW NAMES GLEW glew32s glew32)
 find_library(LIB_jpeg jpeg)
 find_library(LIB_png png)
 find_library(LIB_zlib z)

And with the static lib it linked properly.

--
Gonzalo Garramuño
ggarra13@gmail.com

--
You received this message because you are subscribed to the Google Groups "fltk.general" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fltkgeneral+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/fltkgeneral/bd04a635-a09e-43a8-abc9-e2b72338680f%40gmail.com.
Direct Link to Message ]
 
     
Previous Message ]New Message | Reply ]Next Message ]
 
 

Comments are owned by the poster. All other content is copyright 1998-2024 by Bill Spitzak and others. This project is hosted by The FLTK Team. Please report site problems to 'erco@seriss.com'.