PDA

View Full Version : Errors in c++ and OpenGL window code



FlamingBurrito15
01-31-2018, 03:03 PM
Hello I am using a code from www.opengl-tutorial.org/beginners-tutorials/tutorial-1-opening-a-window/ and when I build this code I get 15 errors and have no idea on how to fix this... Any ideas?

Errors:


dummy.obj : error LNK2005: main already defined in main.obj [C:\Users\flami\source\repos\Windows2.0\Windows2.0\ Windows2
.0.vcxproj]
main.obj : error LNK2019: unresolved external symbol __imp_glClear referenced in function main [C:\Users\flami\source\r
epos\Windows2.0\Windows2.0\Windows2.0.vcxproj]
main.obj : error LNK2019: unresolved external symbol __imp_glClearColor referenced in function main [C:\Users\flami\sou
rce\repos\Windows2.0\Windows2.0\Windows2.0.vcxproj]
main.obj : error LNK2019: unresolved external symbol __imp_glewInit referenced in function main [C:\Users\flami\source\
repos\Windows2.0\Windows2.0\Windows2.0.vcxproj]
main.obj : error LNK2019: unresolved external symbol __imp_glfwInit referenced in function main [C:\Users\flami\source\
repos\Windows2.0\Windows2.0\Windows2.0.vcxproj]
main.obj : error LNK2019: unresolved external symbol __imp_glfwTerminate referenced in function main [C:\Users\flami\so
urce\repos\Windows2.0\Windows2.0\Windows2.0.vcxpro j]
main.obj : error LNK2019: unresolved external symbol __imp_glfwWindowHint referenced in function main [C:\Users\flami\s
ource\repos\Windows2.0\Windows2.0\Windows2.0.vcxpr oj]
main.obj : error LNK2019: unresolved external symbol __imp_glfwCreateWindow referenced in function main [C:\Users\flami
\source\repos\Windows2.0\Windows2.0\Windows2.0.vcx proj]
main.obj : error LNK2019: unresolved external symbol __imp_glfwWindowShouldClose referenced in function main [C:\Users\
flami\source\repos\Windows2.0\Windows2.0\Windows2. 0.vcxproj]
main.obj : error LNK2019: unresolved external symbol __imp_glfwPollEvents referenced in function main [C:\Users\flami\s ource\repos\Windows2.0\Windows2.0\Windows2.0.vcxpr oj]
main.obj : error LNK2019: unresolved external symbol __imp_glfwSetInputMode referenced in function main [C:\Users\flami
\source\repos\Windows2.0\Windows2.0\Windows2.0.vcx proj]
main.obj : error LNK2019: unresolved external symbol __imp_glfwGetKey referenced in function main [C:\Users\flami\sourc
e\repos\Windows2.0\Windows2.0\Windows2.0.vcxproj]
main.obj : error LNK2019: unresolved external symbol __imp_glfwMakeContextCurrent referenced in function main [C:\Users
\flami\source\repos\Windows2.0\Windows2.0\Windows2 .0.vcxproj]
main.obj : error LNK2019: unresolved external symbol __imp_glfwSwapBuffers referenced in function main [C:\Users\flami\
source\repos\Windows2.0\Windows2.0\Windows2.0.vcxp roj]
C:\Users\flami\source\repos\Windows2.0\x64\Debug\W indows2.0.exe : fatal error LNK1120: 13 unresolved externals [C:\User
s\flami\source\repos\Windows2.0\Windows2.0\Windows 2.0.vcxproj]

Dark Photon
01-31-2018, 08:35 PM
Here's a possible tip:


Errors when compiling - D Programming Language (https://forum.dlang.org/thread/fzkgtljwhelfbkmtyeks@forum.dlang.org#post-grppwekjaisczvfayarb:40forum.dlang.org)
(https://forum.dlang.org/thread/fzkgtljwhelfbkmtyeks@forum.dlang.org#post-grppwekjaisczvfayarb:40forum.dlang.org)

(https://forum.dlang.org/thread/fzkgtljwhelfbkmtyeks@forum.dlang.org#post-grppwekjaisczvfayarb:40forum.dlang.org)Check out the libs you're linking with and make sure they're all the same architecture, and make sure you're linking to libs for GLFW, GLEW, and OpenGL.

FlamingBurrito15
02-01-2018, 03:30 PM
So I tried the path of the lib and the lib itself (glew.lib and glfw3.lib because those are the only ones that I have) and with the path it gives me the same errors and without the path it just says could not find glew.lib/glfw3.lib...