Menu

gcc + notepad++ == need a new environment var

2008-01-21
2012-11-13
  • Nobody/Anonymous

    Hello guys,

    I was wondering that it's my fault that I can't make it, or what?

    Here are the details.

    I compile my programs with gcc (on Windows, but irrelevant). When I compile, gcc requests two cmd-parameters: the input file and the filename of the output file. Here's the syntax:

         >>   gcc WHATEVER.C -o WHATEVER.EXE

    I use N++ for editing my source-codes and I set up a hot key for compiling with gcc. Here's the trick: there's only one env. variable which is good to me: FULL_CURRENT_PATH

    But the -o parameter of gcc needs an exe filename, and it would be good the same filname as the source code. (So WHATEVER.C ==> WHATEVER.EXE)

    So, it would be good, if a new env. var was available, which shows the full path and the filename BUT WITHOUT ITS EXTENSION. (*.C, *.cs,*cpp, whatever...)

    So if the WHATEVER.C would be in D:\, then a new env.var, named FULL_CURRENT_PATH_/w_EXT,
    show:
         D:\WHATEVER

         I know in this case, the CURRENT_DIRECTORY will confuse, if there was a WHATEVER folder on D. But then how can it be solved?

    Thanks for replying and reading it,

    Daneey

     
    • DV

      DV - 2008-01-21

      What about this? --
      $(CURRENT_DIRECTORY)\$(NAME_PART)

       
      • Nobody/Anonymous

        Hi!

        Thank you!

        The NAME_PART variable solves my problem. Together with the CURRENT_DIRECTORY variable, my problem has been solved.

        But there's another question:
        how can I pause the output of the compiler to check whether there's any error? or in other words, how can I put more than one command in a Windows prompt (a gcc and a PAUSE command, for example?)

        Thanks in advance,
        Daneey

         
    • Salocin Delbab

      Salocin Delbab - 2008-01-21

      you can have a look to the excellent plugin from dv : NppExec. and then use batch files, or script as you want...
      Nico

       
      • Nobody/Anonymous

        Thanks for this tipp, but typing the filename into the NppExec consolewindow is still a longer process then pressing a hotkey, and then checking the console window for any error.