#include <stdlib.h>
#define GLEW_STATIC
#include <GL/glew.h>
#include "GLFW/glfw3.h"
#include <iostream>
int main(){
if( !glfwInit() ) exit(EXIT_FAILURE);
int w = 1024; int h = 768;
GLFWwindow * window; //Create Window (use glfwGetPrimaryMonitor() for fullscreen)
window = glfwCreateWindow(w,h,"glfw",NULL,NULL);
if (!window) { //Check Validity
glfwTerminate();
exit(EXIT_FAILURE);
}
glfwMakeContextCurrent(window); //Make Window Current Context
printf("hello window\n");
/*-----------------------------------------------------------------------------
* MAIN LOOP
*-----------------------------------------------------------------------------*/
while ( !glfwWindowShouldClose(window) ){
glViewport(0,0,w,h); //Set Viewport in pixels
glClearColor(1,0,0,1); //CLEAR WINDOW CONTENTS
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
//put drawing code in here
glfwSwapBuffers(window); //<-- SWAP BUFFERS
glfwPollEvents(); //<-- LISTEN FOR WINDOW EVENTS
}
//Destroy window and terminate glfw
glfwDestroyWindow(window);
glfwTerminate();
printf("goodbye window\n");
return 0;
}
1>------ 已启动生成: 项目: LearnOpenGL, 配置: Debug Win32 ------
1> main.cpp
1>main.obj : error LNK2019: 无法解析的外部符号 _glfwInit,该符号在函数 _main 中被引用
1>main.obj : error LNK2019: 无法解析的外部符号 _glfwTerminate,该符号在函数 _main 中被引用
1>main.obj : error LNK2019: 无法解析的外部符号 _glfwCreateWindow,该符号在函数 _main 中被引用
1>main.obj : error LNK2019: 无法解析的外部符号 _glfwDestroyWindow,该符号在函数 _main 中被引用
1>main.obj : error LNK2019: 无法解析的外部符号 _glfwWindowShouldClose,该符号在函数 _main 中被引用
1>main.obj : error LNK2019: 无法解析的外部符号 _glfwPollEvents,该符号在函数 _main 中被引用
1>main.obj : error LNK2019: 无法解析的外部符号 _glfwMakeContextCurrent,该符号在函数 _main 中被引用
1>main.obj : error LNK2019: 无法解析的外部符号 _glfwSwapBuffers,该符号在函数 _main 中被引用
1>D:\数据与文档\OpenGL\程序\LearnOpenGL\Debug\LearnOpenGL.exe : fatal error LNK1120: 8 个无法解析的外部命令
========== 生成: 成功 0 个,失败 1 个,最新 0 个,跳过 0 个 ==========
依旧是error2019问题,这个连接错误我在网上查了半天都没有一个解决的好办法,求群里的大神给看看
#define GLEW_STATIC
#include <GL/glew.h>
#include "GLFW/glfw3.h"
#include <iostream>
int main(){
if( !glfwInit() ) exit(EXIT_FAILURE);
int w = 1024; int h = 768;
GLFWwindow * window; //Create Window (use glfwGetPrimaryMonitor() for fullscreen)
window = glfwCreateWindow(w,h,"glfw",NULL,NULL);
if (!window) { //Check Validity
glfwTerminate();
exit(EXIT_FAILURE);
}
glfwMakeContextCurrent(window); //Make Window Current Context
printf("hello window\n");
/*-----------------------------------------------------------------------------
* MAIN LOOP
*-----------------------------------------------------------------------------*/
while ( !glfwWindowShouldClose(window) ){
glViewport(0,0,w,h); //Set Viewport in pixels
glClearColor(1,0,0,1); //CLEAR WINDOW CONTENTS
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
//put drawing code in here
glfwSwapBuffers(window); //<-- SWAP BUFFERS
glfwPollEvents(); //<-- LISTEN FOR WINDOW EVENTS
}
//Destroy window and terminate glfw
glfwDestroyWindow(window);
glfwTerminate();
printf("goodbye window\n");
return 0;
}
1>------ 已启动生成: 项目: LearnOpenGL, 配置: Debug Win32 ------
1> main.cpp
1>main.obj : error LNK2019: 无法解析的外部符号 _glfwInit,该符号在函数 _main 中被引用
1>main.obj : error LNK2019: 无法解析的外部符号 _glfwTerminate,该符号在函数 _main 中被引用
1>main.obj : error LNK2019: 无法解析的外部符号 _glfwCreateWindow,该符号在函数 _main 中被引用
1>main.obj : error LNK2019: 无法解析的外部符号 _glfwDestroyWindow,该符号在函数 _main 中被引用
1>main.obj : error LNK2019: 无法解析的外部符号 _glfwWindowShouldClose,该符号在函数 _main 中被引用
1>main.obj : error LNK2019: 无法解析的外部符号 _glfwPollEvents,该符号在函数 _main 中被引用
1>main.obj : error LNK2019: 无法解析的外部符号 _glfwMakeContextCurrent,该符号在函数 _main 中被引用
1>main.obj : error LNK2019: 无法解析的外部符号 _glfwSwapBuffers,该符号在函数 _main 中被引用
1>D:\数据与文档\OpenGL\程序\LearnOpenGL\Debug\LearnOpenGL.exe : fatal error LNK1120: 8 个无法解析的外部命令
========== 生成: 成功 0 个,失败 1 个,最新 0 个,跳过 0 个 ==========
依旧是error2019问题,这个连接错误我在网上查了半天都没有一个解决的好办法,求群里的大神给看看

