Bitcoin Forum

Economy => Services => Topic started by: Anon136 on April 11, 2015, 02:20:17 PM



Title: Bounties for programming help
Post by: Anon136 on April 11, 2015, 02:20:17 PM
I created this thread because I am stuck on a linker library error but I thought rather than make it just about myself, maybe I could open it up to the whole community.

The way this thread works:

If you are in need of assistance, use the size=x-large and bold tag at the beginning of your post to specify how many bitcoins you are offering in exchange for a correct answer to your question/successful resolution to your problem. Next including a brief summary at the beginning of the post giving people some idea what sorts of languages or specific libraries it involves as well as the gist of the problem so that they may more easily determine, without needing to read your entire post, whether or not they possess the requisite skills necessary in order to be able to answer your question. Example:

Quote
0.01

Summary: Linker library error when attempting to use GLFW 64 bit windows binaries with "Microsoft visual studio community 2013"

Insert details here.

Please do not use the large text for anything else, that way new questions will stand out from the chatter even at a quick glance.

If you are answering someones question. Please provide a bitcoin address at the end of your post.

Obviously stackoverflow already exists so there is an expectation here that if someone is paying for resolution that the assistant will be a bit more patient and accommodating.


Title: Re: Bounties for programming help
Post by: Anon136 on April 11, 2015, 02:58:06 PM
0.01

Summary: Linker library error when attempting to use GLFW 64 bit windows binaries with "Microsoft visual studio community 2013"

I was following this tutorial. https://www.youtube.com/watch?v=j-55D2rsCSE @ 9:20 he gets the exact same errors I'm getting but then instead of explaining how to fix it he just cuts out the part where he solves it. He says "it was a quite simple error it was a linker library error". Well its not quite so simple for me, I've been trying to figure out what the heck to do for days now.

So I am using "Microsoft visual studio community 2013". I started a new visual c++ empty project. Added a main.cpp to the source files directory. I downloaded the 64 bit windows pre-compiled binaries from http://www.glfw.org/download.html. Extracted the whole folder intact to the same location where it is putting my main.cpp. My main.cpp looks like this.

Code:
#include "glfw-3.1.1.bin.WIN64\include\GLFW\glfw3.h"

int main(){
glfwInit();
}

Next I added
Code:
C:\Users\Aaron\Documents\Visual Studio 2013\Projects\Project5\Project5\glfw-3.1.1.bin.WIN64\include\GLFW
to
Code:
Property Page -> Configuration Properties -> VC++ Directories -> Include Directories
Then i added
Code:
C:\Users\Aaron\Documents\Visual Studio 2013\Projects\Project5\Project5\glfw-3.1.1.bin.WIN64\lib-vc2013
to
Code:
Property Page -> Configuration Properties -> VC++ Directories -> Library Directories
And finally I added
Code:
C:\Users\Aaron\Documents\Visual Studio 2013\Projects\Project5\Project5\glfw-3.1.1.bin.WIN64\lib-vc2013
to
Code:
Property Page -> Configuration Properties -> Linker -> General -> Additional Library Directories

Even still I am getting the following error when I attempt to build and run.

Code:
1>------ Build started: Project: Project5, Configuration: Debug Win32 ------
1>main.obj : error LNK2019: unresolved external symbol _glfwInit referenced in function _main
1>c:\users\aaron\documents\visual studio 2013\Projects\Project5\Debug\Project5.exe : fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


Title: Re: Bounties for programming help
Post by: MunchCrunch on April 11, 2015, 04:40:07 PM
I'm a bit of a novice at programming but I'll try.
Make sure your GLFW and VS targets match (32bit+32bit or 64bit+64bit)
So make sure your program is compiling for 64bit as you're using 64bit libraries.


Title: Re: Bounties for programming help
Post by: Anon136 on April 11, 2015, 09:17:30 PM
I'm a bit of a novice at programming but I'll try.
Make sure your GLFW and VS targets match (32bit+32bit or 64bit+64bit)
So make sure your program is compiling for 64bit as you're using 64bit libraries.

It is true that I was trying to build the application as 32bit while using glfw's 64 bit libraries (i think). So I went into project properties and at the top in the drop down menu "platform" i changed it from Win32 to x64 (which i think is what you were wanting me to do). Still getting the same error.

Code:
1>------ Build started: Project: Project5, Configuration: Debug x64 ------
1>main.obj : error LNK2019: unresolved external symbol glfwInit referenced in function main
1>c:\users\aaron\documents\visual studio 2013\Projects\Project5\x64\Debug\Project5.exe : fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


Title: Re: Bounties for programming help
Post by: MunchCrunch on April 11, 2015, 09:33:11 PM
I'm a bit of a novice at programming but I'll try.
Make sure your GLFW and VS targets match (32bit+32bit or 64bit+64bit)
So make sure your program is compiling for 64bit as you're using 64bit libraries.

It is true that I was trying to build the application as 32bit while using glfw's 64 bit libraries (i think). So I went into project properties and at the top in the drop down menu "platform" i changed it from Win32 to x64 (which i think is what you were wanting me to do). Still getting the same error.

Code:
1>------ Build started: Project: Project5, Configuration: Debug x64 ------
1>main.obj : error LNK2019: unresolved external symbol glfwInit referenced in function main
1>c:\users\aaron\documents\visual studio 2013\Projects\Project5\x64\Debug\Project5.exe : fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Ok, try this first.
Code:
#include "glfw3.h"

int main(){
glfwInit();
}

If that doesn't work then try this, just remember to change PATH:TO :)
Code:
#pragma comment(lib, "PATH:TO\glfw3.lib")

#include "glfw-3.1.1.bin.WIN64\include\GLFW\glfw3.h"

int main(){
glfwInit();
}


Title: Re: Bounties for programming help
Post by: Anon136 on April 11, 2015, 10:01:42 PM
This
Code:
#include "glfw3.h"

int main(){
glfwInit();
}
Did nothing.

However this
Code:
#pragma comment(lib, "C:/Users/Aaron/Documents/Visual Studio 2013/Projects/Project5/Project5/glfw-3.1.1.bin.WIN64/lib-vc2013/glfw3.lib")

#include "glfw-3.1.1.bin.WIN64\include\GLFW\glfw3.h"

int main() {
glfwInit();
}
definitely did something.

I had to switch from backslashes like this
Code:
#pragma comment(lib, "C:\Users\Aaron\Documents\Visual Studio 2013\Projects\Project5\Project5\glfw-3.1.1.bin.WIN64\lib-vc2013\glfw3.lib")

to forward slashes like this.
Code:
#pragma comment(lib, "C:/Users/Aaron/Documents/Visual Studio 2013/Projects/Project5/Project5/glfw-3.1.1.bin.WIN64/lib-vc2013/glfw3.lib")

inorder to resolve these errors.
Code:
1>------ Build started: Project: Project5, Configuration: Debug x64 ------
1>  main.cpp
1>main.cpp(1): warning C4129: 'A' : unrecognized character escape sequence
1>main.cpp(1): warning C4129: 'D' : unrecognized character escape sequence
1>main.cpp(1): warning C4129: 'V' : unrecognized character escape sequence
1>main.cpp(1): warning C4129: 'P' : unrecognized character escape sequence
1>main.cpp(1): warning C4129: 'g' : unrecognized character escape sequence
1>main.cpp(1): warning C4129: 'l' : unrecognized character escape sequence
1>LINK : fatal error LNK1104: cannot open file 'C:UsersAaronDocumentsVisual Studio 2013ProjectsProject5Project5glfw-3.1.1.bin.WIN64lib-vc2013glfw3.lib'
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

But after I switched from backslashes to forward slashes I got these errors.
Code:
1>------ Build started: Project: Project5, Configuration: Debug x64 ------
1>  main.cpp
1>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
1>glfw3.lib(window.c.obj) : error LNK2019: unresolved external symbol __imp_glClear referenced in function glfwCreateWindow
1>glfw3.lib(wgl_context.c.obj) : error LNK2019: unresolved external symbol __imp_wglCreateContext referenced in function _glfwCreateContext
1>glfw3.lib(wgl_context.c.obj) : error LNK2019: unresolved external symbol __imp_wglDeleteContext referenced in function _glfwDestroyContext
1>glfw3.lib(wgl_context.c.obj) : error LNK2019: unresolved external symbol __imp_wglGetProcAddress referenced in function _glfwPlatformGetProcAddress
1>glfw3.lib(wgl_context.c.obj) : error LNK2019: unresolved external symbol __imp_wglMakeCurrent referenced in function _glfwPlatformMakeContextCurrent
1>glfw3.lib(wgl_context.c.obj) : error LNK2019: unresolved external symbol __imp_wglShareLists referenced in function _glfwCreateContext
1>glfw3.lib(context.c.obj) : error LNK2019: unresolved external symbol __imp_glGetIntegerv referenced in function _glfwRefreshContextAttribs
1>glfw3.lib(context.c.obj) : error LNK2019: unresolved external symbol __imp_glGetString referenced in function glfwExtensionSupported
1>c:\users\aaron\documents\visual studio 2013\Projects\Project5\x64\Debug\Project5.exe : fatal error LNK1120: 8 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Not sure if that's progress but it could be :D


Title: Re: Bounties for programming help
Post by: MunchCrunch on April 11, 2015, 10:12:49 PM
This
Code:
#include "glfw3.h"

int main(){
glfwInit();
}
Did nothing.

However this
Code:
#pragma comment(lib, "C:/Users/Aaron/Documents/Visual Studio 2013/Projects/Project5/Project5/glfw-3.1.1.bin.WIN64/lib-vc2013/glfw3.lib")

#include "glfw-3.1.1.bin.WIN64\include\GLFW\glfw3.h"

int main() {
glfwInit();
}
definitely did something.

I had to switch from backslashes like this
Code:
#pragma comment(lib, "C:\Users\Aaron\Documents\Visual Studio 2013\Projects\Project5\Project5\glfw-3.1.1.bin.WIN64\lib-vc2013\glfw3.lib")

to forward slashes like this.
Code:
#pragma comment(lib, "C:/Users/Aaron/Documents/Visual Studio 2013/Projects/Project5/Project5/glfw-3.1.1.bin.WIN64/lib-vc2013/glfw3.lib")

inorder to resolve these errors.
Code:
1>------ Build started: Project: Project5, Configuration: Debug x64 ------
1>  main.cpp
1>main.cpp(1): warning C4129: 'A' : unrecognized character escape sequence
1>main.cpp(1): warning C4129: 'D' : unrecognized character escape sequence
1>main.cpp(1): warning C4129: 'V' : unrecognized character escape sequence
1>main.cpp(1): warning C4129: 'P' : unrecognized character escape sequence
1>main.cpp(1): warning C4129: 'g' : unrecognized character escape sequence
1>main.cpp(1): warning C4129: 'l' : unrecognized character escape sequence
1>LINK : fatal error LNK1104: cannot open file 'C:UsersAaronDocumentsVisual Studio 2013ProjectsProject5Project5glfw-3.1.1.bin.WIN64lib-vc2013glfw3.lib'
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

But after I switched from backslashes to forward slashes I got these errors.
Code:
1>------ Build started: Project: Project5, Configuration: Debug x64 ------
1>  main.cpp
1>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
1>glfw3.lib(window.c.obj) : error LNK2019: unresolved external symbol __imp_glClear referenced in function glfwCreateWindow
1>glfw3.lib(wgl_context.c.obj) : error LNK2019: unresolved external symbol __imp_wglCreateContext referenced in function _glfwCreateContext
1>glfw3.lib(wgl_context.c.obj) : error LNK2019: unresolved external symbol __imp_wglDeleteContext referenced in function _glfwDestroyContext
1>glfw3.lib(wgl_context.c.obj) : error LNK2019: unresolved external symbol __imp_wglGetProcAddress referenced in function _glfwPlatformGetProcAddress
1>glfw3.lib(wgl_context.c.obj) : error LNK2019: unresolved external symbol __imp_wglMakeCurrent referenced in function _glfwPlatformMakeContextCurrent
1>glfw3.lib(wgl_context.c.obj) : error LNK2019: unresolved external symbol __imp_wglShareLists referenced in function _glfwCreateContext
1>glfw3.lib(context.c.obj) : error LNK2019: unresolved external symbol __imp_glGetIntegerv referenced in function _glfwRefreshContextAttribs
1>glfw3.lib(context.c.obj) : error LNK2019: unresolved external symbol __imp_glGetString referenced in function glfwExtensionSupported
1>c:\users\aaron\documents\visual studio 2013\Projects\Project5\x64\Debug\Project5.exe : fatal error LNK1120: 8 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Not sure if that's progress but it could be :D
Well the warning is about conflicting libraries so just remove all the libraries that you added earlier in the thread :)
Just to confirm, you do have a 64bit operating system?

===================
Try changing
Code:
#include "glfw3.h"
to
Code:
#include <GLFW/glfw3.h>


Title: Re: Bounties for programming help
Post by: Anon136 on April 12, 2015, 02:11:30 AM
yes i have a 64 bit os.

removing all the libraries i added earlier didn't seem to help  :(. i tried all possible combinations of the three. no difference :(.'

no matter whether we get it figured out or not i just wanted to say thanks for all the help.


Title: Re: Bounties for programming help
Post by: MunchCrunch on April 12, 2015, 07:45:53 AM
yes i have a 64 bit os.

removing all the libraries i added earlier didn't seem to help  :(. i tried all possible combinations of the three. no difference :(.'

no matter whether we get it figured out or not i just wanted to say thanks for all the help.
:) Thanks


Title: Re: Bounties for programming help
Post by: fsb4000 on April 12, 2015, 12:17:05 PM
My btc address: 1LqXE9xzjLS3HcoRe6AvxAw9zhMimDWCjP

1. First, check what you're doing 64 bit app(because you use 64 bit libs)
https://i.imgur.com/j946RVc.jpg
2. Additional include directories
https://i.imgur.com/6GpVszr.jpg
3. Linked options
add additional dependecies
Code:
opengl32.lib
glfw3dll.lib
add additional directories
<path to file glfw3dll.lib>
https://i.imgur.com/mlRSFN2.png
4. copy glfw3.dll to a folder with project1.exe
5. run

you're welcome and good luck  ;)
https://i.imgur.com/OS2afeV.png


Title: Re: Bounties for programming help
Post by: Anon136 on April 12, 2015, 02:10:46 PM
My btc address: 1LqXE9xzjLS3HcoRe6AvxAw9zhMimDWCjP

1. First, check what you're doing 64 bit app(because you use 64 bit libs)

2. Additional include directories

3. Linked options
add additional dependecies
Code:
opengl32.lib
glfw3dll.lib
add additional directories
<path to file glfw3dll.lib>

4. copy glfw3.dll to a folder with project1.exe

5. run

you're welcome and good luck  ;)

I tried all of those different things at one point or another but i guess it just never came to-gather right. I still don't know how you figured all that out so idk if ill be back in the same position next time i want to use a different non-standard library, but hopefully given what i learned here today i'll be able to figure it out myself next time. Anyway thank-you so much.


Title: Re: Bounties for programming help
Post by: fsb4000 on April 12, 2015, 02:24:28 PM
I tried all of those different things at one point or another but i guess it just never came to-gather right. I still don't know how you figured all that out so idk if ill be back in the same position next time i want to use a different non-standard library, but hopefully given what i learned here today i'll be able to figure it out myself next time. Anyway thank-you so much.
I just googled  :D
1) Keyword: unresolved external symbol glfwInit
2) first link: http://stackoverflow.com/questions/12970014/lnk2019-unresolved-external-symbol-glfwinit-referenced-in-function-main
3) first answer has link http://www.opengl-tutorial.org/miscellaneous/building-your-own-c-application/
4) go to link with library: http://www.opengl-tutorial.org/miscellaneous/building-your-own-c-application/#Link_with_a_library
5) Here I found that we need add "opengl32.lib"

The remaining steps are more or less standard, I see what you did them.


Title: Re: Bounties for programming help
Post by: Anon136 on April 12, 2015, 02:40:49 PM
I tried all of those different things at one point or another but i guess it just never came to-gather right. I still don't know how you figured all that out so idk if ill be back in the same position next time i want to use a different non-standard library, but hopefully given what i learned here today i'll be able to figure it out myself next time. Anyway thank-you so much.
I just googled  :D
1) Keyword: unresolved external symbol glfwInit
2) first link: http://stackoverflow.com/questions/12970014/lnk2019-unresolved-external-symbol-glfwinit-referenced-in-function-main
3) first answer has link http://www.opengl-tutorial.org/miscellaneous/building-your-own-c-application/
4) go to link with library: http://www.opengl-tutorial.org/miscellaneous/building-your-own-c-application/#Link_with_a_library
5) Here I found that we need add "opengl32.lib"

The remaining steps are more or less standard, I see what you did them.

I must have done at-least 3 dozen google searches. I don't know how I somehow never manage to search the right thing. Oh well. I shall remain forever cursed.