Cannot find -lglut but freeglut3-dev is installed - c++

I'm trying to launch a test for opengl on my kubuntu 64b.
Opengl, glew and freeglut are installed but when I compile it says that glut is not found.
CLEAN SUCCESSFUL (total time: 52ms)
"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory `/home/rxp/NetBeansProjects/Cpptest'
"/usr/bin/make" -f nbproject/Makefile-Debug.mk dist/Debug/GNU-Linux-x86/cpptest
make[2]: Entering directory `/home/rxp/NetBeansProjects/Cpptest'
mkdir -p build/Debug/GNU-Linux-x86
rm -f build/Debug/GNU-Linux-x86/main.o.d
g++ -c -g -I../oglpg-8th-edition/include -MMD -MP -MF build/Debug/GNU-Linux-x86/main.o.d -o build/Debug/GNU-Linux-x86/main.o main.cpp
mkdir -p dist/Debug/GNU-Linux-x86
g++ -o dist/Debug/GNU-Linux-x86/cpptest build/Debug/GNU-Linux-x86/main.o -L../oglpg-8th-edition/lib -lGL -lGLEW -lGLU -lGLUT
/usr/bin/ld: cannot find -lGLUT
collect2: error: ld returned 1 exit status
make[2]: *** [dist/Debug/GNU-Linux-x86/cpptest] Error 1
make[2]: Leaving directory `/home/rxp/NetBeansProjects/Cpptest'
make[1]: *** [.build-conf] Error 2
make[1]: Leaving directory `/home/rxp/NetBeansProjects/Cpptest'
make: *** [.build-impl] Error 2
BUILD FAILED (exit value 2, total time: 358ms)
Could you help me ?

You're using -lGLUT. Note that the libraries are case sensitive, so you need to use -lglut instead.
In build command, the libraries should be linked this way:
-lGL -lGLEW -lGLU -lglut

Related

Undefined reference to `fftw_init_threads' while installing pHash library

I am trying to install pHash library on ubuntu, i installed libfftw3 and all the required libraries. Everything is Ok when I run ./configure command, but when i try to run the 'make' command this error always appear : undefined reference to `fftw_init_threads'.
make command :
g551683#sst-p1310007fl:~/Documents/pHash-0.2.9.6$ make
make all-recursive
make[1]: Entering directory '/home/g551683/Documents/pHash-0.2.9.6'
Making all in src
make[2]: Entering directory '/home/g551683/Documents/pHash-0.2.9.6/src'
make[2]: Nothing to be done for 'all'.
make[2]: Leaving directory '/home/g551683/Documents/pHash-0.2.9.6/src'
Making all in bindings
make[2]: Entering directory '/home/g551683/Documents/pHash-0.2.9.6/bindings'
make[3]: Entering directory '/home/g551683/Documents/pHash-0.2.9.6/bindings'
make[3]: Nothing to be done for 'all-am'.
make[3]: Leaving directory '/home/g551683/Documents/pHash-0.2.9.6/bindings'
make[2]: Leaving directory '/home/g551683/Documents/pHash-0.2.9.6/bindings'
Making all in examples
make[2]: Entering directory '/home/g551683/Documents/pHash-0.2.9.6/examples'
/bin/sh ../libtool --tag=CXX --mode=link g++ -O2 -ffast-math -O3 -L/usr/local/lib -lssl -lcrypto -o test_texthash test_texthash.o ../src/libpHash.la -lmpg123 -lsamplerate -lsndfile -lswscale -lavformat -lavutil -lavcodec -lpng -ljpeg -lfftw3
libtool: link: g++ -O2 -ffast-math -O3 -o .libs/test_texthash test_texthash.o -L/usr/local/lib ../src/.libs/libpHash.so -lssl -lcrypto /usr/local/lib/libmpg123.so /usr/lib/x86_64-linux-gnu/libltdl.so -ldl /usr/local/lib/libsamplerate.so -lsndfile -lswscale -lavformat -lavutil -lavcodec /usr/local/lib/libpng16.so -lz /usr/lib/x86_64-linux-gnu/libjpeg.so /usr/local/lib/libfftw3.a -lm
test_texthash.o: In function `_GLOBAL__sub_I_main':
test_texthash.cpp:(.text.startup+0x1b1): undefined reference to `fftw_init_threads'
collect2: error: ld returned 1 exit status
Makefile:323: recipe for target 'test_texthash' failed
make[2]: *** [test_texthash] Error 1
make[2]: Leaving directory '/home/g551683/Documents/pHash-0.2.9.6/examples'
Makefile:419: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/g551683/Documents/pHash-0.2.9.6'
Makefile:298: recipe for target 'all' failed
make: *** [all] Error 2
Can someone help me to solve this error!
From the documentation:
First, programs using the parallel complex transforms should be linked with -lfftw3_threads -lfftw3 -lm on Unix, or -lfftw3_omp -lfftw3 -lm if you compiled with OpenMP. You will also need to link with whatever library is responsible for threads on your system (e.g. -lpthread on GNU/Linux) or include whatever compiler flag enables OpenMP (e.g. -fopenmp with gcc).
You are not linking against this fftw3_threads library, nor to the pthread library.

opengl cannot find libraries in mingw compiler netbeans

cd 'C:\Users\Deepa\Documents\NetBeansProjects\game' C:\MinGW\msys\1.0\bin\make.exe -f Makefile CONF=Debug "/C/MinGW/msys/1.0/bin/make.exe" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make.exe[1]: Entering directory `/c/Users/Deepa/Documents/NetBeansProjects/game' "/C/MinGW/msys/1.0/bin/make.exe" -f nbproject/Makefile-Debug.mk dist/Debug/MinGW-Windows/game.exe
make.exe[2]: Entering directory `/c/Users/Deepa/Documents/NetBeansProjects/game'
mkdir -p build/Debug/MinGW-Windows
g++ -c -g -s -o build/Debug/MinGW-Windows/main.o main.cpp
mkdir -p dist/Debug/MinGW-Windows
g++ -o dist/Debug/MinGW-Windows/game build/Debug/MinGW-Windows/main.o -lglew32 -lglew32s -lglut32
/usr/lib/gcc/x86_64-pc-cygwin/7.3.0/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lglew32s
/usr/lib/gcc/x86_64-pc-cygwin/7.3.0/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lglut32
collect2: error: ld returned 1 exit status
make.exe[2]: *** [dist/Debug/MinGW-Windows/game.exe] Error 1
make.exe[2]: Leaving directory `/c/Users/Deepa/Documents/NetBeansProjects/game'
make.exe[1]: *** [.build-conf] Error 2
make.exe[1]: Leaving directory `/c/Users/Deepa/Documents/NetBeansProjects/game'
make.exe": *** [.build-impl] Error 2
BUILD FAILED (exit value 2, total time: 6s)
im using a minGW compiler but " /usr/lib/gcc/x86_64-pc-cygwin/7.3.0/../../../../x86_64-pc-cygwin/bin/ld: cannot find -lglew32s " it seems to be in cygwin..
why is it so? and i cant build the file help please

Issue when trying out open GL

I'm new to C++. I'm trying to run a simple example openGL application.
I have downloaded the libraries that are used from the following locations.
http://www.glfw.org/index.html
http://glew.sourceforge.net/
http://glm.g-truc.net/0.9.6/index.html
I am using NetBeans IDE as my C++ IDE. I think I have specified the correct Include Directories because the program compiles without any errors. Following is my include path.
../../../../../gl/glm;../../../../../gl/glew-1.12.0/include;../../../../../gl/glfw-3.1.bin.WIN64/include/GLFW
The command that runs when I compile is the following
CLEAN SUCCESSFUL (total time: 552ms)
C:\MinGW\msys\1.0\bin\make.exe -f nbproject/Makefile-Debug.mk build/Debug/MinGW-Windows/main.o
mkdir -p build/Debug/MinGW-Windows
rm -f "build/Debug/MinGW-Windows/main.o.d"
g++ -c -g -I../../../../../gl/glm -I../../../../../gl/glew-1.12.0/include -I../../../../../gl/glfw-3.1.bin.WIN64/include/GLFW -MMD -MP -MF "build/Debug/MinGW-Windows/main.o.d" -o build/Debug/MinGW-Windows/main.o main.cpp
COMPILE FILE SUCCESSFUL (total time: 4s)
But when running the application I get the following errors.
"/C/MinGW/msys/1.0/bin/make.exe" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make.exe[1]: Entering directory `/c/Users/name/Documents/NetBeansProjects/CppApplication_1'
"/C/MinGW/msys/1.0/bin/make.exe" -f nbproject/Makefile-Debug.mk dist/Debug/MinGW-Windows/cppapplication_1.exe
make.exe[2]: Entering directory `/c/Users/name/Documents/NetBeansProjects/CppApplication_1'
mkdir -p dist/Debug/MinGW-Windows
g++ -o dist/Debug/MinGW-Windows/cppapplication_1 build/Debug/MinGW-Windows/main.o -L../../../../../gl/glfw-3.1.bin.WIN64/lib-mingw -L../../../../../gl/glew-1.12.0/bin/Release/x64
build/Debug/MinGW-Windows/main.o: In function `main':
C:\Users\name\Documents\NetBeansProjects\CppApplication_1/main.cpp:19: undefined reference to `glfwInit'
C:\Users\name\Documents\NetBeansProjects\CppApplication_1/main.cpp:25: undefined reference to `glfwWindowHint'
C:\Users\name\Documents\NetBeansProjects\CppApplication_1/main.cpp:26: undefined reference to `glfwWindowHint'
C:\Users\name\Documents\NetBeansProjects\CppApplication_1/main.cpp:27: undefined reference to `glfwWindowHint'
C:\Users\name\Documents\NetBeansProjects\CppApplication_1/main.cpp:28: undefined reference to `glfwWindowHint'
C:\Users\name\Documents\NetBeansProjects\CppApplication_1/main.cpp:31: undefined reference to `glfwCreateWindow'
C:\Users\name\Documents\NetBeansProjects\CppApplication_1/main.cpp:34: undefined reference to `glfwTerminate'
C:\Users\name\Documents\NetBeansProjects\CppApplication_1/main.cpp:37: undefined reference to `glfwMakeContextCurrent'
C:\Users\name\Documents\NetBeansProjects\CppApplication_1/main.cpp:40: undefined reference to `_imp__glewInit#0'
C:\Users\name\Documents\NetBeansProjects\CppApplication_1/main.cpp:46: undefined reference to `glfwSetInputMode'
C:\Users\name\Documents\NetBeansProjects\CppApplication_1/main.cpp:49: undefined reference to `glClearColor#16'
C:\Users\name\Documents\NetBeansProjects\CppApplication_1/main.cpp:55: undefined reference to `glfwSwapBuffers'
C:\Users\name\Documents\NetBeansProjects\CppApplication_1/main.cpp:56: undefined reference to `glfwPollEvents'
C:\Users\name\Documents\NetBeansProjects\CppApplication_1/main.cpp:59: undefined reference to `glfwGetKey'
C:\Users\name\Documents\NetBeansProjects\CppApplication_1/main.cpp:60: undefined reference to `glfwWindowShouldClose'
C:\Users\name\Documents\NetBeansProjects\CppApplication_1/main.cpp:63: undefined reference to `glfwTerminate'
collect2.exe: error: ld returned 1 exit status
make.exe[2]: *** [dist/Debug/MinGW-Windows/cppapplication_1.exe] Error 1
make.exe[2]: Leaving directory `/c/Users/name/Documents/NetBeansProjects/CppApplication_1'
make.exe[1]: *** [.build-conf] Error 2
make.exe[1]: Leaving directory `/c/Users/name/Documents/NetBeansProjects/CppApplication_1'
make.exe": *** [.build-impl] Error 2
BUILD FAILED (exit value 2, total time: 5s)
Under the Build/Linker section, I have given the following as "Additional Library Directories"
../../../../../gl/glew-1.12.0/lib/Release/x64;../../../../../gl/glfw-3.1.bin.WIN64/lib-mingw
I am using MinGW. What am I doing wrong here?
Update:
I supplied the libaries using the -l option. Now I get another error like the following.
"/C/MinGW/msys/1.0/bin/make.exe" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .clean-conf
make.exe[1]: Entering directory `/c/Users/name/Documents/NetBeansProjects/CppApplication_1'
rm -f -r build/Debug
rm -f dist/Debug/MinGW-Windows/cppapplication_1.exe
make.exe[1]: Leaving directory `/c/Users/name/Documents/NetBeansProjects/CppApplication_1'
CLEAN SUCCESSFUL (total time: 1s)
"/C/MinGW/msys/1.0/bin/make.exe" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make.exe[1]: Entering directory `/c/Users/name/Documents/NetBeansProjects/CppApplication_1'
"/C/MinGW/msys/1.0/bin/make.exe" -f nbproject/Makefile-Debug.mk dist/Debug/MinGW-Windows/cppapplication_1.exe
make.exe[2]: Entering directory `/c/Users/name/Documents/NetBeansProjects/CppApplication_1'
mkdir -p build/Debug/MinGW-Windows
rm -f "build/Debug/MinGW-Windows/main.o.d"
g++ -c -g -I../../../../../gl/glm -I../../../../../gl/glew-1.12.0/include -I../../../../../gl/glfw-3.1.bin.WIN64/include/GLFW -MMD -MP -MF "build/Debug/MinGW-Windows/main.o.d" -o build/Debug/MinGW-Windows/main.o main.cpp
mkdir -p dist/Debug/MinGW-Windows
g++ -o dist/Debug/MinGW-Windows/cppapplication_1 build/Debug/MinGW-Windows/main.o -L../../../../../gl/glew-1.12.0/bin/Release/x64 -L../../../../../gl/glfw-3.1.bin.WIN64/lib-mingw -lglfw3 -lglew32
../../../../../gl/glew-1.12.0/bin/Release/x64/glew32.dll: file not recognized: File format not recognized
collect2.exe: error: ld returned 1 exit status
make.exe[2]: *** [dist/Debug/MinGW-Windows/cppapplication_1.exe] Error 1
make.exe[2]: Leaving directory `/c/Users/name/Documents/NetBeansProjects/CppApplication_1'
make.exe[1]: *** [.build-conf] Error 2
make.exe[1]: Leaving directory `/c/Users/name/Documents/NetBeansProjects/CppApplication_1'
make.exe": *** [.build-impl] Error 2
BUILD FAILED (exit value 2, total time: 2s)

GLFW Can't compile example netbeans mingw w64

I used the precompiled version of GLFW for windows. I use netbeans and i can't resolve this error.
"/E/Develop/Util/msys/bin/make.exe" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make.exe[1]: Entering directory `/e/Develop/Project/Netbeans/C++/CppApplication_1'
"/E/Develop/Util/msys/bin/make.exe" -f nbproject/Makefile-Debug.mk dist/Debug/MinGW-w64_x64_-posix-seh-Windows/cppapplication_1.exe
make.exe[2]: Entering directory `/e/Develop/Project/Netbeans/C++/CppApplication_1'
mkdir -p build/Debug/MinGW-w64_x64_-posix-seh-Windows
rm -f "build/Debug/MinGW-w64_x64_-posix-seh-Windows/main.o.d"
g++ -c -g -I/E/Develop/Library/C++/GLFW\ 3.0.4/include -MMD -MP -MF "build/Debug/MinGW-w64_x64_-posix-seh-Windows/main.o.d" -o build/Debug/MinGW-w64_x64_-posix-seh-Windows/main.o main.cpp
mkdir -p dist/Debug/MinGW-w64_x64_-posix-seh-Windows
g++ -o dist/Debug/MinGW-w64_x64_-posix-seh-Windows/cppapplication_1 build/Debug/MinGW-w64_x64_-posix-seh-Windows/main.o -L../../../../Library/C++/GLFW\ 3.0.4/lib-mingw -L../../../../Compiler/C++/MinGW-w64\(x64\)-posix-seh/x86_64-w64-mingw32/lib -lglfw3 -lglfw3dll
e:/Develop/Compiler/C++/MinGW-w64(x64)-posix-seh/bin/../lib/gcc/x86_64-w64-mingw32/4.9.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lglfw3dll
collect2.exe: error: ld returned 1 exit status
make.exe[2]: *** [dist/Debug/MinGW-w64_x64_-posix-seh-Windows/cppapplication_1.exe] Error 1
make.exe[2]: Leaving directory `/e/Develop/Project/Netbeans/C++/CppApplication_1'
make.exe[1]: *** [.build-conf] Error 2
make.exe[1]: Leaving directory `/e/Develop/Project/Netbeans/C++/CppApplication_1' make.exe": *** [.build-impl] Error 2
i add the directory and linked the Libraries like this
this is the code
how can i fix this?
The GLFW has two versions of libraries - static and dynamic (DLL). If you want to link with the static library, then you won't have to include the glfw3dll (which is a DLL link library) into the list of libraries. Please see the Building programs that use GLFW for more info. They also mention other libraries you need to link to.

netbeans mysql connector No such file or directory (MinGW)

i try to link mysql-connector 1.1.3 in Netbeans (7.3, Windows 7) with Mingw-Compiler to my c++ Project.
In the project properties i have add all mysql-connector directories (include, lib, cppcon) under "included Directorys" and under Linker "Additionell Linker Directorys". I added the boost libs to.
But in the Compiler Output say always:
fatal error: mysql_connection.h: No such file or directory
Sorry for my poor english and thanks for help...
the complete output:
"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory /cygdrive/c/Users/Toni/Desktop/dev/Wiesel/new/tests/sql_test2'
"/usr/bin/make" -f nbproject/Makefile-Debug.mk dist/Debug/MinGW-Windows/sql_test2.exe
make[2]: Entering directory/cygdrive/c/Users/Toni/Desktop/dev/Wiesel/new/tests/sql_test2'
mkdir -p build/Debug/MinGW-Windows
rm -f build/Debug/MinGW-Windows/main.o.d
g++ -c -g -I/D/libs/mysql-connector-c++-noinstall-1.1.3-win32 -I/D/libs/mysql-connector-c++-noinstall-1.1.3-win32/include -I/D/libs/mysql-connector-c++-noinstall-1.1.3-win32/include/cppconn -I/D/libs/mysql-connector-c++-noinstall-1.1.3-win32/lib -I/D/libs/boost_1_53_0 -I/D/libs/boost_1_53_0/boost -I/D/libs/boost_1_53_0/libs -MMD -MP -MF build/Debug/MinGW-Windows/main.o.d -o build/Debug/MinGW-Windows/main.o main.cpp
main.cpp:9:30: fatal error: mysql_connection.h: No such file or directory
compilation terminated.
nbproject/Makefile-Debug.mk:66: recipe for target build/Debug/MinGW-Windows/main.o' failed
make[2]: [build/Debug/MinGW-Windows/main.o] Error 1 (ignored)
mkdir -p dist/Debug/MinGW-Windows
g++ -o dist/Debug/MinGW-Windows/sql_test2 build/Debug/MinGW-Windows/main.o -L/D/libs/boost_1_53_0/boost -L/D/libs/boost_1_53_0/libs -L/D/libs/mysql-connector-c++-noinstall-1.1.3-win32 -L/D/libs/mysql-connector-c++-noinstall-1.1.3-win32/include -L/D/libs/mysql-connector-c++-noinstall-1.1.3-win32/include/cppconn -L/D/libs/mysql-connector-c++-noinstall-1.1.3-win32/lib -lmysqlcppconn -lmysqlcppconn-static -lmysqlcppconn -static
g++.exe: error: build/Debug/MinGW-Windows/main.o: No such file or directory
nbproject/Makefile-Debug.mk:62: recipe for targetdist/Debug/MinGW-Windows/sql_test2.exe' failed
make[2]: [dist/Debug/MinGW-Windows/sql_test2.exe] Error 1 (ignored)
make[2]: Leaving directory /cygdrive/c/Users/Toni/Desktop/dev/Wiesel/new/tests/sql_test2'
make[1]: Leaving directory/cygdrive/c/Users/Toni/Desktop/dev/Wiesel/new/tests/sql_test2'
This should be what you're looking for:
A library would normally reside in its own installation directory so you would need to point NB to where that is. If you right-click the project name in the "Projects" window, you'll have a Properties option.
Select the Build/C++ compiler option to add the directory for the .h files.
Select the Build/Linker to add the directory for the dll file.
Include C++ library in Netbeans 7.0