My code will not build, i dont know what to try to fix it. im trying to use c++ and openGL to make a window. i dont have much info and dont know much but... the build output looks like this:
Build started...
1>------ Build started: Project: OpenGLtutorial2, Configuration: Debug x64 ------
1>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
1>Main.obj : error LNK2019: unresolved external symbol gladLoadGLLoader referenced in function main
1>Main.obj : error LNK2001: unresolved external symbol glad_glViewport
1>C:\Users\HP\source\repos\OpenGLtutorial2\x64\Debug\OpenGLtutorial2.exe : fatal error LNK1120: 2 unresolved externals
1>Done building project "OpenGLtutorial2.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
im not good with programming but i think the build is confusing but here is my code:
#include <iostream>
#include <glad/glad.h>
#include <GLFW/glfw3.h>
void framebuffer_size_callback(GLFWwindow* window, int width, int height);
int main() {
std::cout << "Hello World!" << std::endl;
glfwInit();
// openGL version 3.3
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
# ifdef __APPLE__
glfwWindowHint(GLFW_OPENGL_FOWARD_COPMPAT, GL_TRUE);
# endif
GLFWwindow* window = glfwCreateWindow(800, 600, "OpenGL test", NULL, NULL);
if (window == NULL) { // window not created
std::cout << "Could not create window." << std::endl;
glfwTerminate();
return -1;
}
glfwMakeContextCurrent(window);
if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress)) {
std::cout << "Failed to initialize GLAD" << std::endl;
glfwTerminate();
return -1;
}
glViewport(0, 0, 800, 600);
glfwSetFramebufferSizeCallback(window, framebuffer_size_callback);
while (!glfwWindowShouldClose(window)) {
// send new frame to window
glfwSwapBuffers(window);
glfwPollEvents();
}
glfwTerminate();
return 0;
}
void framebuffer_size_callback(GLFWwindow* window, int width, int height) {
glViewport(0, 0, width, height);
}
it doesent give me errors but does not build.