I am trying to compile a simple C program to test that my set-up is correct.
First I typed it with gVim and created a Makefile
Now that I have a main.c and a Makefile, I tried compiling it by using
:make
Then I get this message:
|| 'make' is not recognized as an internal or external command,
|| operable program or batch file.
All of this under gVim.
Then to test that my makefile and make installation is working I opened Cygwin, went to the directory where my main and make files are, typed
$ make
And it compiled fine.
I am not really sure what to do next, I used to be able to run :make from gVim but that was a long time ago and I think I forgot how to set it up correctly.
I also have a portable gVim on my flash drive and on other computers with some other set up I can use
:make
from my own gVim.
All I needed to do was to add the PATH variables.
I feel stupid now.
Related
I have some mex files, which until recently were working perfectly. They require some compiler flags which matlab won't pass using the ordinary mex command, so I've been using a shell script to compile them, accomplished from within matlab using !sh mexfile_compile.sh. This has worked fine for about a year.
I've recently found (with no change to the version of GCC or g++ I have installed), that my files won't compile any more; I get the error sh: 0: Can't open mexfile_compile.sh, even if I run matlab as root.
Interestingly, if I run !ls | grep mexfile_compile.sh on the active directory from the matlab prompt, I get a single result: mexfile_compile.sh.save, though if I run the same command (without the !) in a normal terminal window, I don't get the .save at the end. It's worth pointing out that the script runs perfectly well from the terminal using sh mexfile_compile.sh.
Does anyone know what's going on here or how I can fix it?
Every time I ran an executable installed in the system it's all fine without any prompt, but recently I configured my vim editor to do c++ coding. Every time I build a program using make through vim and want to run the built executable, a pop up shows that this file is an executable and whether I want to execute it??
How do I turn that thing off so that no prompt will annoy me?
edit:
The prompt appears only when double clicking the file outside the vim editor.
using LXDE desktop on debian.
edit:
I noticed that any executable file double clicked in file manager gets the same pop up.
when launching the app through the desktop panel it is fine.
I don't know what you did when you "configured vim to do c++", but you should simply be able to build either with a make file by running :make or with g++ directory by calling:
:!g++ % -o %< # calls gcc filename.ext -o filename
Then in like manner to run the compiled program:
:!./%< # executes ./filename (w/o extension) and without prompting
Are you on ubuntu? If so, try open preference of the file, find behavior options, choose execute it when open.
I just downloaded and started using Vim so I'm still a bit confused with it. I've been watching tutorial videos and I see that I can open Vim by typing vim in command. However when I do it I get
'vim' is not recognized as an internal or external command, operable program or batch file
Did I need to install something else? Also I want to code and compile C in vim, would I need to install a compiler?
You have to invoke Vim (or gvim, the GUI application) with the full path, e.g.
"C:\Program Files\vim\vim74\vim.exe"
The Vim installer doesn't add the location to the PATH. In Windows, you can create a shortcut (*.lnk) in your Start Menu, or re-run "C:\Program Files\vim\vim74\install.exe", which has an option to install batch files to C:\Windows, or manually add "C:\Program Files\vim\vim74" to your PATH via the Control Panel.
Vim is just a (very advanced and powerful) text editor, so it ships with syntax highlighting for most programming languages, but unlike IDEs, it doesn't come with the full toolset of compiler, linker, debugger, etc. You need to separately install that (e.g. mingw, or Microsoft's compiler from the Windows SDK, or any other).
C:\>vim somefile.txt
During Vim (for Win32) install, you have the option to install batch files for launching vim from the command-line.
make sure you install vim properly. (https://www.vim.org/download.php)
On Windows. Don't forget to set the environment variables (simply add \vim\vim**; at the end of the classpath)
Type vim at command line (gvim.exe will start the Graphic user interface software).
If you want to compile and run c program using the command line, you should download the GCC Compiler and follow the same procedure as mentioned before (The classpath thing). Then you can compile C program using gcc command.
I have a project with Fortran and I use gvim as my editor. When I use gfortran as my compiler in my makefile, I encounter no problems. I also have a version of the makefile that uses intel fortran and that makefile also works fine when called from the terminal.
My problem is within gvim. Gfortran version of my makefile works great when called within vim with :make and it shows me the errors and jumps to them etc. However, when I use the ifort version, :make command in vim gives me an error saying he could not find ifort.
ifort works fine from the terminal. I have both ~/.bashrc and /etc/bash.bashrc edited so that it sources intel compilers. I use Crunchbang Waldorf (read: Debian Testing) and I remember having the same problem in LMDE.
Any help is greatly appreciated
Move PATH modifications from .bashrc//etc/bash/bashrc to .profile//etc/profile. This way you won’t need interactive shell like #ib. suggests (and, by the way, you need to do modifications to only one file, not both).
If your distribution uses /etc/env.d it may make sense to do
echo 'PATH=/path/to/ifc/binaries' >> /etc/env.d/99ifort
env-update
. But this should be distribution-specific.
I have installed Vim and MinGW on my machine, so I try to create Hello World then compile in in Vim and everything work fine. However when I type :make it show error 'make' not recognized as an internal or external command.
I already added variable path to C:\MinGW\bin. I want to know how to configure Vim or my machine to allow make command.
Can you confirm that there is a make.exe in C:\MinGW\bin? I seem to remember that last time I installed mingw, it was called mingw32-make.exe.
If there is no make.exe but there is a mingw32-make.exe, you'll have to change the 'makeprg' option:
:set makeprg=mingw32-make
:make