Linking local installation of GLFW [duplicate]
This question already has an answer here:
What is an undefined reference/unresolved external symbol error and how do I fix it?
32 answers
I want to link against a project installed, rather than OS installed, version of GLFW to make my project more portable. I am trying to use both premake and gcc directly but they both fail.
The glfw directory is in project/libraries/glfw-3.2.1
I tried to build glfw by doing:
cd project/libraries/glfw-3.2.1
mkdir bin
cd bin
cmake ..
make all
however I do not see any binary on that directory although I did find the file libglfw3.a
So I tried to build it manually as follows:
g++ main.cpp -I libraries/glfw-3.2.1/include/ -L libraries/glfw-3.2.1/bin/src/libglfw3.a
However that fails to link as none of the glfw objects are found. i.e
I get errors like:
/usr/bin/ld: main.cpp:(.text+0x27): undefined reference to `glfwWindowHint'
c++ compilation linker glfw premake
marked as duplicate by πάντα ῥεῖ
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 24 '18 at 21:14
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
This question already has an answer here:
What is an undefined reference/unresolved external symbol error and how do I fix it?
32 answers
I want to link against a project installed, rather than OS installed, version of GLFW to make my project more portable. I am trying to use both premake and gcc directly but they both fail.
The glfw directory is in project/libraries/glfw-3.2.1
I tried to build glfw by doing:
cd project/libraries/glfw-3.2.1
mkdir bin
cd bin
cmake ..
make all
however I do not see any binary on that directory although I did find the file libglfw3.a
So I tried to build it manually as follows:
g++ main.cpp -I libraries/glfw-3.2.1/include/ -L libraries/glfw-3.2.1/bin/src/libglfw3.a
However that fails to link as none of the glfw objects are found. i.e
I get errors like:
/usr/bin/ld: main.cpp:(.text+0x27): undefined reference to `glfwWindowHint'
c++ compilation linker glfw premake
marked as duplicate by πάντα ῥεῖ
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 24 '18 at 21:14
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
This question already has an answer here:
What is an undefined reference/unresolved external symbol error and how do I fix it?
32 answers
I want to link against a project installed, rather than OS installed, version of GLFW to make my project more portable. I am trying to use both premake and gcc directly but they both fail.
The glfw directory is in project/libraries/glfw-3.2.1
I tried to build glfw by doing:
cd project/libraries/glfw-3.2.1
mkdir bin
cd bin
cmake ..
make all
however I do not see any binary on that directory although I did find the file libglfw3.a
So I tried to build it manually as follows:
g++ main.cpp -I libraries/glfw-3.2.1/include/ -L libraries/glfw-3.2.1/bin/src/libglfw3.a
However that fails to link as none of the glfw objects are found. i.e
I get errors like:
/usr/bin/ld: main.cpp:(.text+0x27): undefined reference to `glfwWindowHint'
c++ compilation linker glfw premake
This question already has an answer here:
What is an undefined reference/unresolved external symbol error and how do I fix it?
32 answers
I want to link against a project installed, rather than OS installed, version of GLFW to make my project more portable. I am trying to use both premake and gcc directly but they both fail.
The glfw directory is in project/libraries/glfw-3.2.1
I tried to build glfw by doing:
cd project/libraries/glfw-3.2.1
mkdir bin
cd bin
cmake ..
make all
however I do not see any binary on that directory although I did find the file libglfw3.a
So I tried to build it manually as follows:
g++ main.cpp -I libraries/glfw-3.2.1/include/ -L libraries/glfw-3.2.1/bin/src/libglfw3.a
However that fails to link as none of the glfw objects are found. i.e
I get errors like:
/usr/bin/ld: main.cpp:(.text+0x27): undefined reference to `glfwWindowHint'
This question already has an answer here:
What is an undefined reference/unresolved external symbol error and how do I fix it?
32 answers
c++ compilation linker glfw premake
c++ compilation linker glfw premake
asked Nov 24 '18 at 21:06
MakoganMakogan
1,8061829
1,8061829
marked as duplicate by πάντα ῥεῖ
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 24 '18 at 21:14
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by πάντα ῥεῖ
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 24 '18 at 21:14
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
try this
g++ main.cpp -I libraries/glfw-3.2.1/include -L libraries/glfw-3.2.1/bin/src -lglfw3
Using -L
you are telling the compiler where the library lies but you should use -l to link it
1
Almost correct, it seems it should be glfw and not glfw3 for the -l, thanks a lot
– Makogan
Nov 24 '18 at 21:19
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
try this
g++ main.cpp -I libraries/glfw-3.2.1/include -L libraries/glfw-3.2.1/bin/src -lglfw3
Using -L
you are telling the compiler where the library lies but you should use -l to link it
1
Almost correct, it seems it should be glfw and not glfw3 for the -l, thanks a lot
– Makogan
Nov 24 '18 at 21:19
add a comment |
try this
g++ main.cpp -I libraries/glfw-3.2.1/include -L libraries/glfw-3.2.1/bin/src -lglfw3
Using -L
you are telling the compiler where the library lies but you should use -l to link it
1
Almost correct, it seems it should be glfw and not glfw3 for the -l, thanks a lot
– Makogan
Nov 24 '18 at 21:19
add a comment |
try this
g++ main.cpp -I libraries/glfw-3.2.1/include -L libraries/glfw-3.2.1/bin/src -lglfw3
Using -L
you are telling the compiler where the library lies but you should use -l to link it
try this
g++ main.cpp -I libraries/glfw-3.2.1/include -L libraries/glfw-3.2.1/bin/src -lglfw3
Using -L
you are telling the compiler where the library lies but you should use -l to link it
edited Nov 24 '18 at 21:19
πάντα ῥεῖ
73.4k1076143
73.4k1076143
answered Nov 24 '18 at 21:12
Mateusz StompórMateusz Stompór
8115
8115
1
Almost correct, it seems it should be glfw and not glfw3 for the -l, thanks a lot
– Makogan
Nov 24 '18 at 21:19
add a comment |
1
Almost correct, it seems it should be glfw and not glfw3 for the -l, thanks a lot
– Makogan
Nov 24 '18 at 21:19
1
1
Almost correct, it seems it should be glfw and not glfw3 for the -l, thanks a lot
– Makogan
Nov 24 '18 at 21:19
Almost correct, it seems it should be glfw and not glfw3 for the -l, thanks a lot
– Makogan
Nov 24 '18 at 21:19
add a comment |