Problem with C++



  • I downloaded the Nppexec plugin (the one with the gpup.exe) and had it work.
    Then there was some problem with the compiler, I had to change mingw folder name to mingwold. That made the code work. But as soon as I run the program, it opens for a second and then closes. If I use it to input two numbers and show their sum, it exits as soon as it shows the sum. How can I make it not shut itself?
    Here’s the code I wrote in nppexec:

    npp_save
    cd “$(CURRENT_DIRECTORY)”
    g++ “$(FILE_NAME)” -o $(NAME_PART) -march=native -O3
    NPP_RUN $(NAME_PART)



  • NPP_RUN cmd /K "$(NAME_PART)"
    

    , probably.



  • Hey, thanks! I don’t understand either of the scripts. So can you tell me what they’re doing?



    1. Typing
    help npp_save
    

    in the NppExec Console says:

    COMMAND:  npp_save
    USAGE:
      npp_save
      npp_save <file>
    DESCRIPTION:
      1. Saves current file ("npp_save" without parameters)
      2. Saves specified file if it's opened in Notepad++
         (supports a partial file path/name)
    EXAMPLES:
      npp_save         // saves current file
      npp_save $(#2)   // saves 2nd file opened in Notepad++
      npp_save txt     // saves a first file which contains "txt" in its name
    SEE ALSO:
      npp_saveas, npp_saveall, npp_open
    
    1. Typing
    help cd
    

    in the NppExec Console says:

    COMMAND:  cd
    USAGE:
      cd
      cd <relative_path>
      cd <absolute_path>
    DESCRIPTION:
      1. Changes current directory ("cd" with parameters)
      2. Shows current directory path ("cd" without parameters)
    EXAMPLES:
      cd       // shows current directory path
      cd ..    // go to up-directory
      cd \     // go to root-directory
      cd $(NPP_DIRECTORY)    // go to notepad++'s directory
      cd e:\temp            // change drive and directory
    SEE ALSO:
      dir
    
    1. Typing
    help npp_run
    

    in the NppExec Console says:

    COMMAND:  npp_run
    USAGE:
      npp_run <command>
      npp_run <file>
    DESCRIPTION:
      1. The same as Notepad++'s Run command - runs an external process
      2. Opens specified file in its associated program (requires NppExec v0.2 RC3.1 or higher)
    EXAMPLES:
      npp_run calc.exe    (*)
      * if you type just "calc.exe" without "npp_run", then NppExec runs
        "calc.exe" as a child process and waits until it returns (i.e. until
        you close the calc's window)
      npp_run "index.html" // opens "index.html" in your default web-browser
      npp_run "C:\Program Files\Mozilla Firefox\firefox.exe" "index.html" // in Firefox
      npp_run "$(FULL_CURRENT_PATH)" // opening using the associated program
    REMARKS:
      In terms of an application (a program), NPP_RUN allows to run it in its own
      window without waiting for its execution:
        npp_run application.exe
        npp_run application.exe <arguments>
      If, however, there is a need to wait until the application has been executed,
      while still running it in its own window, it can be achieved without NPP_RUN:
        cmd /c start /wait application.exe
        cmd /c start /wait application.exe <arguments>
      In this last case, NppExec waits for cmd to be executed, while cmd itself
      starts the application in its own separate window and waits until it has
      been executed.
    
    1. Type just
    help
    

    in the NppExec Console to see all the available environment variables and commands.


Log in to reply