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

914 Views Asked by At

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!

2

There are 2 best solutions below

0
Saurabh P Bhandari On BEST ANSWER

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

2
virolino On

I use notepad++ for text a lot, it is a beauty of a program.

However, for C programming I use CodeBlocks. It has similar text processing capabilities compared with notepad++ (but to a lesser extent), but it has an integrated compiler (choose the install package according to your needs), debugger and so on. It is designed from scratch to be an IDE. It supports several compilers.

Also, similar with notepad++, you can have it portable.