Vydělávej až 160.000 Kč měsíčně! Akreditované rekvalifikační kurzy s garancí práce od 0 Kč. Více informací.
Hledáme nové posily do ITnetwork týmu. Podívej se na volné pozice a přidej se do nejagilnější firmy na trhu - Více informací.

Diskuze: Problem s kompilaci jednoducheho programu v NetBeans [C++, GLFW]

Aktivity
Avatar
honza.b4
Člen
Avatar
honza.b4:19.4.2014 16:35

Ahojte vsichni. Ted sem se zacal ucit OpenGL a nejde mi zkompilovat bezchybne napsany program:

#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <glm/glm.hpp>
#define GLFW_INCLUDE_GL_3
using namespace glm;
using namespace std;

int main(){
    if(!glfwInit()){
        return -1;
    }
    GLFWwindow* window; // (In the accompanying source code, this variable is global)
    window = glfwCreateWindow( 1024, 768, "Tutorial 01", NULL, NULL);
    if( window == NULL ){
    fprintf( stderr, "Failed to open GLFW window. If you have an Intel GPU, they are not 3.3 compatible. Try the 2.1 version of the tutorials.\n" );
    glfwTerminate();
    return -1;
}
    glfwMakeContextCurrent(window);

// Initialize GLEW
    glewExperimental=true; // Needed in core profile
    if (glewInit() != GLEW_OK) {
    fprintf(stderr, "Failed to initialize GLEW\n");
    return -1;
}

    return 0;
}

a tohle je vystup NetBeans:

"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory `/root/NetBeansProjects/pokus'
"/usr/bin/make"  -f nbproject/Makefile-Debug.mk dist/Debug/GNU-Linux-x86/pokus
make[2]: Entering directory `/root/NetBeansProjects/pokus'
mkdir -p build/Debug/GNU-Linux-x86
rm -f "build/Debug/GNU-Linux-x86/main.o.d"
g++    -c -g -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/pokus build/Debug/GNU-Linux-x86/main.o
build/Debug/GNU-Linux-x86/main.o: In function `main':
/root/NetBeansProjects/pokus/main.cpp:15: undefined reference to `glfwInit'
/root/NetBeansProjects/pokus/main.cpp:19: undefined reference to `glfwCreateWindow'
/root/NetBeansProjects/pokus/main.cpp:22: undefined reference to `glfwTerminate'
/root/NetBeansProjects/pokus/main.cpp:25: undefined reference to `glfwMakeContextCurrent'
/root/NetBeansProjects/pokus/main.cpp:28: undefined reference to `glewExperimental'
/root/NetBeansProjects/pokus/main.cpp:29: undefined reference to `glewInit'
collect2: error: ld returned 1 exit status
make[2]: *** [dist/Debug/GNU-Linux-x86/pokus] Error 1
make[2]: Leaving directory `/root/NetBeansProjects/pokus'
make[1]: *** [.build-conf] Error 2
make[1]: Leaving directory `/root/NetBeansProjects/pokus'
make: *** [.build-impl] Error 2

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

Nevite co s tim je? Pouzivam OS Linux. Hlavickove soubory jsou spravne nainstalovane. Predem dekuju za pomoc

 
Odpovědět
19.4.2014 16:35
Avatar
Libor Šimo (libcosenior):19.4.2014 16:53

Podla vsetkeho nemas v IDE pridanu kniznicu pre opengl, tak sa nemaju z coho includovat tie vypisane.

Nahoru Odpovědět
19.4.2014 16:53
Aj tisícmíľová cesta musí začať jednoduchým krokom.
Avatar
honza.b4
Člen
Avatar
Odpovídá na Libor Šimo (libcosenior)
honza.b4:19.4.2014 17:31

A jak se da pridat?

 
Nahoru Odpovědět
19.4.2014 17:31
Avatar
Libor Šimo (libcosenior):19.4.2014 17:57

Ja som si pred rokom pridaval do code:blocks, ale navod som si nasiel na nete.

Nahoru Odpovědět
19.4.2014 17:57
Aj tisícmíľová cesta musí začať jednoduchým krokom.
Avatar
honza.b4
Člen
Avatar
Odpovídá na Libor Šimo (libcosenior)
honza.b4:19.4.2014 18:20

ted sem si neco vygooglil na stackoverflow.com

shrnuto: pridal sem parametry do linkeru, ale stale to nefunguje (ale hazi to uz min chyb :-D )

"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory `/home/jan/NetBeansProjects/a'
"/usr/bin/make"  -f nbproject/Makefile-Debug.mk dist/Debug/GNU-Linux-x86/a
make[2]: Entering directory `/home/jan/NetBeansProjects/a'
mkdir -p dist/Debug/GNU-Linux-x86
g++     -o dist/Debug/GNU-Linux-x86/a build/Debug/GNU-Linux-x86/main.o  -lglfw3 -lGL -lGLU -lglfw -lX11 -lXi -lXxf86vm
/usr/bin/ld: //usr/local/lib/libglfw3.a(glx_context.c.o): undefined reference to symbol 'pthread_key_delete@@GLIBC_2.2.5'
//lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [dist/Debug/GNU-Linux-x86/a] Error 1
make[2]: Leaving directory `/home/jan/NetBeansProjects/a'
make[1]: *** [.build-conf] Error 2
make[1]: Leaving directory `/home/jan/NetBeansProjects/a'
make: *** [.build-impl] Error 2

BUILD FAILED (exit value 2, total time: 217ms)
 
Nahoru Odpovědět
19.4.2014 18:20
Děláme co je v našich silách, aby byly zdejší diskuze co nejkvalitnější. Proto do nich také mohou přispívat pouze registrovaní členové. Pro zapojení do diskuze se přihlas. Pokud ještě nemáš účet, zaregistruj se, je to zdarma.

Zobrazeno 5 zpráv z 5.