Compile and run C code using Notepad++ (2021)

Поділитися
Вставка
  • Опубліковано 24 лис 2024

КОМЕНТАРІ •

  • @docxy0
    @docxy0 5 років тому +12

    Thank you for the videos CodeVault; I'm currently taking a class in Operating Systems and I need to learn a lot in C. Your videos help a lot

  • @tthai586
    @tthai586 4 роки тому +6

    I am learning C, and start using Notepad++ as a text editor as an author mentioned in his beginning C book that I am reading. At first, I didn't see the real power of Notepad++ until I learnt that I could do splitting screens and other stuff like hiding coding lines... while editing my source code. And now, with Notepad++, I am able to add on an optional feature / plugin that will allow me to compile and execute all my C programs from within my Notepad++ editing! All such things really mean Notepad++ is even more powerful and greater. And now I am learning that I could even choose different compilers (minGW, VC,..) in my scripting setups! What can I say? Thank you so much for such a great video.

  • @samfisher8426
    @samfisher8426 3 роки тому +6

    Hi nerds :)
    im trying to learn the basics ( compile + coding ) its really hard
    big respect for all the nerds around the world

  • @mb59621
    @mb59621 5 місяців тому

    hey dude I am sorry I did not reply to you earlier but this is the problem exactly:
    So the problem is with files taking some input , the code is let's say :
    #include
    int main()
    {
    int d ;
    printf("Enter age.");
    scanf("%d",&d);
    printf("%d",d);
    return 0;
    }
    Now when I run this in the nppexec console following all your instructions, nothing happens , there is just a cursor blinking, so I type something on the keyboard(say 2) and press enter , then it prints :
    Enter age.2
    Why is it not printing the prompt first and then taking input ?
    In case multiple inputs in the code , what it does is that it takes all the inputs first , then prints the prompt printf statements , skips the scanf statements and gives the output .

    • @CodeVault
      @CodeVault  5 місяців тому

      Haven't tried running in Notepad++ in a while... You can always just use the terminal to compile and run the programs that way

    • @mb59621
      @mb59621 5 місяців тому

      @@CodeVault it's not a major problem, I come from VS code so I like the integrated terminal . There is this "khaki" theme on notepad++ which I love , but I cannot find a way to replicate it on VS code . No extensions are there.
      Anyways I shall thank you for cooperation ! Your channel is great.

  • @nowshadk07
    @nowshadk07 2 роки тому +1

    Thanks sir. This was very helpfull.

  • @aketisubbu
    @aketisubbu 3 роки тому +1

    Sir, Please explain me how to run POSIX thread programs from notepad++.waiting for your explanation.

    • @CodeVault
      @CodeVault  3 роки тому +1

      pthread.h is a Linux specific library. You should try to either use WSL on Windows or work on Linux.

  • @KeithAlvarez-m5c
    @KeithAlvarez-m5c Місяць тому

    How about for this one?
    'gcc' is not recognized as an internal or external command,
    operable program or batch file.

    • @CodeVault
      @CodeVault  Місяць тому

      You need to make sure gcc is in your PATH variable

  • @manofmesopotamia7602
    @manofmesopotamia7602 3 роки тому +1

    if we design a custom program (similar to arduino ide) using visual studio, could we make it compile and upload the codes to an MCU and how?
    I would highly appreciate your efforts if you make a tutorial on this.

    • @CodeVault
      @CodeVault  3 роки тому +1

      I think you can but I don't have experience with that. I'll look into it

    • @marcosdanielamaral5015
      @marcosdanielamaral5015 3 роки тому

      There is a python application where it "compiles" and programs a device (where I saw it, it was programming an EEPROM)

  • @oscaralvarez714
    @oscaralvarez714 4 роки тому +1

    Thank you so much. Now I can compile and run my Fortran files and run them in Notepad++. Thank you!!

  • @Platinumcan
    @Platinumcan 3 роки тому +3

    Hey I tried getting onop (minGW. org) but the domain has expired, there i another one at (sourceforge. net) But I just whant to be sure that there are others that have experience with this website before going and downloading from there. and there is sure to be others that think the same, thanks for anny responds.
    And thanks for helping out with notepad ++

    • @Platinumcan
      @Platinumcan 3 роки тому +1

      I can answer myself after I have now downloaded it, but I went to( sourceforge. net/projects/mingw/) for those who need the same file

  • @luisdominguesforprogramaca3221
    @luisdominguesforprogramaca3221 3 роки тому +1

    Thanks. The .exe extension for the output file didn't work for me so I got rid of it and things started working. Just another hint for those who aren't English speaking natives, go to settings, new document, change the encoding to either ansi (the first ticking option) or to windows-1252 (in the bottom dropdown), in your new file include locale.h and use the setlocale in Main.

    • @devincarl8120
      @devincarl8120 3 роки тому

      I know it's kinda off topic but does anybody know a good website to watch newly released series online ?

    • @armanizayne2364
      @armanizayne2364 3 роки тому

      @Devin Carl i use FlixZone. You can find it by googling :)

    • @clydelayton2017
      @clydelayton2017 3 роки тому

      @Armani Zayne Yea, been using FlixZone for months myself :D

    • @devincarl8120
      @devincarl8120 3 роки тому

      @Armani Zayne thank you, I went there and it seems like they got a lot of movies there =) I appreciate it!!

    • @armanizayne2364
      @armanizayne2364 3 роки тому

      @Devin Carl glad I could help :)

  • @arunkumarc9628
    @arunkumarc9628 3 роки тому +1

    Sir, I want to include graphics header file for C in Notepad++... Please tell me how???

    • @CodeVault
      @CodeVault  3 роки тому

      I think this is what you're looking for if you're using MinGW: stackoverflow.com/questions/8063314/graphics-for-mingw

  • @tapanpatel6778
    @tapanpatel6778 2 роки тому +1

    Thank you bro very much it worked man ,😀

  • @mb59621
    @mb59621 11 місяців тому

    Hi , i have run into a problem here. This runs okay for all C code , except the ones asking for input. It waits for a prompt, and after the prompt is given , it assumes the prompt as input and skips the actual scanf() code that should be asking for input.
    I would be grateful if you find out what's wrong.

    • @CodeVault
      @CodeVault  10 місяців тому

      It should work... Is the value that it read the actual prompt text?

    • @josecamua7380
      @josecamua7380 5 місяців тому

      @@CodeVault same problem here...
      also, tutorial was very helpful

    • @mb59621
      @mb59621 5 місяців тому

      ​@@CodeVault hey I am sorry I did not reply but this is the problem exactly:
      So the problem is with files taking some input , the code is let's say :
      #include
      int main()
      {
      int d ;
      printf("Enter age.");
      scanf("%d",&d);
      printf("%d",d);
      return 0;
      }
      Now when I run this in the nppexec console following all your instructions, nothing happens , there is just a cursor blinking, so I type something on the keyboard(say 2) and press enter , then it prints :
      Enter age.2
      Why is it not printing the prompt first and then taking input ?
      In case multiple inputs in the code , what it does is that it takes all the inputs first , then prints the prompt printf statements , skips the scanf statements and gives the output .

  • @tthai586
    @tthai586 4 роки тому

    CodeVault, I currently can't test the script that uses the Visual Studio Community in my PC yet (that is for the future.) However, when I looked into your updated script (the updated version of Visual Studio community) above, I notice there is a "2019" in the path of the cd (change directory) command. I am wondering if you can change that "2019" to something more generalized, that will help the script still to be working in the far more future when Microsoft releases newer versions (like 2020, 2021,...) to the public. Will something like this "cd $(CURRENT_DIRECTORY)" work? Thanks again. Great!

    • @CodeVault
      @CodeVault  4 роки тому +1

      I could change to something like , but then people might omit replacing that to their own version and wouldn't help that much. Couple that with the fact that the path itself might change in the next version of VS, I think 2019 is fine (for now).

  • @goldhalowings
    @goldhalowings 5 років тому +2

    Many people learn C (i guess) because they want to make a game or even a emulator (like CHIP8) in SDL (or OpenGL) or to make a usable program in GTK, well i'm one of them, i will like to put to a good use what i learn and learn more, this is a good idea for more videos

    • @CodeVault
      @CodeVault  5 років тому +3

      We could make a tutorial series for a 3D game engine in OpenGL, if that's what you mean.

  • @MechMonty
    @MechMonty 2 роки тому

    by both ways i could see below error
    ; about to start a child process: ""new1.exe""
    CreateProcess() failed with error code 2:
    The system cannot find the file specified.

    • @CodeVault
      @CodeVault  2 роки тому

      In the description I have added a separate script so that the resulting executable doesn't execute if the compilation fails. You can use that.
      And double check that your program does, in fact, compile and it's in the right directory.
      Also, that "new1" name might mean you're using temporary files, try saving the file somewhere and then compiling it

  • @harshita996
    @harshita996 2 роки тому

    Instead of Nppexec it is coming NppExport after installing nppexec. Why?

    • @CodeVault
      @CodeVault  2 роки тому

      You mean after installing nppexec? Double check you installed the right plugin

  • @smitpatel9275
    @smitpatel9275 3 роки тому +1

    my script runs in cmd and closes at same time, I can't see the output

    • @CodeVault
      @CodeVault  3 роки тому

      There's a trick to this. You can add a system("pause"); at the end of the source code or a getch()/getche()/getchar() (one of those should work)

    • @smitpatel9275
      @smitpatel9275 3 роки тому

      @@CodeVault sir it's not working

    • @CodeVault
      @CodeVault  3 роки тому

      You can also try a scanf at the end, if all else fails.

    • @smitpatel9275
      @smitpatel9275 3 роки тому

      @@CodeVault not working
      Here is the code reply me with the correct changes.
      #include
      int main()
      {
      int a,b;
      printf("Enter the value of a
      ");
      scanf("%d",&a);
      printf("Enter the value of b
      ");
      scanf("%d",&b);

      printf("The sum of a and b is %d",a+b);
      return 0;
      }

    • @CodeVault
      @CodeVault  3 роки тому

      Where did you add system("pause"); or getch()?

  • @navneethsharma8811
    @navneethsharma8811 3 роки тому

    Sir can you explain vim configuration in windows and how to customise it to work with it better

  • @Django-43
    @Django-43 4 роки тому

    Hi!! I am using the Notepad ++ text editor but it does not recognize the "src" and "url" in the
    @ font-face of the css code to import custom fonts. What can I do to solve this problem?

    • @CodeVault
      @CodeVault  4 роки тому +1

      Hmm, you're trying to edit CSS in Notepad++?

    • @Django-43
      @Django-43 4 роки тому

      @@CodeVault The only problem that I have editing in css with Notepad ++ is that it does not recognize the SRC (source) and URL inside the @ font-face.
      This is what I am writing in the css code of Notepad ++ text editor:
      @font-face{
      font-family: Piedra Regular;
      src: url(E:\Diseño web\Fonts\Piedra-Regular.ttf);

      }
      h1{
      font-family: Piedra Regular, cursive;
      font-style: italic;
      text-transform: uppercase;
      }
      h3{
      font-family: Piedra Regular, sans-serif;
      font-size: 34px;
      font-weight: lighter;
      }

    • @CodeVault
      @CodeVault  4 роки тому

      Yeah, you can't specify absolute paths in CSS since this is ran in the browser. You'll need to specify relative paths to the CSS file (inside the webserver). So you'll have to copy the .ttf file in your source folder.

  • @parvati-putra
    @parvati-putra 2 роки тому

    process started but not finishing ......please solve this problem

    • @CodeVault
      @CodeVault  2 роки тому

      Hmm... I can't know what's wrong with just this information. Where does it hang?

    • @parvati-putra
      @parvati-putra 2 роки тому

      @@CodeVault after creating s c compiler as shown in the video. we are unable to give any input in run time
      only hello world type program works that means if any scanf function is present notepad console hangs there itself

    • @CodeVault
      @CodeVault  2 роки тому

      @@parvati-putra Odd... I added in the description a different script you can run. Maybe that will work?

    • @parvati-putra
      @parvati-putra 2 роки тому

      @@CodeVault yes sir i tried that too but the same problem!!

  • @EnricoPanebianco
    @EnricoPanebianco 4 роки тому +1

    @CodeVault good evening, I would like to know from you with greater clarity; given my little programming experience, what use this script is, summing up in a few words.
    npp_save
    cd "$(CURRENT_DIRECTORY)"
    cmd /c gcc -o "$(NAME_PART).exe" "$(FULL_CURRENT_PATH)" && "$(NAME_PART).exe

    • @CodeVault
      @CodeVault  4 роки тому +2

      First line is for saving the current file. Second one just changes the current working directory to be the directory of the current file. Then the last one simply compiles the current file to a file that's named the same but with .exe extension.

  • @andrewduggan9525
    @andrewduggan9525 3 роки тому

    I can't get it to run, I save the file and all that and it says that it can't find the file. Any ideas?

    • @CodeVault
      @CodeVault  3 роки тому

      Odd, are you using the same execution code? Can you paste it here?

    • @andrewduggan9525
      @andrewduggan9525 3 роки тому

      @@CodeVault I followed the steps in the video exactly; it did work the first time, but hasn't since

    • @CodeVault
      @CodeVault  3 роки тому

      Hmm.. interesting. Make sure you're saving the file somewhere on your system as Notepad++ can retain unsaved files indefinitely

  • @av1at0r85
    @av1at0r85 Рік тому

    How'd you get the system properties?

    • @CodeVault
      @CodeVault  Рік тому

      Control Panel -> System -> Advanced system settings (somewhere on the right)

  • @rohankulkarni7081
    @rohankulkarni7081 3 роки тому

    Why does it take so much time to give the result of the code?

    • @CodeVault
      @CodeVault  3 роки тому

      It's just how much it takes to compile and run... C and C++ is notorious for slow compile times

    • @rohankulkarni7081
      @rohankulkarni7081 3 роки тому

      @@CodeVault Ok thanks

  • @phungphamvan454
    @phungphamvan454 3 роки тому

    thanks for video, it 's help full. Now i can compile C in notepad++ that 's wondenful

  • @nievalesterloydp.7399
    @nievalesterloydp.7399 2 роки тому

    Thank you Sir!

  • @tthai586
    @tthai586 4 роки тому

    Hey CodeVault, it seems the script that is using MinGW didn't stop when the compiling process hits a syntax error, but it would go on with the execution process as if no syntax errors were found! You can re-create a simple test by taking out a semicolon at the end of any statement (let say we do "return 0" rather than "return 0;"). In this case, the compiling process shouldn't go any further when it hits a syntax error. Please fix and update the script. Thanks!

    • @CodeVault
      @CodeVault  4 роки тому +1

      I figured it out. Try this script instead:
      npp_save
      cd "$(CURRENT_DIRECTORY)"
      cmd /c gcc -o "$(NAME_PART).exe" "$(FULL_CURRENT_PATH)" && "$(NAME_PART).exe"
      Without running the command "cmd /c" each command line is ran completely separate, so there's no way of checking. Similarly with the Visual C one.

    • @tthai586
      @tthai586 4 роки тому

      @@CodeVault It works! Very happy & Thank you so much for your help.

  • @swathisb6210
    @swathisb6210 3 роки тому

    Were we will get system properties.i am unable to find it.plzz rply

    • @CodeVault
      @CodeVault  3 роки тому

      Try right clicking on the start button, there should be a settings option there

  • @zabiarayyan7056
    @zabiarayyan7056 4 роки тому +2

    maybe next time show your full screen. I don't know how you got your system properties menu.

    • @CodeVault
      @CodeVault  4 роки тому +1

      Ah, my bad, just search for "environment variables" on the start menu and it should get you there.

  • @nerianeria1
    @nerianeria1 4 роки тому

    How do you compile multiple files? For axample h. Files and cpp files

    • @CodeVault
      @CodeVault  4 роки тому +1

      Header files (.h) you simply include in your source files (.c/.cpp). If you have multiple source files you could either expand the gcc command with more .c/.cpp files or use make/cmake for creating a script that compiles everything for you.
      Something along the lines of:
      gcc -o main.exe main.c src_print1.c src_print2.c

    • @nerianeria1
      @nerianeria1 4 роки тому

      @@CodeVault Thank you so much!!!

  • @teddysan9921
    @teddysan9921 3 роки тому

    where did you find system properties window

    • @CodeVault
      @CodeVault  3 роки тому

      On Windows 10 it's a bit more cryptic:
      Right click on "This PC" -> Properties -> (on the left sidebar) Advanced System Settings

  • @jellyfish1772
    @jellyfish1772 3 роки тому +1

    Please make one for both c and c++

    • @CodeVault
      @CodeVault  3 роки тому

      You should be able to use the exact same thing just g++ instead of gcc when compiling.

  • @abhignaconscience358
    @abhignaconscience358 3 роки тому

    Please make a video on c++ also...in notepad++

    • @CodeVault
      @CodeVault  3 роки тому

      It's basically the same thing. Just use g++ instead of gcc

  • @ahmedbaha9199
    @ahmedbaha9199 4 роки тому

    Le système ne peut exécuter le programme spécifié
    svp aide

    • @CodeVault
      @CodeVault  4 роки тому +1

      This might have to do with your antivirus settings

  • @oiverarmandoch
    @oiverarmandoch Рік тому

    muchas gracias

  • @zekaka7
    @zekaka7 4 роки тому

    Hi, does anybody have a problem with "Operation did not complete successfully because the file contains a virus or potentially unwanted software." when trying this? I believe this Windows + MinGW combination problem, not Notepad (7.8.1) specific; versions are Windows 10 (Version 1909, OS build 18363.900), Mingw32-gcc-bin 9.2.0-1 ; BR

    • @CodeVault
      @CodeVault  4 роки тому

      Odd... Looks like Windows Defender is at fault. Try disabling real time protection and see if that makes it work.
      I think it sees the compiled executable as a threat.

    • @zekaka7
      @zekaka7 4 роки тому

      @@CodeVault Hi, yes it looks like WIndows Defender, Virus & threat protection "feature, not bug". Way out is a) disable "Real-time protection" or better b) add "Exclusion folder" where exe is created. It is same behavior in shell and Notepad and VSCode, but not for example in CodeLight IDE (which I think also use MinGW). BTW, thanks for all these simple and great videos

  • @emanuelh.a8492
    @emanuelh.a8492 4 роки тому

    Te llevas un zukulentoh like..!! Thanks a lot bruh..!!

  • @Edvs3261
    @Edvs3261 4 роки тому

    "new 1.exe"
    ; about to start a child process: ""new 1.exe""
    CreateProcess() failed with error code 2:
    The system cannot find the file specified.
    I got this on the console, I guess it should be something about the path????

    • @CodeVault
      @CodeVault  4 роки тому

      Did you save the file? And did it compile successfully?

    • @Edvs3261
      @Edvs3261 4 роки тому

      @@CodeVault well, no, I didn't. I deleted it and I executed a c file (coded on VSCode) with NppExec and the compiler didn't work well. However, when I run the same code on VSC it works fine, so I guess I did something wrong. I usually use VSC to code python because is very easy-to-use, and it works fine coding c on it.

    • @CodeVault
      @CodeVault  4 роки тому

      Hmm, you need to save it, otherwise the compiler doesn't know where the file is (even if it exists in temp). You can certainly compile/debug/execute C code in VSCode too, there's a video I made on this topic: ua-cam.com/video/N5GhV8K8DIc/v-deo.html

    • @edgarcalochcampos1930
      @edgarcalochcampos1930 4 роки тому

      @@Edvs3261 Hey man, could you solve the problem? I'm getting the same error and I think I did everything as explained xd

    • @edgarcalochcampos1930
      @edgarcalochcampos1930 4 роки тому +3

      Well I kinda solved it, I just saved my .c file in C:\MinGW\bin

  • @amishapandit6333
    @amishapandit6333 4 роки тому

    im not getting the C:\MinGW\bin

    • @brin4263
      @brin4263 4 роки тому

      Either manually find it in ur c drive or u haven't installed it yet

  • @Riku_u
    @Riku_u 4 роки тому

    amigo, se que hablas español, hazlo porfa :(

  • @AlanRWynne
    @AlanRWynne 2 місяці тому

    Thanks for the video, did exactly what you said, but am getting the error: C:/GCC/bin/../lib/gcc/x86_64-w64-mingw32/14.1.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot open output file g++.CharacterArrays.exe: Permission denied

    • @CodeVault
      @CodeVault  2 місяці тому

      There are some issues with permissions. I can't say for sure. But trying to run Notepad++ as admin might fix things