简体   繁体   中英

Setting up OpenGL on NetBeans in Window

I'm trying to set up OpenGL in Netbeans 8.1. I have installed MinGW as C++ compiler and it works.

I want to use GLEW and GLFW libraries so I have downloaded them and I have created a include folder where I have stored all the .h files and a libs folder where I have stored the glew32.lib and glfw3.lib . I have included in NetBeans the include folder by setting

Project Properties > Build > C ++ Compiler > Include Directories

and I have included in NetBeans the bin folder by setting

Project Properties > Build > Linker > Libraries

Then in my main.cpp file I have inserted the include for GLEW and GLFW, but when I execute mi file this get me this output error

cd 'D:\Documenti\NetBeansProjects\Test'
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 `/d/Documenti/NetBeansProjects/Test'
"/C/MinGW/msys/1.0/bin/make.exe"  -f nbproject/Makefile-Debug.mk dist/Debug/MinGW-Windows/test.exe
make.exe[2]: Entering directory `/d/Documenti/NetBeansProjects/Test'
mkdir -p dist/Debug/MinGW-Windows
g++     -o dist/Debug/MinGW-Windows/test build/Debug/MinGW-Windows/main.o -l glew32 -lglfw3
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: cannot find -lglew32
c:/mingw/bin/../lib/gcc/mingw32/4.8.1/../../../../mingw32/bin/ld.exe: cannot find -lglfw3
collect2.exe: error: ld returned 1 exit status
make.exe[2]: *** [dist/Debug/MinGW-Windows/test.exe] Error 1
make.exe[2]: Leaving directory `/d/Documenti/NetBeansProjects/Test'
make.exe[1]: *** [.build-conf] Error 2
make.exe[1]: Leaving directory `/d/Documenti/NetBeansProjects/Test'
make.exe": *** [.build-impl] Error 2

BUILD FAILED (exit value 2, total time: 1s)

Does anyone know how to solve this problem?

The linker can't find your libraries because you didn't tell NetBeans a directory where they are stored. Please go to:

Project Properties -> Linker -> Additional Library Directories

and add this directory to your NetBeans project. After that you'll see the additional linker option -L<path> when you compile/link.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM