0

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!

Mheldown
  • 7
  • 4
  • Welcome to SO !!, have you tried this [link](https://stackoverflow.com/questions/2506400/how-to-compile-and-run-c-files-from-within-notepad-using-nppexec-plugin) ? – Saurabh P Bhandari Jun 11 '19 at 07:44
  • my strong advice: don't bother with notepad++ for C development. notepad++ is great when you want a quick look over something or to do some minor editing. For actual development (write code, compile, run etc) use a full fledged IDE that supports C. Something like Visual Studio, Codeblocks, Eclipse or VS Code. – bolov Jun 11 '19 at 10:31

2 Answers2

0

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

Saurabh P Bhandari
  • 6,014
  • 1
  • 19
  • 50
0

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.

virolino
  • 2,073
  • 5
  • 21
  • I am going to download CodeBlocks and have a look at it. One Question. How do I mark a Question as solved? – Mheldown Jun 11 '19 at 11:02
  • You have a gray check-mark for each answer, under the votes counter. Click it and that answer becomes the chosen answer (the check-mark becoming green). – virolino Jun 11 '19 at 11:10