Linking local installation of GLFW [duplicate]












0
















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'









share|improve this question













marked as duplicate by πάντα ῥεῖ c++
Users with the  c++ badge can single-handedly close c++ questions as duplicates and reopen them as needed.

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.























    0
















    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'









    share|improve this question













    marked as duplicate by πάντα ῥεῖ c++
    Users with the  c++ badge can single-handedly close c++ questions as duplicates and reopen them as needed.

    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.





















      0












      0








      0









      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'









      share|improve this question















      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






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 24 '18 at 21:06









      MakoganMakogan

      1,8061829




      1,8061829




      marked as duplicate by πάντα ῥεῖ c++
      Users with the  c++ badge can single-handedly close c++ questions as duplicates and reopen them as needed.

      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 πάντα ῥεῖ c++
      Users with the  c++ badge can single-handedly close c++ questions as duplicates and reopen them as needed.

      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.


























          1 Answer
          1






          active

          oldest

          votes


















          1














          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






          share|improve this answer





















          • 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 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          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






          share|improve this answer





















          • 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














          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






          share|improve this answer





















          • 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








          1







          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






          share|improve this answer















          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







          share|improve this answer














          share|improve this answer



          share|improve this answer








          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














          • 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





          Popular posts from this blog

          Costa Masnaga

          Fotorealismo

          Sidney Franklin