How to get rid of GLU while using legacy OpenGL (1.x) [duplicate] - opengl

This question already has answers here:
What is an undefined reference/unresolved external symbol error and how do I fix it?
(39 answers)
How to compile GLUT + OpenGL project with CMake and Kdevelop in linux?
(4 answers)
Closed 5 months ago.
When I compile my old program with CMake I keep getting this message:
-- WARNING: you are using the obsolete 'GLU' package, please use 'OpenGL' instead
OK, so I tried to remove this form CMakeFiles
find_package( OpenGL REQUIRED )
#find_package( GLU REQUIRED )
find_package( SDL2 REQUIRED )
add_executable ( test_app test_app.cpp $<TARGET_OBJECTS:SDL2OGL> $<TARGET_OBJECTS:DynamicOpt> )
#target_link_libraries( test_app ${OpenGL_LIBRARY} ${GLU_LIBRARY} ${SDL2_LIBRARY} )
target_link_libraries( test_app ${OpenGL_LIBRARY} ${SDL2_LIBRARY} )
But then the legacy OpenGL functions are undefined?
undefined reference to `glTranslatef'
undefined reference to `glPopMatrix'
undefined reference to `glPushMatrix'
undefined reference to `glCallList'
undefined reference to `glColor3f'
undefined reference to `glDisable'
undefined reference to `glShadeModel'
...
So I don't know, what should I do to link it against OpenGL properly. Do I need GLU for legacy OpenGL or not?
EDIT:
aha so the whole problem was that I had OPENGL_LIBRARY instead of OPENGL_LIBRARIES, as pointed by Tsyvarev, Thanks!
In other words, It turned out, I was using GLU_LIBRARY just to replace missing OPENGL_LIBRARIES

Related

Failure to link Qhull C++ interface in ROS catkin project

I'm having some trouble getting the QHull C++ interface working in a catkin project. My project compiles fine and I've specified the library to be used by the linker, however it fails to link with the following error messages.
CMakeFiles/path_to/my_code.cpp.o: In function `main':
my_code.cpp:(.text+0x17ab): undefined reference to `orgQhull::RboxPoints::RboxPoints()'
my_code.cpp:(.text+0x182a): undefined reference to `orgQhull::PointCoordinates::appendPoints(std::istream&)'
my_code.cpp:(.text+0x1839): undefined reference to `orgQhull::Qhull::Qhull()'
my_code.cpp:(.text+0x1857): undefined reference to `orgQhull::Qhull::runQhull(orgQhull::RboxPoints const&, char const*)'
my_code.cpp:(.text+0x18aa): undefined reference to `orgQhull::Qhull::outputQhull(char const*)'
my_code.cpp:(.text+0x19d0): undefined reference to `orgQhull::Qhull::~Qhull()'
my_code.cpp:(.text+0x19ee): undefined reference to `orgQhull::RboxPoints::~RboxPoints()'
my_code.cpp:(.text+0x1c10): undefined reference to `orgQhull::Qhull::~Qhull()'
my_code.cpp:(.text+0x1c38): undefined reference to `orgQhull::RboxPoints::~RboxPoints()'
CMakeFiles/build_path/my_code.cpp.o: In function `orgQhull::Qhull::setOutputStream(std::ostream*)':
I've installed the following packages, to get the shared object and development files.
libqhull-dev
libqhull-doc
libqhull7
qhull-bin
I don't know if this is related to the problem, but looking into the libqhull.so shared object there are no symbols in it.
####:/usr/lib/x86_64-linux-gnu$ nm -g libqhull.so
nm: libqhull.so: no symbols
Has anyone got any experience getting this to work on linux? Any help would be appreciated.
I'm using ROS Indigo, this works for me:
SET(qhullDir path_to_qhull_code)
INCLUDE_DIRECTORIES(${qhullDir}/src/libqhullcpp)
INCLUDE_DIRECTORIES(${qhullDir}/src)
LINK_DIRECTORIES(${qhullDir}/build)
INCLUDE_DIRECTORIES(${qhullDir}/src/libqhullcpp)
INCLUDE_DIRECTORIES(include)
SET(qhullLibs qhullcpp qhull_r)
add_library(${PROJECT_NAME}_library
src/myClass.cpp)
add_executable(libExample
src/myrunnable.cpp)
target_link_libraries(libExample
${PROJECT_NAME}_library ${qhullLibs})
SET_TARGET_PROPERTIES(libExample PROPERTIES
COMPILE_DEFINITIONS "qh_QHpointer")
I'm compiling qhull from source with cmake.
Maybe this helps someone.

Mosquitto with ROS Jade undefined reference [duplicate]

This question already has answers here:
What is an undefined reference/unresolved external symbol error and how do I fix it?
(39 answers)
Closed 6 years ago.
I am currently using ROS Jade in Ubuntu 14.04 and am trying to create a MQTT Publisher to my Mosquitto software. However, I am unable to build it properly via catkin_make. In my main cpp code, I have included the "mosquitto.h" file. Apologies that I am unable to post my cpp file as it is for work purposes.
CMakeLists.txt
cmake_minimum_required(VERSION 2.8.3)
find_package(catkin REQUIRED COMPONENTS
roscpp
rospy
std_msgs
)
catkin_package(
INCLUDE_DIRS include
LIBRARIES mqtt
CATKIN_DEPENDS roscpp std_msgs
DEPENDS system_lib
)
set(MOSQ_LIB_LOCATIONS
/usr/lib
)
set(INCLUDE_HEADER_FILES
src/mosquitto.h
#include/lib/cpp/mosquittopp.h
)
include_directories(
${catkin_INCLUDE_DIRS}
${mosquitto_INCLUDE_DIRS}
/home/catkin_ws/src/mqtt/include/lib
/home/catkin_ws/src/mqtt/include/lib/cpp
)
add_executable(mqtt src/mqtt.transmit.cpp ${INCLUDE_HEADER_FILES} ${MOSQ_LIB_LOCATIONS})
target_link_libraries(mqtt ${catkin_LIBRARIES})
Error
mqtt.transmit.cpp:(.text+0x1f8): undefined reference to `mosquitto_lib_init'
mqtt.transmit.cpp:(.text+0x210): undefined reference to `mosquitto_new'
mqtt.transmit.cpp:(.text+0x237): undefined reference to `mosquitto_username_pw_set'
mqtt.transmit.cpp:(.text+0x259): undefined reference to `mosquitto_connect'
mqtt.transmit.cpp:(.text+0x285): undefined reference to `mosquitto_loop_start'
mqtt.transmit.cpp:(.text+0x2bc): undefined reference to `mosquitto_publish'
mqtt.transmit.cpp:(.text+0x2d0): undefined reference to `mosquitto_loop_stop'
mqtt.transmit.cpp:(.text+0x2df): undefined reference to `mosquitto_disconnect'
mqtt.transmit.cpp:(.text+0x2ee): undefined reference to `mosquitto_destroy'
mqtt.transmit.cpp:(.text+0x2f3): undefined reference to `mosquitto_lib_cleanup'
collect2: error: ld returned 1 exit status
I initially thought that there was an error reading the header file which I included, but if that was the case, the "no such file directory" error would occur. The functions that were in the "undefined references" are located in the header file which I included, not sure why it is still undefined. Would appreciate the guidance to get rid of the undefined reference.
Thanks so much!
[EDIT] I got the MQTT Publishing cpp code from the following site, you have to scroll to the bottom. Thanks! Mosquitto software is working fine.
https://robomq.readthedocs.io/en/latest/MQTT/
In this case it's the linker that cannot find the object files that contain the function names displayed in the error output. Unless you changed this CMake file, I would guess that the necessary object files are not in your /usr/lib dir which is where the linker is looking.
Solved. When using Mosquitto, I had to link the client library in my CMakeList. Basically the libmosquitto.so file, which is the client library.
I added the following to my cmake list:
set(Mosquitto_libs
/usr/lib/x86_64-linux-gnu/libmosquitto.so
/usr/lib/x86_64-linux-gnu/libmosquitto.so.1
)
target_link_libraries(mqtt_pub_node ${catkin_LIBRARIES} ${Mosquitto_libs})

Trying to compile OpenGL 4 Helloworld in CLion+CMake+MinGW on Windows. "undefined reference to `_imp____glewCreateShader' " errors [duplicate]

This question already has answers here:
What is an undefined reference/unresolved external symbol error and how do I fix it?
(39 answers)
Closed 7 years ago.
Googling aroung told me it was "wrong VS libraries" but when tried to use glew-1.5.4-mingw32 and libgluew32.a instead of glew32.lib (and same done to glut) nothing changed.
main.cpp got from project on VS2012, attaching same libs, so it may not be wrong.
Some files I use to make:
CMakeLists.txt
cmake_minimum_required(VERSION 2.8.4)
project(HelloGL)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
add_executable(HelloGL main.cpp)
set(LIBS_DIR D:/libs)
set(GLEW_ROOT_DIR ${LIBS_DIR}/glew-1.5.4-mingw32 )
set(GLUT_ROOT_DIR ${LIBS_DIR}/glut-3.7.6-src/glut-3.7.6 )
set(GLEW_INCLUDE_DIRS ${GLEW_ROOT_DIR}/include)
set(GLUT_INCLUDE_DIRS ${GLUT_ROOT_DIR}/include)
set(GLEW_LIBRARY ${GLEW_ROOT_DIR}/lib/libglew32.a)
set(GLUT_LIBRARY ${GLUT_ROOT_DIR}/lib/glut/libglut32.a)
include_directories( ${GLEW_INCLUDE_DIRS} ${GLUT_INCLUDE_DIRS} )
target_link_libraries(HelloGL ${GLEW_LIBRARY} ${GLUT_LIBRARY} )
Part of LOG:
"D:\Tools\CLion 140.569.17\bin\cmake\bin\cmake.exe" --build C:\Users\Alexey\.clion10\system\cmake\generated\dc6fcb22\dc6fcb22\Debug --target HelloGL -- -j 8
-- Configuring done
-- Generating done
-- Build files have been written to: C:/Users/Alexey/.clion10/system/cmake/generated/dc6fcb22/dc6fcb22/Debug
Linking CXX executable HelloGL.exe
CMakeFiles\HelloGL.dir/objects.a(main.cpp.obj): In function `Z11LoadShadersPKcS0_':
D:/Projects/CPP/HelloGL/main.cpp:19: undefined reference to `_imp____glewCreateShader'
D:/Projects/CPP/HelloGL/main.cpp:20: undefined reference to `_imp____glewCreateShader'
D:/Projects/CPP/HelloGL/main.cpp:56: undefined reference to `_imp____glewShaderSource'
D:/Projects/CPP/HelloGL/main.cpp:57: undefined reference to `_imp____glewCompileShader'
D:/Projects/CPP/HelloGL/main.cpp:60: undefined reference to `_imp____glewGetShaderiv'
D:/Projects/CPP/HelloGL/main.cpp:61: undefined reference to `_imp____glewGetShaderiv'
D:/Projects/CPP/HelloGL/main.cpp:64: undefined reference to `_imp____glewGetShaderInfoLog'
Try adding this line to your CMakeLists.txt:
add_definitions(-DGLEW_STATIC)
It seems that you are trying to link GLEW statically but you didn't define GLEW_STATIC
Did you compile GLEW yourself?
Generally the library called glew32 is dynamic linking and glew32s is static. MinGW really does not like the dynamic (DLL) version of GLEW and you should probably avoid it. The pre-built Windows dynamic GLEW libraries that are distributed on the GLEW site will not work with MinGW because of differences between Visual C++ and gcc's function naming convention for import libraries (it is a difference of one underscore, but enough to make life really difficult).
If you #define GLEW_STATIC before including <glew.h> and link to glew32s that will eliminate any potential issues with the dynamic linking library. In practice, this works best if you add the definition to your Makefile as Nazar554 has demonstrated.
This gist is how I compile OpenGL project in linux. Hope it helps

FLTK 1.3 Linking errors

I update my FLTK from 1.1 to 1.3, then I can't compile my code which is worked well before update.
...
[100%] Building CXX object CMakeFiles/PROSTVIEW.dir/include/nifti/vtkznzlib.cxx.o
Linking CXX executable PROSTVIEW
/usr/local/lib/libfltk.a(fl_font.cxx.o): In function `fontopen(char const*, int, bool, int)':
fl_font.cxx:(.text+0x298): undefined reference to `FcPatternCreate'
fl_font.cxx:(.text+0x362): undefined reference to `FcPatternAddString'
fl_font.cxx:(.text+0x3e3): undefined reference to `FcPatternAddString'
fl_font.cxx:(.text+0x3f7): undefined reference to `FcPatternAddInteger'
fl_font.cxx:(.text+0x40b): undefined reference to `FcPatternAddInteger'
fl_font.cxx:(.text+0x424): undefined reference to `FcPatternAddDouble'
fl_font.cxx:(.text+0x43c): undefined reference to `FcPatternAddString'
fl_font.cxx:(.text+0x4df): undefined reference to `FcMatrixRotate'
fl_font.cxx:(.text+0x4f7): undefined reference to `FcPatternAddMatrix'
fl_font.cxx:(.text+0x516): undefined reference to `FcPatternAddBool'
fl_font.cxx:(.text+0x52c): undefined reference to `FcPatternAddBool'
fl_font.cxx:(.text+0x549): undefined reference to `XftFontMatch'
fl_font.cxx:(.text+0x5a0): undefined reference to `XftFontOpen'
fl_font.cxx:(.text+0x5b0): undefined reference to `FcPatternDestroy'
fl_font.cxx:(.text+0x5f3): undefined reference to `XftFontOpenPattern'
fl_font.cxx:(.text+0x603): undefined reference to `FcPatternDestroy'
fl_font.cxx:(.text+0x659): undefined reference to `XftFontOpenXlfd'
/usr/local/lib/libfltk.a(fl_font.cxx.o): In function `utf8extents(Fl_Font_Descriptor*, char const*, int, _XGlyphInfo*)':
fl_font.cxx:(.text+0x84b): undefined reference to `XftTextExtents32'
/usr/local/lib/libfltk.a(fl_font.cxx.o): In function `fl_xft_width(Fl_Font_Descriptor*, unsigned int*, int)':
fl_font.cxx:(.text+0x98a): undefined reference to `XftTextExtents32'
/usr/local/lib/libfltk.a(fl_font.cxx.o): In function `fl_destroy_xft_draw(unsigned long)':
fl_font.cxx:(.text+0x102e): undefined reference to `XftDrawChange'
/usr/local/lib/libfltk.a(fl_font.cxx.o): In function `Fl_Xlib_Graphics_Driver::draw(char const*, int, int, int)':
fl_font.cxx:(.text+0x10c6): undefined reference to `XftDrawCreate'
fl_font.cxx:(.text+0x10f6): undefined reference to `XftDrawChange'
fl_font.cxx:(.text+0x1140): undefined reference to `XftDrawSetClip'
fl_font.cxx:(.text+0x1202): undefined reference to `XftDrawString32'
/usr/local/lib/libfltk.a(fl_font.cxx.o): In function `fl_drawUCS4(Fl_Graphics_Driver*, unsigned int const*, int, int, int)':
fl_font.cxx:(.text+0x1313): undefined reference to `XftDrawCreate'
fl_font.cxx:(.text+0x1343): undefined reference to `XftDrawChange'
fl_font.cxx:(.text+0x138d): undefined reference to `XftDrawSetClip'
fl_font.cxx:(.text+0x1433): undefined reference to `XftDrawString32'
/usr/local/lib/libfltk.a(fl_font.cxx.o): In function `Fl_Xlib_Graphics_Driver::rtl_draw(char const*, int, int, int)':
fl_font.cxx:(.text+0x1480): undefined reference to `FcUtf8Len'
fl_font.cxx:(.text+0x14ff): undefined reference to `FcUtf8ToUcs4'
collect2: ld returned 1 exit status
make[2]: *** [PROSTVIEW] Error 1
make[1]: *** [CMakeFiles/PROSTVIEW.dir/all] Error 2
make: *** [all] Error 2
Here's my CMakeLists.txt
cmake_minimum_required(VERSION 2.6)
PROJECT(PROSTVIEW)
SET(CMAKE_BUILD_TYPE DEBUG)
SET(CMAKE_CXX__FLAGS -O3 -pipe -ffast-math -Wno-deprecated)
# Chargement Package
# FLTK
FIND_PACKAGE ( FLTK )
IF ( FLTK_FOUND )
INCLUDE_DIRECTORIES( ${FLTK_INCLUDE_DIR} )
ENDIF ( FLTK_FOUND )
# ITK
FIND_PACKAGE ( ITK )
IF ( ITK_FOUND )
INCLUDE( ${USE_ITK_FILE} )
ENDIF( ITK_FOUND )
# VTK
FIND_PACKAGE ( VTK )
IF ( VTK_FOUND )
INCLUDE( ${USE_VTK_FILE} )
ENDIF( VTK_FOUND )
SET(VTK_LIBRARIES vtkCommon vtkRendering vtkWidgets vtkGraphics vtkGenericFiltering vtkzlib)
# vtkFlRenderWindowInteractor
SET(VTKFL_INCLUDE_DIR "include/vtkfl")
SET(VTKFL_CPP
${VTKFL_INCLUDE_DIR}/vtkFlRenderWindowInteractor.cxx)
# Auxiliary_Tools
SET(AT_DIR "include/Auxiliary_Tools")
SET(AT_INCLUDE_DIR ${AT_DIR}/include)
SET(AT_LIBRARY_DIR ${AT_DIR}/lib)
#Nifty
SET(NII_DIR "include/nifti")
SET(NII_SRC
${NII_DIR}/vtkNIfTIReader.cxx
${NII_DIR}/vtkNIfTIWriter.cxx
${NII_DIR}/vtkAnalyzeReader.cxx
${NII_DIR}/vtkAnalyzeWriter.cxx
${NII_DIR}/vtknifti1_io.cxx
${NII_DIR}/vtkznzlib.cxx)
#Other include
SET(PROSTVIEW_INCLUDE_DIR "include")
SET(PROSTVIEW_SRC
${PROSTVIEW_INCLUDE_DIR}/ContourTmt.cpp
${PROSTVIEW_INCLUDE_DIR}/conversion.cpp
${PROSTVIEW_INCLUDE_DIR}/TmtMatrix.cpp)
# VOLUME Widget
SET(VOLUME_WIDGET_DIR "include/GUI")
SET(VOLUME_WIDGET
${VOLUME_WIDGET_DIR}/VOLUME_Loader.cpp
${VOLUME_WIDGET_DIR}/VOLUME_Widget.cpp
${VOLUME_WIDGET_DIR}/VOLUME_Mouse_Widget.cpp
${VOLUME_WIDGET_DIR}/VOLUME_3DView.cpp
${VOLUME_WIDGET_DIR}/CONTOUR_Loader.cpp
${VOLUME_WIDGET_DIR}/ProstView.cpp)
# MODULES
SET(MODULE_DIR "Module")
# SEGMENTATION
SET(SEGMENTATION_DIR "Module/Segmentation")
SET(SEGMENTATION
${SEGMENTATION_DIR}/DDC2D.cpp
${SEGMENTATION_DIR}/DDC3D.cpp
${SEGMENTATION_DIR}/DDC3DHu.cpp
${SEGMENTATION_DIR}/DDC3DPlus.cpp
${SEGMENTATION_DIR}/DDC3DBal.cpp
${SEGMENTATION_DIR}/IMAGE_ENERGY.cpp
${SEGMENTATION_DIR}/REGULARIZATION.cpp
${SEGMENTATION_DIR}/OPTIMAL_SURFACE_DETECTION.cpp
${SEGMENTATION_DIR}/OPTIMAL_MULTIPLE_SURFACES_DETECTION.cpp
${SEGMENTATION_DIR}/RESAMPLE_From_Prostate.cpp
${SEGMENTATION_DIR}/RECTAL_WALL_US.cpp
${SEGMENTATION_DIR}/BLADDER_MRI.cpp
${SEGMENTATION_DIR}/RECTUM_MRI.cpp
${SEGMENTATION_DIR}/REGION_GROWING.tpp )
#MESH
SET(MESH_DIR "Module/Mesh")
SET(MESH
${MESH_DIR}/GENERIC_MESH.cpp
${MESH_DIR}/ELLIPSOID_MESH.cpp
${MESH_DIR}/PROSTATE_MESH.cpp
${MESH_DIR}/TUBULAR_MESH.cpp
${MESH_DIR}/OPEN_MESH.cpp
${MESH_DIR}/QUADRIC_MESH.cpp
${MESH_DIR}/ELLIPTICAL_CYLINDER_MESH.cpp
${MESH_DIR}/CONTOURS_MAN_MESH.cpp)
#STUDY
SET(STUDY_DIR "Module/Statistics")
SET(STUDY
${STUDY_DIR}/PROFILE.cpp
${STUDY_DIR}/Histogram.cpp
${STUDY_DIR}/HISTOGRAM_FROM_MESH.cpp
${STUDY_DIR}/TRAINING_SET_ALIGNMENT.cpp
${STUDY_DIR}/APPEARANCE_MODEL.cpp)
# MOMENTS
SET(MOMENTS_DIR "Module/Moments")
SET(MOMENTS
${MOMENTS_DIR}/KRAWTCHOUK_Moments.tpp
${MOMENTS_DIR}/TCHEBICHEF_Moments.tpp
${MOMENTS_DIR}/GEOMETRIC_Moments.tpp)
#VALIDATION
SET(VALIDATION_DIR "Module/Evaluation")
SET(VALIDATION
${VALIDATION_DIR}/Metrics.cpp)
# Include et Link Directories
INCLUDE_DIRECTORIES(${FLTK_INCLUDE_DIR} ${VTK_INCLUDE_DIRS} ${VTKFL_INCLUDE_DIR} ${AT_INCLUDE_DIR} ${NII_DIR} ${PROSTVIEW_INCLUDE_DIR} ${VOLUME_WIDGET_DIR} ${MODULE_DIR})
LINK_DIRECTORIES(${FLTK_LIBRARY_DIR} ${VTK_LIBRARY_DIRS} ${AT_LIBRARY_DIR} ${PROSTVIEW_INCLUDE_DIR} ${VOLUME_WIDGET_DIR} ${MODULE_DIR})
# Sources
SET(SRC main.cpp)
# Executables and "stand-alone " librairies
ADD_EXECUTABLE(PROSTVIEW ${SRC} ${PROSTVIEW_SRC} ${VTKFL_CPP} ${VOLUME_WIDGET} ${SEGMENTATION} ${MESH} ${STUDY} ${MOMENTS} ${VALIDATION} ${NII_SRC})
# Linkage
TARGET_LINK_LIBRARIES(PROSTVIEW ${FLTK_LIBRARIES} ${VTK_LIBRARIES} ${ITK_LIBRARIES})
I tried to add some libs in my CMakeLists.txt, but it's not work. Who can tell me what’s the problem?
From FLTK 1.3's README.CMake.txt:
USING CMAKE WITH FLTK
This howto assumes that you have FLTK libraries which were built using
CMake, installed. Building them with CMake generates some CMake
helper files which are installed in standard locations, making FLTK
easy to find and use.
Here is a basic CMakeLists.txt file using FLTK.
cmake_minimum_required(VERSION 2.6)
project(hello)
find_package(FLTK REQUIRED NO_MODULE) include(${FLTK_USE_FILE})
add_executable(hello WIN32 hello.cxx)
target_link_libraries(hello fltk)
The find_package command tells CMake to find the package FLTK,
REQUIRED means that it is an error if it's not found. NO_MODULE tells
it to search only for the FLTKConfig file, not using the
FindFLTK.cmake supplied with CMake, which doesn't work with this
version of FLTK.
Once the package is found we include the ${FLTK_USE_FILE} which adds
the FLTK include directories and library link information to its
knowledge base. After that your programs will be able to find FLTK
headers and when you link the fltk library, it automatically links the
libraries fltk depends on.
It seems that from FLTK 1.1 to 1.3 they changed the method needed to find the library, maybe for comparability/testing reasons?
I got hung up on the same issue, hope someone finds this useful. :)

How to use GLEW with MinGW [duplicate]

This question already has answers here:
What is an undefined reference/unresolved external symbol error and how do I fix it?
(39 answers)
Closed 7 years ago.
I was trying to use glew32.lib file to link in my project, than I compile Glew source by myself to get glew.a file. Now, I have these link errors in my project:
g++ -o Chapter10(OpenCLTest).exe src\Chapter10(OpenCLTest).o -lopengl32 -lglew -lglut32 -lglu32 -lopencl
src\Chapter10(OpenCLTest).o:Chapter10(OpenCLTest).cpp:(.text+0x167): undefined reference to `_imp____glewBindBuffer'
src\Chapter10(OpenCLTest).o:Chapter10(OpenCLTest).cpp:(.text+0x39a): undefined reference to `_imp__glewInit'
src\Chapter10(OpenCLTest).o:Chapter10(OpenCLTest).cpp:(.text+0x3a7): undefined reference to `_imp__glewIsSupported'
src\Chapter10(OpenCLTest).o:Chapter10(OpenCLTest).cpp:(.text+0x48a): undefined reference to `_imp____glewGenBuffers'
src\Chapter10(OpenCLTest).o:Chapter10(OpenCLTest).cpp:(.text+0x495): undefined reference to `_imp____glewBindBuffer'
src\Chapter10(OpenCLTest).o:Chapter10(OpenCLTest).cpp:(.text+0x4dd): undefined reference to `_imp____glewBufferData'
src\Chapter10(OpenCLTest).o:Chapter10(OpenCLTest).cpp:(.text+0x50b): undefined reference to `_imp____glewGetBufferParameteriv'
src\Chapter10(OpenCLTest).o:Chapter10(OpenCLTest).cpp:(.text+0x1d67): undefined reference to `_imp____glewBindBuffer'
src\Chapter10(OpenCLTest).o:Chapter10(OpenCLTest).cpp:(.text+0x1d7f): undefined reference to `_imp____glewDeleteBuffers'
src\Chapter10(OpenCLTest).o:Chapter10(OpenCLTest).cpp:(.text+0x1d95): undefined reference to `_imp____glewBindBuffer'
src\Chapter10(OpenCLTest).o:Chapter10(OpenCLTest).cpp:(.text+0x1dad): undefined reference to `_imp____glewDeleteBuffers'
src\Chapter10(OpenCLTest).o:Chapter10(OpenCLTest).cpp:(.text+0x2078): undefined reference to `_imp____glewBindBuffer'
collect2: ld returned 1 exit status
It is good to solve this problem but by the way I want to ask are there any other opengl implementaions of gl extentions?
I'm afraid you can't use glew.lib with g++ (because .lib is a proprietary Microsoft format). These errors you get are missing function entry points, meaning that you didn't compile GLEW correctly (the required functions are not exported in your .so - need to know more details in order to be able to solve this issue).
As for the other part of the question, you can try GLEH. It is still in the development phase and may need some tweaking to work for you, but we've been using it quite successfuly in linux so it shouldn't be too bad.
(I know this is a bit late, but I figured it might solve someone else's problem, so) I had a very similar problem compiling a program that linked to GLEW dynamically. It turns out that I had overlooked the libglew32.dll.a file - that also needed to be present (in addition to libglew32.a and glew32.dll that I had previously copied to my project folder.)
You could try GLee which essentially does the same thing as GLEW.
Strange nobody has said anything about this. By default on Windows, the GLEW headers use declspec(dllimport) for all of the external functions, which mangles all of their names. This is why all of the missing external symbol names all have _imp____ at the front.
If you wan't to use a static build of GLEW (you mentioned something about libglew.a), define GLEW_STATIC during the build of GLEW and during the build of your application. This will unmangle the names for static linking.
If you want to link to a shared library version of GLEW, make sure to build GLEW with GLEW_BUILD. I'm not sure if this is necessary with gcc but it is if the library is built with MSVC.
Furthermore, the GNU toolchain actually supports Microsoft's .lib format for linking. source
You may find it easiest to just compile GLEW yourself or even include it in your project. It is only one source file and a few headers. To compile the library manually, use something along the lines of gcc -shared -o libGLEW.dll -Wl,--out-implib=libGLEW.dll.a -O2 -DGLEW_BUILD glew.c. To get the static version use something like gcc -c -O2 -DGLEW_STATIC glew.c instead.