Configuring Make and Run on Netbeans for C/C++












0














I am using Netbeans to work with an existing C/C++ codebase. In order to compile and run files in this codebase, I have to manually configure how Netbeans should invoke Make and and which command it should execute in order to run the result of the compilation. This is done through the option Make, accessible through Properties>Build>Make



To compile the project, I require Netbeans to run the following command:



make S=tests/kkfs


This works fine. Independent of the file that I am modifying on my working tree, it re-compiles this file and all files which depend on it.



Now suppose that I want to run a specific file on my project, called:




test_task.cc




This is where the set up becomes annoying, as I have to manually configure Netbeans to run the following command:



prove -v test/t/amd64_gen/l4f/kkfs/abi/test_task.t


I would like to know if it is possible to extract the name of the file which is currently open on the editor window of Netbeans, or the name of the file that is currently selected with the mouse. This would then give me a variable that contains the string test_task.cc, and I could then do some trick with sed to extract the part of the name that precedes the dot (.), so that I can dynamically provide to Netbeans the target of execution without having to statically set up it for each different file I want to run.



Any ideas on how I can do that?










share|improve this question





























    0














    I am using Netbeans to work with an existing C/C++ codebase. In order to compile and run files in this codebase, I have to manually configure how Netbeans should invoke Make and and which command it should execute in order to run the result of the compilation. This is done through the option Make, accessible through Properties>Build>Make



    To compile the project, I require Netbeans to run the following command:



    make S=tests/kkfs


    This works fine. Independent of the file that I am modifying on my working tree, it re-compiles this file and all files which depend on it.



    Now suppose that I want to run a specific file on my project, called:




    test_task.cc




    This is where the set up becomes annoying, as I have to manually configure Netbeans to run the following command:



    prove -v test/t/amd64_gen/l4f/kkfs/abi/test_task.t


    I would like to know if it is possible to extract the name of the file which is currently open on the editor window of Netbeans, or the name of the file that is currently selected with the mouse. This would then give me a variable that contains the string test_task.cc, and I could then do some trick with sed to extract the part of the name that precedes the dot (.), so that I can dynamically provide to Netbeans the target of execution without having to statically set up it for each different file I want to run.



    Any ideas on how I can do that?










    share|improve this question



























      0












      0








      0







      I am using Netbeans to work with an existing C/C++ codebase. In order to compile and run files in this codebase, I have to manually configure how Netbeans should invoke Make and and which command it should execute in order to run the result of the compilation. This is done through the option Make, accessible through Properties>Build>Make



      To compile the project, I require Netbeans to run the following command:



      make S=tests/kkfs


      This works fine. Independent of the file that I am modifying on my working tree, it re-compiles this file and all files which depend on it.



      Now suppose that I want to run a specific file on my project, called:




      test_task.cc




      This is where the set up becomes annoying, as I have to manually configure Netbeans to run the following command:



      prove -v test/t/amd64_gen/l4f/kkfs/abi/test_task.t


      I would like to know if it is possible to extract the name of the file which is currently open on the editor window of Netbeans, or the name of the file that is currently selected with the mouse. This would then give me a variable that contains the string test_task.cc, and I could then do some trick with sed to extract the part of the name that precedes the dot (.), so that I can dynamically provide to Netbeans the target of execution without having to statically set up it for each different file I want to run.



      Any ideas on how I can do that?










      share|improve this question















      I am using Netbeans to work with an existing C/C++ codebase. In order to compile and run files in this codebase, I have to manually configure how Netbeans should invoke Make and and which command it should execute in order to run the result of the compilation. This is done through the option Make, accessible through Properties>Build>Make



      To compile the project, I require Netbeans to run the following command:



      make S=tests/kkfs


      This works fine. Independent of the file that I am modifying on my working tree, it re-compiles this file and all files which depend on it.



      Now suppose that I want to run a specific file on my project, called:




      test_task.cc




      This is where the set up becomes annoying, as I have to manually configure Netbeans to run the following command:



      prove -v test/t/amd64_gen/l4f/kkfs/abi/test_task.t


      I would like to know if it is possible to extract the name of the file which is currently open on the editor window of Netbeans, or the name of the file that is currently selected with the mouse. This would then give me a variable that contains the string test_task.cc, and I could then do some trick with sed to extract the part of the name that precedes the dot (.), so that I can dynamically provide to Netbeans the target of execution without having to statically set up it for each different file I want to run.



      Any ideas on how I can do that?







      c++ netbeans compilation






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 23 '18 at 10:00

























      asked Nov 23 '18 at 9:32









      Diego Dias

      4616




      4616
























          0






          active

          oldest

          votes











          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%2f53443947%2fconfiguring-make-and-run-on-netbeans-for-c-c%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          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.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • 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%2f53443947%2fconfiguring-make-and-run-on-netbeans-for-c-c%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

          Trompette piccolo

          Slow SSRS Report in dynamic grouping and multiple parameters

          Simon Yates (cyclisme)