Problems importing libraries to my c++ project, how to fix this?












7















I'm using the <XZY> IDE to compile my program, and have some trouble to import/integrate a specific library with it.



I get error messages like



fatal error: 3rdPartyLib.h: No such file or directory


for a



#include "3rdPartyLib.h"


statement



ld.exe: cannot find `lib3rdParty.a`


for specifying



3rdParty


in the additional libraries



At least I got some error message like



undefined reference to `lib3rdParty::foo()'


What can I do to fix this?










share|improve this question





























    7















    I'm using the <XZY> IDE to compile my program, and have some trouble to import/integrate a specific library with it.



    I get error messages like



    fatal error: 3rdPartyLib.h: No such file or directory


    for a



    #include "3rdPartyLib.h"


    statement



    ld.exe: cannot find `lib3rdParty.a`


    for specifying



    3rdParty


    in the additional libraries



    At least I got some error message like



    undefined reference to `lib3rdParty::foo()'


    What can I do to fix this?










    share|improve this question



























      7












      7








      7


      2






      I'm using the <XZY> IDE to compile my program, and have some trouble to import/integrate a specific library with it.



      I get error messages like



      fatal error: 3rdPartyLib.h: No such file or directory


      for a



      #include "3rdPartyLib.h"


      statement



      ld.exe: cannot find `lib3rdParty.a`


      for specifying



      3rdParty


      in the additional libraries



      At least I got some error message like



      undefined reference to `lib3rdParty::foo()'


      What can I do to fix this?










      share|improve this question
















      I'm using the <XZY> IDE to compile my program, and have some trouble to import/integrate a specific library with it.



      I get error messages like



      fatal error: 3rdPartyLib.h: No such file or directory


      for a



      #include "3rdPartyLib.h"


      statement



      ld.exe: cannot find `lib3rdParty.a`


      for specifying



      3rdParty


      in the additional libraries



      At least I got some error message like



      undefined reference to `lib3rdParty::foo()'


      What can I do to fix this?







      c++ ide






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jul 12 '14 at 20:40







      πάντα ῥεῖ

















      asked Jul 12 '14 at 18:06









      πάντα ῥεῖπάντα ῥεῖ

      73.1k976141




      73.1k976141
























          2 Answers
          2






          active

          oldest

          votes


















          9














          It's a common misconception, that the current IDE used, is responsible for getting errors like stated in the question.

          See for example




          • c++ lib in two same project ,one can work but the other can 't

          • Issue linking libxml++ and glib libraries with CodeBlocks IDE for C++ Windows

          • ...


          The problem is almost never related to the currently used IDE.

          In the most cases the solution boils down, to supply the actual toolchain's compiler/linker with the appropriate path's to search for included headers, to be linked libraries.



          One of the major applicable answers for the linker related problems are






          • What is an undefined reference/unresolved external symbol error and how do I fix it?

          • undefined reference to `WinMain@16'






          Most of the common IDEs provide features to configure this for a specific project. Here are some samples





          Eclipse-CDT



          Include path settings:
          enter image description here



          Library & library search path settings
          enter image description here





          Visual Studio 2013



          enter image description here





          Code Blocks
          enter image description hereenter image description here





          **DEV C++ (Bloodshed C++)



          As from their FAQ:




          9. How can i use the OpenGL library and others ?



          All the libraries that comes with Mingw reside in the Lib directory. They are all named in the following way: lib*.a
          To link a library with your project, just add in Project options, Further option files :
          -lopengl32

          This is for including the libopengl32.a library. To add any other library, just follow the same syntax:
          Type -l (L in lowercase) plus the base name of the library (filename without lib and the .a extension).




          You may also consider putting a -L option there to add directory pathes searched for libraries.





          Qt Creator



          In order to add include paths you have to open up the .pro file and then add
          the directories to the INCLUDEPATH variable. These paths are separated by spaces. Reference can be found here.



          Showing INCLUDEPATH





          If none of the above samples applies for your actually used IDE/toolchain, I hope you're able to get the point of abstraction:




          It's an issue how to provide compiling/linking options to your actual toolchain. The IDE used to setup the context is a minor point here.







          share|improve this answer

































            2














            For eclipse I use the pkg-config plugin where possible:



            https://marketplace.eclipse.org/content/pkg-config-support-eclipse-cdt



            Failing that this configuration window:



            enter image description here






            share|improve this answer

























              Your Answer






              StackExchange.ifUsing("editor", function () {
              StackExchange.using("externalEditor", function () {
              StackExchange.using("snippets", function () {
              StackExchange.snippets.init();
              });
              });
              }, "code-snippets");

              StackExchange.ready(function() {
              var channelOptions = {
              tags: "".split(" "),
              id: "1"
              };
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function() {
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled) {
              StackExchange.using("snippets", function() {
              createEditor();
              });
              }
              else {
              createEditor();
              }
              });

              function createEditor() {
              StackExchange.prepareEditor({
              heartbeatType: 'answer',
              autoActivateHeartbeat: false,
              convertImagesToLinks: true,
              noModals: true,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: 10,
              bindNavPrevention: true,
              postfix: "",
              imageUploader: {
              brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
              contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
              allowUrls: true
              },
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              });


              }
              });














              draft saved

              draft discarded


















              StackExchange.ready(
              function () {
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f24715864%2fproblems-importing-libraries-to-my-c-project-how-to-fix-this%23new-answer', 'question_page');
              }
              );

              Post as a guest















              Required, but never shown

























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes









              9














              It's a common misconception, that the current IDE used, is responsible for getting errors like stated in the question.

              See for example




              • c++ lib in two same project ,one can work but the other can 't

              • Issue linking libxml++ and glib libraries with CodeBlocks IDE for C++ Windows

              • ...


              The problem is almost never related to the currently used IDE.

              In the most cases the solution boils down, to supply the actual toolchain's compiler/linker with the appropriate path's to search for included headers, to be linked libraries.



              One of the major applicable answers for the linker related problems are






              • What is an undefined reference/unresolved external symbol error and how do I fix it?

              • undefined reference to `WinMain@16'






              Most of the common IDEs provide features to configure this for a specific project. Here are some samples





              Eclipse-CDT



              Include path settings:
              enter image description here



              Library & library search path settings
              enter image description here





              Visual Studio 2013



              enter image description here





              Code Blocks
              enter image description hereenter image description here





              **DEV C++ (Bloodshed C++)



              As from their FAQ:




              9. How can i use the OpenGL library and others ?



              All the libraries that comes with Mingw reside in the Lib directory. They are all named in the following way: lib*.a
              To link a library with your project, just add in Project options, Further option files :
              -lopengl32

              This is for including the libopengl32.a library. To add any other library, just follow the same syntax:
              Type -l (L in lowercase) plus the base name of the library (filename without lib and the .a extension).




              You may also consider putting a -L option there to add directory pathes searched for libraries.





              Qt Creator



              In order to add include paths you have to open up the .pro file and then add
              the directories to the INCLUDEPATH variable. These paths are separated by spaces. Reference can be found here.



              Showing INCLUDEPATH





              If none of the above samples applies for your actually used IDE/toolchain, I hope you're able to get the point of abstraction:




              It's an issue how to provide compiling/linking options to your actual toolchain. The IDE used to setup the context is a minor point here.







              share|improve this answer






























                9














                It's a common misconception, that the current IDE used, is responsible for getting errors like stated in the question.

                See for example




                • c++ lib in two same project ,one can work but the other can 't

                • Issue linking libxml++ and glib libraries with CodeBlocks IDE for C++ Windows

                • ...


                The problem is almost never related to the currently used IDE.

                In the most cases the solution boils down, to supply the actual toolchain's compiler/linker with the appropriate path's to search for included headers, to be linked libraries.



                One of the major applicable answers for the linker related problems are






                • What is an undefined reference/unresolved external symbol error and how do I fix it?

                • undefined reference to `WinMain@16'






                Most of the common IDEs provide features to configure this for a specific project. Here are some samples





                Eclipse-CDT



                Include path settings:
                enter image description here



                Library & library search path settings
                enter image description here





                Visual Studio 2013



                enter image description here





                Code Blocks
                enter image description hereenter image description here





                **DEV C++ (Bloodshed C++)



                As from their FAQ:




                9. How can i use the OpenGL library and others ?



                All the libraries that comes with Mingw reside in the Lib directory. They are all named in the following way: lib*.a
                To link a library with your project, just add in Project options, Further option files :
                -lopengl32

                This is for including the libopengl32.a library. To add any other library, just follow the same syntax:
                Type -l (L in lowercase) plus the base name of the library (filename without lib and the .a extension).




                You may also consider putting a -L option there to add directory pathes searched for libraries.





                Qt Creator



                In order to add include paths you have to open up the .pro file and then add
                the directories to the INCLUDEPATH variable. These paths are separated by spaces. Reference can be found here.



                Showing INCLUDEPATH





                If none of the above samples applies for your actually used IDE/toolchain, I hope you're able to get the point of abstraction:




                It's an issue how to provide compiling/linking options to your actual toolchain. The IDE used to setup the context is a minor point here.







                share|improve this answer




























                  9












                  9








                  9







                  It's a common misconception, that the current IDE used, is responsible for getting errors like stated in the question.

                  See for example




                  • c++ lib in two same project ,one can work but the other can 't

                  • Issue linking libxml++ and glib libraries with CodeBlocks IDE for C++ Windows

                  • ...


                  The problem is almost never related to the currently used IDE.

                  In the most cases the solution boils down, to supply the actual toolchain's compiler/linker with the appropriate path's to search for included headers, to be linked libraries.



                  One of the major applicable answers for the linker related problems are






                  • What is an undefined reference/unresolved external symbol error and how do I fix it?

                  • undefined reference to `WinMain@16'






                  Most of the common IDEs provide features to configure this for a specific project. Here are some samples





                  Eclipse-CDT



                  Include path settings:
                  enter image description here



                  Library & library search path settings
                  enter image description here





                  Visual Studio 2013



                  enter image description here





                  Code Blocks
                  enter image description hereenter image description here





                  **DEV C++ (Bloodshed C++)



                  As from their FAQ:




                  9. How can i use the OpenGL library and others ?



                  All the libraries that comes with Mingw reside in the Lib directory. They are all named in the following way: lib*.a
                  To link a library with your project, just add in Project options, Further option files :
                  -lopengl32

                  This is for including the libopengl32.a library. To add any other library, just follow the same syntax:
                  Type -l (L in lowercase) plus the base name of the library (filename without lib and the .a extension).




                  You may also consider putting a -L option there to add directory pathes searched for libraries.





                  Qt Creator



                  In order to add include paths you have to open up the .pro file and then add
                  the directories to the INCLUDEPATH variable. These paths are separated by spaces. Reference can be found here.



                  Showing INCLUDEPATH





                  If none of the above samples applies for your actually used IDE/toolchain, I hope you're able to get the point of abstraction:




                  It's an issue how to provide compiling/linking options to your actual toolchain. The IDE used to setup the context is a minor point here.







                  share|improve this answer















                  It's a common misconception, that the current IDE used, is responsible for getting errors like stated in the question.

                  See for example




                  • c++ lib in two same project ,one can work but the other can 't

                  • Issue linking libxml++ and glib libraries with CodeBlocks IDE for C++ Windows

                  • ...


                  The problem is almost never related to the currently used IDE.

                  In the most cases the solution boils down, to supply the actual toolchain's compiler/linker with the appropriate path's to search for included headers, to be linked libraries.



                  One of the major applicable answers for the linker related problems are






                  • What is an undefined reference/unresolved external symbol error and how do I fix it?

                  • undefined reference to `WinMain@16'






                  Most of the common IDEs provide features to configure this for a specific project. Here are some samples





                  Eclipse-CDT



                  Include path settings:
                  enter image description here



                  Library & library search path settings
                  enter image description here





                  Visual Studio 2013



                  enter image description here





                  Code Blocks
                  enter image description hereenter image description here





                  **DEV C++ (Bloodshed C++)



                  As from their FAQ:




                  9. How can i use the OpenGL library and others ?



                  All the libraries that comes with Mingw reside in the Lib directory. They are all named in the following way: lib*.a
                  To link a library with your project, just add in Project options, Further option files :
                  -lopengl32

                  This is for including the libopengl32.a library. To add any other library, just follow the same syntax:
                  Type -l (L in lowercase) plus the base name of the library (filename without lib and the .a extension).




                  You may also consider putting a -L option there to add directory pathes searched for libraries.





                  Qt Creator



                  In order to add include paths you have to open up the .pro file and then add
                  the directories to the INCLUDEPATH variable. These paths are separated by spaces. Reference can be found here.



                  Showing INCLUDEPATH





                  If none of the above samples applies for your actually used IDE/toolchain, I hope you're able to get the point of abstraction:




                  It's an issue how to provide compiling/linking options to your actual toolchain. The IDE used to setup the context is a minor point here.








                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited May 23 '17 at 12:17


























                  community wiki





                  8 revs, 2 users 92%
                  πάντα ῥεῖ


























                      2














                      For eclipse I use the pkg-config plugin where possible:



                      https://marketplace.eclipse.org/content/pkg-config-support-eclipse-cdt



                      Failing that this configuration window:



                      enter image description here






                      share|improve this answer






























                        2














                        For eclipse I use the pkg-config plugin where possible:



                        https://marketplace.eclipse.org/content/pkg-config-support-eclipse-cdt



                        Failing that this configuration window:



                        enter image description here






                        share|improve this answer




























                          2












                          2








                          2







                          For eclipse I use the pkg-config plugin where possible:



                          https://marketplace.eclipse.org/content/pkg-config-support-eclipse-cdt



                          Failing that this configuration window:



                          enter image description here






                          share|improve this answer















                          For eclipse I use the pkg-config plugin where possible:



                          https://marketplace.eclipse.org/content/pkg-config-support-eclipse-cdt



                          Failing that this configuration window:



                          enter image description here







                          share|improve this answer














                          share|improve this answer



                          share|improve this answer








                          edited Jul 28 '17 at 18:37

























                          answered May 23 '15 at 13:18









                          GalikGalik

                          34.4k35080




                          34.4k35080






























                              draft saved

                              draft discarded




















































                              Thanks for contributing an answer to Stack Overflow!


                              • Please be sure to answer the question. Provide details and share your research!

                              But avoid



                              • Asking for help, clarification, or responding to other answers.

                              • Making statements based on opinion; back them up with references or personal experience.


                              To learn more, see our tips on writing great answers.




                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function () {
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f24715864%2fproblems-importing-libraries-to-my-c-project-how-to-fix-this%23new-answer', 'question_page');
                              }
                              );

                              Post as a guest















                              Required, but never shown





















































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown

































                              Required, but never shown














                              Required, but never shown












                              Required, but never shown







                              Required, but never shown







                              Popular posts from this blog

                              MongoDB - Not Authorized To Execute Command

                              How to fix TextFormField cause rebuild widget in Flutter

                              in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith