Click here to Skip to main content
15,851,335 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
my head files are as followed:
C++
#include "stdafx.h"

#include <gl\glew-2.0.0-x86\include\GL\glew.h>
#include <gl\glut.h>
#include <gl\glfw_app.hpp>
#include <gl\gl_shader.hpp>
#include <gl\gl_macros.hpp>
#define GLM_FORCE_RADIANS
#include <gl\glm\glm.hpp>
#include <gl\glm\gtc\matrix_transform.hpp>
#include <gl\glm\gtc\type_ptr.hpp>

#include <vector>

using namespace lynda;
using namespace std;


And the errors:
C#
Severity	Code	Description	Project	File	Line
Warning	C4800	'int': forcing value to bool 'true' or 'false' (performance warning)	OpenGL_2	h:\visual studio\vc\include\gl\glfw_window.hpp	106
Error	LNK1120	42 unresolved externals	OpenGL_2	C:\Users\Sar.Kerson\Desktop\OpenGL_2\Debug\OpenGL_2.exe	1
Warning	LNK4272	library machine type 'x64' conflicts with target machine type 'X86'	OpenGL_2	H:\opencv\opencv\build\x64\vc14\lib\opencv_world310.lib	1
Warning	LNK4272	library machine type 'x64' conflicts with target machine type 'X86'	OpenGL_2	H:\opencv\opencv\build\x64\vc14\lib\opencv_world310d.lib	1
Error	LNK2019	unresolved external symbol _glfwCreateWindow referenced in function "public: void __thiscall lynda::Window::create<struct lynda::App>(struct lynda::App *,int,int,char const *)" (??$create@UApp@lynda@@@Window@lynda@@QAEXPAUApp@1@HHPBD@Z)	OpenGL_2	C:\Users\Sar.Kerson\Desktop\OpenGL_2\OpenGL_2\OpenGL_2.obj	1
Error	LNK2019	unresolved external symbol _glfwDestroyWindow referenced in function "public: void __thiscall lynda::Window::destroy(void)" (?destroy@Window@lynda@@QAEXXZ)	OpenGL_2	C:\Users\Sar.Kerson\Desktop\OpenGL_2\OpenGL_2\OpenGL_2.obj	1
Error	LNK2019	unresolved external symbol _glfwGetFramebufferSize referenced in function "public: void __thiscall lynda::Window::setViewport(void)" (?setViewport@Window@lynda@@QAEXXZ)	OpenGL_2	C:\Users\Sar.Kerson\Desktop\OpenGL_2\OpenGL_2\OpenGL_2.obj	1
Error	LNK2019	unresolved external symbol _glfwInit referenced in function "public: __thiscall lynda::App::App(int,int)" (??0App@lynda@@QAE@HH@Z)	OpenGL_2	C:\Users\Sar.Kerson\Desktop\OpenGL_2\OpenGL_2\OpenGL_2.obj	1
Error	LNK2019	unresolved external symbol _glfwMakeContextCurrent referenced in function "public: void __thiscall lynda::Window::create<struct lynda::App>(struct lynda::App *,int,int,char const *)" (??$create@UApp@lynda@@@Window@lynda@@QAEXPAUApp@1@HHPBD@Z)	OpenGL_2	C:\Users\Sar.Kerson\Desktop\OpenGL_2\OpenGL_2\OpenGL_2.obj	1
Error	LNK2019	unresolved external symbol _glfwPollEvents referenced in function "public: void __thiscall lynda::App::start(void)" (?start@App@lynda@@QAEXXZ)	OpenGL_2	C:\Users\Sar.Kerson\Desktop\OpenGL_2\OpenGL_2\OpenGL_2.obj	1
Error	LNK2019	unresolved external symbol _glfwSetCursorPosCallback referenced in function "public: void __thiscall lynda::Window::create<struct lynda::App>(struct lynda::App *,int,int,char const *)" (??$create@UApp@lynda@@@Window@lynda@@QAEXPAUApp@1@HHPBD@Z)	OpenGL_2	C:\Users\Sar.Kerson\Desktop\OpenGL_2\OpenGL_2\OpenGL_2.obj	1
Error	LNK2019	unresolved external symbol _glfwSetKeyCallback referenced in function "public: void __thiscall lynda::Window::create<struct lynda::App>(struct lynda::App *,int,int,char const *)" (??$create@UApp@lynda@@@Window@lynda@@QAEXPAUApp@1@HHPBD@Z)	OpenGL_2	C:\Users\Sar.Kerson\Desktop\OpenGL_2\OpenGL_2\OpenGL_2.obj	1
Error	LNK2019	unresolved external symbol _glfwSetMouseButtonCallback referenced in function "public: void __thiscall lynda::Window::create<struct lynda::App>(struct lynda::App *,int,int,char const *)" (??$create@UApp@lynda@@@Window@lynda@@QAEXPAUApp@1@HHPBD@Z)	OpenGL_2	C:\Users\Sar.Kerson\Desktop\OpenGL_2\OpenGL_2\OpenGL_2.obj	1
Error	LNK2019	unresolved external symbol _glfwSwapBuffers referenced in function "public: void __thiscall lynda::Window::swapBuffers(void)" (?swapBuffers@Window@lynda@@QAEXXZ)	OpenGL_2	C:\Users\Sar.Kerson\Desktop\OpenGL_2\OpenGL_2\OpenGL_2.obj	1
Error	LNK2019	unresolved external symbol _glfwSwapInterval referenced in function "public: void __thiscall lynda::Window::create<struct lynda::App>(struct lynda::App *,int,int,char const *)" (??$create@UApp@lynda@@@Window@lynda@@QAEXPAUApp@1@HHPBD@Z)	OpenGL_2	C:\Users\Sar.Kerson\Desktop\OpenGL_2\OpenGL_2\OpenGL_2.obj	1
Error	LNK2019	unresolved external symbol _glfwTerminate referenced in function "public: void __thiscall lynda::Window::create<struct lynda::App>(struct lynda::App *,int,int,char const *)" (??$create@UApp@lynda@@@Window@lynda@@QAEXPAUApp@1@HHPBD@Z)	OpenGL_2	C:\Users\Sar.Kerson\Desktop\OpenGL_2\OpenGL_2\OpenGL_2.obj	1
Error	LNK2019	unresolved external symbol _glfwWindowShouldClose referenced in function "public: bool __thiscall lynda::Window::shouldClose(void)" (?shouldClose@Window@lynda@@QAE_NXZ)	OpenGL_2	C:\Users\Sar.Kerson\Desktop\OpenGL_2\OpenGL_2\OpenGL_2.obj	1
Error	LNK2001	unresolved external symbol __imp__glewExperimental	OpenGL_2	C:\Users\Sar.Kerson\Desktop\OpenGL_2\OpenGL_2\OpenGL_2.obj	1
Error	LNK2019	unresolved external symbol __imp__glewGetErrorString@4 referenced in function "public: __thiscall lynda::App::App(int,int)" (??0App@lynda@@QAE@HH@Z)	OpenGL_2	C:\Users\Sar.Kerson\Desktop\OpenGL_2\OpenGL_2\OpenGL_2.obj	1
Error	LNK2019	unresolved external symbol __imp__glewInit@0 referenced in function "public: __thiscall lynda::App::App(int,int)" (??0App@lynda@@QAE@HH@Z)	OpenGL_2	C:\Users\Sar.Kerson\Desktop\OpenGL_2\OpenGL_2\OpenGL_2.obj	1
Error	LNK2001	unresolved external symbol __imp____glewAttachShader	OpenGL_2	C:\Users\Sar.Kerson\Desktop\OpenGL_2\OpenGL_2\OpenGL_2.obj	1
Error	LNK2001	unresolved external symbol __imp____glewBindBuffer	OpenGL_2	C:\Users\Sar.Kerson\Desktop\OpenGL_2\OpenGL_2\OpenGL_2.obj	1
Error	LNK2001	unresolved external symbol __imp____glewBindVertexArray	OpenGL_2	C:\Users\Sar.Kerson\Desktop\OpenGL_2\OpenGL_2\OpenGL_2.obj	1
Error	LNK2001	unresolved external symbol __imp____glewBindVertexArrayAPPLE	OpenGL_2	C:\Users\Sar.Kerson\Desktop\OpenGL_2\OpenGL_2\OpenGL_2.obj	1
Error	LNK2001	unresolved external symbol __imp____glewBufferData	OpenGL_2	C:\Users\Sar.Kerson\Desktop\OpenGL_2\OpenGL_2\OpenGL_2.obj	1
Error	LNK2001	unresolved external symbol __imp____glewCompileShader	OpenGL_2	C:\Users\Sar.Kerson\Desktop\OpenGL_2\OpenGL_2\OpenGL_2.obj	1
Error	LNK2001	unresolved external symbol __imp____glewCreateProgram	OpenGL_2	C:\Users\Sar.Kerson\Desktop\OpenGL_2\OpenGL_2\OpenGL_2.obj	1
Error	LNK2001	unresolved external symbol __imp____glewCreateShader	OpenGL_2	C:\Users\Sar.Kerson\Desktop\OpenGL_2\OpenGL_2\OpenGL_2.obj	1
Error	LNK2001	unresolved external symbol __imp____glewEnableVertexAttribArray	OpenGL_2	C:\Users\Sar.Kerson\Desktop\OpenGL_2\OpenGL_2\OpenGL_2.obj	1
Error	LNK2001	unresolved external symbol __imp____glewGenBuffers	OpenGL_2	C:\Users\Sar.Kerson\Desktop\OpenGL_2\OpenGL_2\OpenGL_2.obj	1
Error	LNK2001	unresolved external symbol __imp____glewGenVertexArrays	OpenGL_2	C:\Users\Sar.Kerson\Desktop\OpenGL_2\OpenGL_2\OpenGL_2.obj	1
Error	LNK2001	unresolved external symbol __imp____glewGenVertexArraysAPPLE	OpenGL_2	C:\Users\Sar.Kerson\Desktop\OpenGL_2\OpenGL_2\OpenGL_2.obj	1
Error	LNK2001	unresolved external symbol __imp____glewGetAttribLocation	OpenGL_2	C:\Users\Sar.Kerson\Desktop\OpenGL_2\OpenGL_2\OpenGL_2.obj	1
Error	LNK2001	unresolved external symbol __imp____glewGetProgramInfoLog	OpenGL_2	C:\Users\Sar.Kerson\Desktop\OpenGL_2\OpenGL_2\OpenGL_2.obj	1
Error	LNK2001	unresolved external symbol __imp____glewGetProgramiv	OpenGL_2	C:\Users\Sar.Kerson\Desktop\OpenGL_2\OpenGL_2\OpenGL_2.obj	1
Error	LNK2001	unresolved external symbol __imp____glewGetShaderInfoLog	OpenGL_2	C:\Users\Sar.Kerson\Desktop\OpenGL_2\OpenGL_2\OpenGL_2.obj	1
Error	LNK2001	unresolved external symbol __imp____glewGetShaderiv	OpenGL_2	C:\Users\Sar.Kerson\Desktop\OpenGL_2\OpenGL_2\OpenGL_2.obj	1
Error	LNK2001	unresolved external symbol __imp____glewGetUniformLocation	OpenGL_2	C:\Users\Sar.Kerson\Desktop\OpenGL_2\OpenGL_2\OpenGL_2.obj	1
Error	LNK2001	unresolved external symbol __imp____glewLinkProgram	OpenGL_2	C:\Users\Sar.Kerson\Desktop\OpenGL_2\OpenGL_2\OpenGL_2.obj	1
Error	LNK2001	unresolved external symbol __imp____glewShaderSource	OpenGL_2	C:\Users\Sar.Kerson\Desktop\OpenGL_2\OpenGL_2\OpenGL_2.obj	1
Error	LNK2001	unresolved external symbol __imp____glewUniformMatrix4fv	OpenGL_2	C:\Users\Sar.Kerson\Desktop\OpenGL_2\OpenGL_2\OpenGL_2.obj	1
Error	LNK2001	unresolved external symbol __imp____glewUseProgram	OpenGL_2	C:\Users\Sar.Kerson\Desktop\OpenGL_2\OpenGL_2\OpenGL_2.obj	1
Error	LNK2001	unresolved external symbol __imp____glewValidateProgram	OpenGL_2	C:\Users\Sar.Kerson\Desktop\OpenGL_2\OpenGL_2\OpenGL_2.obj	1
Error	LNK2001	unresolved external symbol __imp____glewVertexAttribPointer	OpenGL_2	C:\Users\Sar.Kerson\Desktop\OpenGL_2\OpenGL_2\OpenGL_2.obj	1
Error	LNK2001	unresolved external symbol __imp____GLEW_APPLE_vertex_array_object	OpenGL_2	C:\Users\Sar.Kerson\Desktop\OpenGL_2\OpenGL_2\OpenGL_2.obj	1
Error	LNK2001	unresolved external symbol __imp____GLEW_ARB_vertex_array_object	OpenGL_2	C:\Users\Sar.Kerson\Desktop\OpenGL_2\OpenGL_2\OpenGL_2.obj	1


What I have tried:

I've changed the order of my head files but it seemed did no contribution.
How can it make it?
Posted
Updated 19-Dec-16 4:09am

1 solution

Warning	LNK4272	library machine type 'x64' conflicts with target machine type 'X86'	OpenGL_2	H:\opencv\opencv\build\x64\vc14\lib\opencv_world310.lib	1
Warning	LNK4272	library machine type 'x64' conflicts with target machine type 'X86'	OpenGL_2	H:\opencv\opencv\build\x64\vc14\lib\opencv_world310d.lib	1
You are linking a 64-bit library to a 32-bit application. You are also linking against the release and the debug version of the same library.

So open your project settings and change the setting where you specified the library.

Use
H:\opencv\opencv\build\x64\vc14\lib\opencv_world310d.lib
for debug builds and
H:\opencv\opencv\build\x64\vc14\lib\opencv_world310.lib
for release builds.

Finally change your CPU type to x64 (or change the above pathes to use the 32-bit versions of the libraries).
 
Share this answer
 
Comments
Sar Kerson 19-Dec-16 9:56am    
Thank you very much. I've tried according your advice and solved this problem.
But the OpenGL problems still remained there.Can you tell me how to solve that?
Jochen Arndt 19-Dec-16 10:04am    
Which problems? The unresolved externals?

I'm not so firm with OpenGL but are you sure that the functions are located in the opencv_world library?
Isn't it something like glfw3.lib?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900