how to link the resource file with Nppexec?

  • I know how to complie and link the C++ .cpp file into .exe. but I still can’t figure out how to link the .rc file with icon using the Nppexec plugin.
    here is my command line:
    cmd /k chdir /d $(CURRENT_DIRECTORY) &cl $(FILE_NAME) /Fo:$(NAME_PART).obj /c &EXIT
    cmd /k chdir /d $(CURRENT_DIRECTORY) &link $(NAME_PART).obj /OUT:$(NAME_PART).exe &EXIT

    but how can I add words to complie the .rc file with icon?
    my OS is windows10 x64 complier is vs 2013

  • @imdjs

    Afaik rc files can’t be compiled by normal source code compilers you need to use
    some kind of resource file compilers. I can’t remember its exact name it was something
    like winres.exe or windowsres.exe.
    Once you have the compiled resource file you provide it to the linker like any other file
    which should be linked.

    But, why do you use cmd /k?
    NppExec provides its own pseudo shell and you see the output in the NppExec console immediately.


  • thank you for reply,
    I dont know much about what the command line means ,this is others tell me and it works except for link the .rc file

  • Looking at the provided examples for .cpp files, the one for .rc file should look similar to:
    cmd /k chdir /d $(CURRENT_DIRECTORY) &rc /r Resource.rc /Fo:Resource.res &EXIT

    Note: the executable “rc” is located under %ProgramFiles%\Microsoft SDKs\Windows\v7.1A\bin rather than under %ProgramFiles%\Microsoft Visual Studio 12.0\VC\bin where “cl” and “link” are located, so you may need to add %ProgramFiles%\Microsoft SDKs\Windows\v7.1A\bin to the %PATH%.
    Also, the resource compilation must be the very first command, and then the call to “cl” should include this compiled resource file, similar to:
    cmd /k chdir /d $(CURRENT_DIRECTORY) &cl $(FILE_NAME) /Fo:$(NAME_PART).obj Resource.res /c &EXIT

    If this does not work from the first attempt, please ask the others’ help (the ones mentioned by you), they should know :)

  • @Vitaliy Dovgan
    thank you for reply ,I found that the command line: cmd /k chdir /d $(CURRENT_DIRECTORY) &rc /r Resource.rc /Fo:Resource.res &EXIT is not working pop up(fatal error RC1107: invalid usage; use RC /? for Help) but if I change it to: cmd /k chdir /d $(CURRENT_DIRECTORY) &rc /r Resource.rc &EXIT then it works but I can’t sepecify the output directory with /Fo: ,however this is nothing big deal.


  • SET local MSSDK = E:/Microsoft Visual Studio 12.0/VC/Microsoft SDKs/Windows/v7.1A
    ENV_SET PATH =$(MSSDK)/bin/x64;$(SYS.PATH)
    SET local B_DIR = B:/$(NAME_PART)

    cmd /k chdir /d $(CURRENT_DIRECTORY) &rc /r /v /fo $(B_DIR).res $(NAME_PART).rc &EXIT

    I finally figure out how to complie the .rc file with the sepecify output directory

Log in to reply