How to compile pascal file without IDE - cmd

I need to compile .pas without IDE on Windows.
How can I do this via cmd?

You can't compile code without a compiler. A compiler is software that compiles code. There is no compiler built into CMD.EXE

Unfortunatly I can't found the compiler therefore I download TurboPascal. I write my code in Sublime Text then I open CMD and use fpc *filename.pas* command.

Related

How to change 'make" command settings to compile C++ code on mac os

I started programming in C++ on my mac.
So far, I just write my code in a text editor (Sublime), and run it from terminal using the 'make file.cpp' command and then run it with './file.cpp'.
It worked until now, but with more elaborate code I get an error that my C++ version has to be at least C++11.
So I was wondering how to change the parameters of the 'make' command to be able to change the C++ version compiled in C++14 for example.
I understand that using 'makefile' is easier, but is it still possible to change the 'make' parameters?
Thank you very much

How to compile a file as c++ in flex windows?

I am using "flex windows(lex & yacc)" in windows 7 32 bit, where the lex programs can be compiled, built and run by automatic call on command prompt, using some tools. But by default, it compiles files as c...which i want to change so as to compile as c++. is there any way to do that without using any cmd command?
Be aware that flex is a C or C++ code generator. And so is bison. They both emit some C++ (or C) code from some other kind of input.
So, compile on the command line. BTW, all C++ compilers I heard about are command line programs.
is there any way to do that without using any cmd command?
In practice, code your Makefile to drive flex, bison, g++ or clang++ (or any other C++ command line compiler you have). Then you'll just build your program using make -and you could and probably should configure your IDE or source code editor (e.g. emacs or Visual Studio Code, etc...) to build your program that way (maybe with a single mouse click or a single keypress).
Or use some other build automation tool. For example, ninja.
How to configure your IDE or editor is of course specific to that editor. I am using emacs (on Linux) and my ~/.emacs configuration file contains:
(load-library "compile")
(global-set-key [f12] 'recompile)
So I simply compile by pressing the F12 key. That fires a make process.

Compiling MatConvNet on Windows

I am trying to compile MatConvNet on Windows 8.1. Since it seems that I need to use the "Makefile" to do that, I downloaded GNUWin Make, which allows to use the make command on Windows. The error I get is the following one:
process_begin: CreateProcess(NULL, C:\Program Files\MATLAB\R2014a\bin\mexext, ...) failed.
while the file C:\Program Files\MATLAB\R2014a\bin\mexext.bat exists.
Do you have any clue on that please?
I also tried to compile MatConvNet on Windows with MinGW and I faced the same error.
Instead, you can try to compile MatConvNet using Visual Studio. It is explained here:
http://blog.csdn.net/zxd675816777/article/details/40075209
With the translation from Chrome browser, it is understandable :)
Thanks to this tutorial, I successfully generated the 4 mexw64 files needed by MatConvNet.
in the new beta-8 we have added new function vl_compilenn which supports compilation on Windows... (no need for Make, plus we've fixed the issues related to msvc compiler). So far it seems to work also for the GPU code...
You can find detail here. Hope that this would help :)
You need to compile it using Visual Studio rather than GNU compiler on Windows. First set up Matlab mex -setup C++ for Visual Studio 2013/2015 and then compile using vl_compilenn function. If you want to compile it for GPU then you need to install CUDA and cudnn as well. Then you can use vl_compilenn('enableGpu', true) to compile it for Windows with GPU support.

How can I compile C++ code with GCC compiler?

I wrote C++ code in notepad and want to compile with GCC compiler. Is GCC compiler a program? from which site I can download it? I don't have any information about it. What can I do?
You can start by downloading Code::Blocks, its an cross-platform IDE that can be downloaded including MinGW GCC compiler.
http://www.codeblocks.org/
But if You're using Linux you can use just a "gcc" command in the terminal.
GCC is a program. if you have linux its probably installed. to chek just type in the console line gcc. if you get a out put with the syntax - it's installed else - type the command that's suggested. in order to compile something type:
gcc <file name>
it will create a .out file that you could run from the console line.
for more info type:
man gcc
You can also use C-free 5.0 which is small and can use many compilers. Small ide. You just need to make it automatically choose the library and inclue paths.
If you're on Windows you can try one of ports: mingw.
If you're on Linux, you probably have it installed (try gcc --version) or at least available from repository (check your distributions "installer").
There is also a number of (free) IDEs that you can also get and use them instead of notepad. Google for Eclipse/CDT, Netbeans, code::blocks, etc.

Trying to compile and debug C++ from Vim

I've been learning C++ and Allegro using Code::Blocks on Windows XP, and recently felt like learning Vim. However, I have no idea how to compile a program "manually" (i.e., without using an IDE).
For compiling from within Vim, I have gotten as far as setting the makeprg to gcc, but I understand I also need a makefile. What is that and how do I write one? Is it with the makefile that I can use libraries such as Allegro?
Also, I've gotten quite fond of the CB debugger (I'm using gdb). Is it possible to do something similar with Vim?
Thank you.
Look at MinGW. I would avoid Cygwin if you only need gcc and make. You'll want both MinGW and MSYS. MSYS has a windows port of make.
If you're interested in more unix utlities for the windows command line I recommend CoreUtils.
For learning make see the manual
You don't necessarily need a Makefile, but it's the preferred (and possibly sanest) way of compiling code on UNIX-like systems.
I don't know if GNU Make has a Windows port, but you can probably run it under Cygwin.
To learn more about GNU Make and Makefiles:
make (Wikipedia)
GNU Make
GNU Make Manual
Also, see this question: compile directly from vim
Mandatory edit: I don't use Windows or Cygwin. You might want to take epochwolf's advice on that department.
I'm not in expert in makefiles and debugging but I know that Vim lets you do many things.
For example if you want to compile a file with gcc, it's not very different from the usual way. In normal mode type:
:!gcc file.c -o file
In fact you can use (almost) every system command just by adding "!" in front of your command.
gdb also works with Vim
:!gdb
I hope it will help you.
To integrate vim with devenv, you can use devenv from Visual Studio to complie the project in vim. The command as follows:
Devenv SolutionName /build SolnConfigName [/project ProjName [/projectconfig ProjConfigName]]
Typicatlly, the devenv should located in C:\Program Files\Microsoft Visual Studio 8\Common7\IDE. Set it to the path of environment to make it callable from vim. We also need to make vim recognize the error messages thrown by the commandline build tool devenv. Just put the following lines in your vimrc:
" Quickfix mode: command line devenv error format
au FileType cpp set makeprg=devenv.com\ /Build\ Debug\ *[SolutionName]*
au FileType cpp set errorformat=\ %#%f(%l)\ :\ %#%t%[A-z]%#\ %m
Then You can use :make to compile and build the program from vim.
EDIT1: A few bookmarks you might find useful:
GNU make tutorial (this one uses gcc and make, so it should be right up your alley)
Another one
Win port of some of GNU utils Can was mentioning; I personally use these and haven't had any problems with them on Windows platform.
Yes, you can compile without the makefile. If your program is simple (for example, one file only) you can compile by calling the compiler and including the name of the program in the same line (don't remember how it goes with gcc). Of course, to make things easier this can be mapped to a key within vim, so you don't have to jump to command prompt and back.
If you are working on a bigger project, which consists of several files and such, than a makefile is useful. It will "search" through the files, determine dependencies, include them in the build, maybe put the source files in one directory and the resulting exe file in the other and such. So it is more of a linking and building system than just compiling.
Although the GNU make mentioned in Can Berk Guder's answer is a popular one, there are quite a number of other tooks for "building makefiles" ("makefile" has become a type of synonym for that kind of operation) - here, you can see some other options on this link. Due to its part in history vim has good support for :make, but others can be easily used as well (there are a lot of texts on this subject on VimWikia.
Well, that's it. Just my 0,2 euros :)
As long as you have GNU-make installed (with cygwin or mingw under windows), you don't need to write a makefile for single-file projects. Just run :make from vim, and that's enough.
If your project is made of several files, then you will have to write a makefile (or any equivalent for scons, aap, (b)jam, ant, ...), tune your &makeprg in consequence, and finally call :make from vim. See the relevant category in vimtips. You can of course run the compiler as you would have ran any other external tool, but you would loose the possibility to jump to the line(s) of the error(s).
NB: if you are using the win32 version of vim, and gcc-cygwin, you'll need to translate the error messages obtained. I used to maintain a perl script for this purpose, it is now part of a bigger suite (still in beta stage)
Regarding your question about debugging, it can't be done from vim under windows for the moment. The only debugger that can be integrated so far is gdb, but under linux only ; see the pyclewn (.sf.net) project.
I'm not sure about debugging, but I know an easy way to compile and run the current program as I wrote a small vim plugin to do so.
http://pastebin.com/qc5Zp2P7
It assumes you are using the g++ compiler. If not, just change the name to the compiler you're using. Save this file to whereveryouinstalledvim/ftplugin/cpp.vim
In order to compile and run the currently open program, just type shift-e while in non-editing mode.

Resources