Search code examples
cnotepad++nppexec

I want to compile c codes in notepad++, but I can't set nppexec up


So, I tried setting this up. Everytime I get errors or it won't create an exe I can'T find usefull code for this. I am super tired and angry.

I hope someone can help me

I searched on Youtube and Bing, but didn't find anything usefull for me. Nothing is working.

I had already this code:

npp_save
cd "$(CURRENT_DIRECTORY)"
gcc "$(FILE_NAME)" -o $(NAME_PART) -march=native -O3
NPP_RUN $(NAME_PART)
//It doesn't create the needed exe file

...this code:

npp_save
cd $(CURRENT_DIRECTORY)
E:\Programme\MinGW\bin\gcc.exe $(FILE_NAME)
cmd /c $(CURRENT_DIRECTORY)\$(NAME_PART).exe
//The same thing

For the first code I got this error:

NPP_SAVE: F:\Entwicklung\C\Begin
CD: F:\Entwicklung\C
Current directory: F:\Entwicklung\C
gcc "Begin" -o Begin -march=native -O3
Process started (PID=3676) >>>
Begin: file not recognized: file format not recognized
collect2.exe: error: ld returned 1 exit status
<<< Process finished (PID=3676). (Exit code 1)
NPP_RUN: Begin
================ READY ================

For the second code I got this:

NPP_SAVE: F:\Entwicklung\C\Begin
CD: F:\Entwicklung\C
Current directory: F:\Entwicklung\C
E:\Programme\MinGW\bin\gcc.exe Begin
Process started (PID=11760) >>>
Begin: file not recognized: file format not recognized
collect2.exe: error: ld returned 1 exit status
<<< Process finished (PID=11760). (Exit code 1)
cmd /c F:\Entwicklung\C\Begin.exe
Process started (PID=5024) >>>
Der Befehl "F:\Entwicklung\C\Begin.exe" ist entweder falsch geschrieben 
oder
konnte nicht gefunden werden.    <-- Over there its saying, that this 
isn't 
a 
                                     command
<<< Process finished (PID=5024). (Exit code 1)
================ READY ================

I am very sorry for my bad english and this less information, but I am extremly tired and just want to can finaly compile C code. I don't know. Maybe you can give me a right code.

Thanks a lot and have a wonderful day!


Solution

  • It seems that NppExec plugin does not honor path variables. Try executing the following :

    NPP_SAVE
    
    CD E:\Programme\MinGW\bin\
    
    gcc.exe "$(CURRENT_DIRECTORY)\$(FILE_NAME)" -o $(CURRENT_DIRECTORY)\out.exe
    
    $(CURRENT_DIRECTORY)\out.exe
    
    CD $(CURRENT_DIRECTORY)
    

    Update:

    As per @Mheldown's answer and comments, the error was due to the filename not being correctly saved (Hello.c not Hello). The console clearly stated that :

    Begin: file not recognized: file format not recognized

    TL;DR : Stay Calm and Read Console Errors