当我运行以下代码(或我尝试过的任何变体)时,我会遇到总线错误。它可以很好地编译。
#include <GL/glew.h>
#include <GLFW/glfw3.h>
#include <fstream>
#include <iostream>
#include <stream>
void main() {
/* * * * * * * * * * * * * * * * * *
* Code that loads the shader file.*
* This works fine, error is later.*
* * * * * * * * * * * * * * * * * */
/* * * * * * * * * * * * * * * * * *
* Code that generates OpenGL *
* shader and compiles it. Works. *
* * * * * * * * * * * * * * * * * */
// Check for errors compiling shader
bool status;
glGetShaderiv(shaderId, GL_COMPILE_STATUS, &status);
if(status == GL_FALSE) {
// Compiler errors
GLchar* log = (GLchar*) "