How do I tell GCC and Clang to look at /usr/local/cuda for include/libs?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












I have installed CUDA on my system, but seems like its files are not being found by libraries that depend on it. What should I append to my .bashrc in order for both GCC and Clang to look on the directories /usr/local/cuda/include and /usr/local/cuda/lib ?










share|improve this question

























    up vote
    0
    down vote

    favorite












    I have installed CUDA on my system, but seems like its files are not being found by libraries that depend on it. What should I append to my .bashrc in order for both GCC and Clang to look on the directories /usr/local/cuda/include and /usr/local/cuda/lib ?










    share|improve this question























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I have installed CUDA on my system, but seems like its files are not being found by libraries that depend on it. What should I append to my .bashrc in order for both GCC and Clang to look on the directories /usr/local/cuda/include and /usr/local/cuda/lib ?










      share|improve this question













      I have installed CUDA on my system, but seems like its files are not being found by libraries that depend on it. What should I append to my .bashrc in order for both GCC and Clang to look on the directories /usr/local/cuda/include and /usr/local/cuda/lib ?







      shell gcc






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jan 20 '15 at 4:35









      MaiaVictor

      1094




      1094




















          3 Answers
          3






          active

          oldest

          votes

















          up vote
          1
          down vote













          You have to do it:



          gcc -I/path_of_include_files -L/path_of_load_libraries_files 


          NOTE: you can have some -I and some -L such as :



          gcc -I. -L. -I../include -L../libs





          share|improve this answer



























            up vote
            1
            down vote













            Both gcc and clang respect some environment variables that can help achieve what you want. Try adding these to your ~/.bashrc:



            export CFLAGS="-I /usr/local/cuda/include"
            export LDFLAGS="-L /usr/local/cuda/lib"


            However this is usually not done on a global level - different projects need different includes and libs so best to configure the custom include and lib directories per-project in your Makefile or using ./configure.






            share|improve this answer




















            • This answer is misleading. CFLAGS and LDFLAGS aren't environment variables related to GCC or Clang. These are make variables merely respected by convention.
              – alecov
              11 mins ago

















            up vote
            0
            down vote













            Both the GCC and Clang drivers respect the following environment variables:



            export C_INCLUDE_PATH=/usr/local/cuda/include
            export CPLUS_INCLUDE_PATH=/usr/local/cuda/include
            export LIBRARY_PATH=/usr/local/cuda/lib


            Check the manuals.





            share




















              Your Answer







              StackExchange.ready(function()
              var channelOptions =
              tags: "".split(" "),
              id: "106"
              ;
              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',
              convertImagesToLinks: false,
              noModals: false,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              );



              );













               

              draft saved


              draft discarded


















              StackExchange.ready(
              function ()
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f179986%2fhow-do-i-tell-gcc-and-clang-to-look-at-usr-local-cuda-for-include-libs%23new-answer', 'question_page');

              );

              Post as a guest






























              3 Answers
              3






              active

              oldest

              votes








              3 Answers
              3






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes








              up vote
              1
              down vote













              You have to do it:



              gcc -I/path_of_include_files -L/path_of_load_libraries_files 


              NOTE: you can have some -I and some -L such as :



              gcc -I. -L. -I../include -L../libs





              share|improve this answer
























                up vote
                1
                down vote













                You have to do it:



                gcc -I/path_of_include_files -L/path_of_load_libraries_files 


                NOTE: you can have some -I and some -L such as :



                gcc -I. -L. -I../include -L../libs





                share|improve this answer






















                  up vote
                  1
                  down vote










                  up vote
                  1
                  down vote









                  You have to do it:



                  gcc -I/path_of_include_files -L/path_of_load_libraries_files 


                  NOTE: you can have some -I and some -L such as :



                  gcc -I. -L. -I../include -L../libs





                  share|improve this answer












                  You have to do it:



                  gcc -I/path_of_include_files -L/path_of_load_libraries_files 


                  NOTE: you can have some -I and some -L such as :



                  gcc -I. -L. -I../include -L../libs






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Jan 20 '15 at 4:43









                  PersianGulf

                  6,76543358




                  6,76543358






















                      up vote
                      1
                      down vote













                      Both gcc and clang respect some environment variables that can help achieve what you want. Try adding these to your ~/.bashrc:



                      export CFLAGS="-I /usr/local/cuda/include"
                      export LDFLAGS="-L /usr/local/cuda/lib"


                      However this is usually not done on a global level - different projects need different includes and libs so best to configure the custom include and lib directories per-project in your Makefile or using ./configure.






                      share|improve this answer




















                      • This answer is misleading. CFLAGS and LDFLAGS aren't environment variables related to GCC or Clang. These are make variables merely respected by convention.
                        – alecov
                        11 mins ago














                      up vote
                      1
                      down vote













                      Both gcc and clang respect some environment variables that can help achieve what you want. Try adding these to your ~/.bashrc:



                      export CFLAGS="-I /usr/local/cuda/include"
                      export LDFLAGS="-L /usr/local/cuda/lib"


                      However this is usually not done on a global level - different projects need different includes and libs so best to configure the custom include and lib directories per-project in your Makefile or using ./configure.






                      share|improve this answer




















                      • This answer is misleading. CFLAGS and LDFLAGS aren't environment variables related to GCC or Clang. These are make variables merely respected by convention.
                        – alecov
                        11 mins ago












                      up vote
                      1
                      down vote










                      up vote
                      1
                      down vote









                      Both gcc and clang respect some environment variables that can help achieve what you want. Try adding these to your ~/.bashrc:



                      export CFLAGS="-I /usr/local/cuda/include"
                      export LDFLAGS="-L /usr/local/cuda/lib"


                      However this is usually not done on a global level - different projects need different includes and libs so best to configure the custom include and lib directories per-project in your Makefile or using ./configure.






                      share|improve this answer












                      Both gcc and clang respect some environment variables that can help achieve what you want. Try adding these to your ~/.bashrc:



                      export CFLAGS="-I /usr/local/cuda/include"
                      export LDFLAGS="-L /usr/local/cuda/lib"


                      However this is usually not done on a global level - different projects need different includes and libs so best to configure the custom include and lib directories per-project in your Makefile or using ./configure.







                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Jan 20 '15 at 4:52









                      MLu

                      1,223821




                      1,223821











                      • This answer is misleading. CFLAGS and LDFLAGS aren't environment variables related to GCC or Clang. These are make variables merely respected by convention.
                        – alecov
                        11 mins ago
















                      • This answer is misleading. CFLAGS and LDFLAGS aren't environment variables related to GCC or Clang. These are make variables merely respected by convention.
                        – alecov
                        11 mins ago















                      This answer is misleading. CFLAGS and LDFLAGS aren't environment variables related to GCC or Clang. These are make variables merely respected by convention.
                      – alecov
                      11 mins ago




                      This answer is misleading. CFLAGS and LDFLAGS aren't environment variables related to GCC or Clang. These are make variables merely respected by convention.
                      – alecov
                      11 mins ago










                      up vote
                      0
                      down vote













                      Both the GCC and Clang drivers respect the following environment variables:



                      export C_INCLUDE_PATH=/usr/local/cuda/include
                      export CPLUS_INCLUDE_PATH=/usr/local/cuda/include
                      export LIBRARY_PATH=/usr/local/cuda/lib


                      Check the manuals.





                      share
























                        up vote
                        0
                        down vote













                        Both the GCC and Clang drivers respect the following environment variables:



                        export C_INCLUDE_PATH=/usr/local/cuda/include
                        export CPLUS_INCLUDE_PATH=/usr/local/cuda/include
                        export LIBRARY_PATH=/usr/local/cuda/lib


                        Check the manuals.





                        share






















                          up vote
                          0
                          down vote










                          up vote
                          0
                          down vote









                          Both the GCC and Clang drivers respect the following environment variables:



                          export C_INCLUDE_PATH=/usr/local/cuda/include
                          export CPLUS_INCLUDE_PATH=/usr/local/cuda/include
                          export LIBRARY_PATH=/usr/local/cuda/lib


                          Check the manuals.





                          share












                          Both the GCC and Clang drivers respect the following environment variables:



                          export C_INCLUDE_PATH=/usr/local/cuda/include
                          export CPLUS_INCLUDE_PATH=/usr/local/cuda/include
                          export LIBRARY_PATH=/usr/local/cuda/lib


                          Check the manuals.






                          share











                          share


                          share










                          answered 1 min ago









                          alecov

                          1062




                          1062



























                               

                              draft saved


                              draft discarded















































                               


                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f179986%2fhow-do-i-tell-gcc-and-clang-to-look-at-usr-local-cuda-for-include-libs%23new-answer', 'question_page');

                              );

                              Post as a guest













































































                              Popular posts from this blog

                              How to check contact read email or not when send email to Individual?

                              Bahrain

                              Postfix configuration issue with fips on centos 7; mailgun relay