I've read http://dinosaur.compilertools.net/bison/bison_5.html#SEC25. But following those instruction i can not compile my yacc file using bison
How do i compile my file in windows 7 ... ?
Please help me to do this.
There is a common reason why bison will not operate properly on Windows and is mentioned in the install instructions but often overlooked. It is important that the name of the location of the directory that bison (and flex) is installed in (the path) does not contain a space. in particular this means that it cannot be placed under C:\Program Files\. The problem is that this directory might be suggest as the default install location. It is sometimes necessary to manually change the default to somethings else (like C:\GnuWin\ or similar). It is also usually necessary to manually add the appropriate directory to the PATH environment variable. Once this has been done there should be no problems in running bison and flex from the command prompt. It would normally be used in the following way:
flex lang.l
bison lang.y
gcc -o lang.exe lang.tab.c -lfl
It is not necessary to install MinGW, Cygwin or use Powershell or a VM or use linux as indicated by #DavidHefferman
If you still can't get it right, I even have an instructional video!
Using those Unix commands in Windows PowerShell might work, but I'm not sure and I'm currently not on Windows, so I can't check it.
If that fails you could try installing Cygwin (a basic Linux environment in Windows). You'd have to select the bison package during installation. It comes with its own shell that you can use.
Actually my personal favorite when programming under Windows is setting up a virtual machine with VirtualBox. That way you could use a real Linux environment without actually leaving Windows.
Good luck!
Related
It seems there are several times when running the sdl2-config script bundled with SDL2 would be useful (such as checking which libraries need to be linked to). But it doesn't seem possible to run this script natively on Windows.
I'm using I've been using mingw for all my C compiling needs so far, if that helps. Is there any way I can run this script on Windows?
Yes, sure!
However, that script is just a Bash script, so you need to install Cygwin which has Bash built in. It is not recommended to use the native (Win10) port of the Bash shell, since it is not behaving as expected.
If you don't already have it installed, then the tricky part is how to install SDL2 using Cygwin. IMHO, that should probably be avoided, as it tend to cause a lot of weird problems (for other packages).
However, there is already a Cygwin package if you want to try it.
apt-cyg install mingw64-x86_64-SDL2 libSDL2-devel libSDL2_2.0_0 # etc
I need to install Primer3 for my research in Windows, and I really have no idea of how to go about it. I was following the instructions mentioned here.
I'm getting to the part where I need to run
mingw32-make TESTOPTS=--windows
and I keep getting an error saying:
'mingw32-make' is not recognized as an internal or external command,
operable program or batch file.
Just for reference, I went into the minGW Installation manager and got the ming32-make packages, including the bin, doc, lang, and lic ones, because I really had no idea which one was the correct one.
If someone could help me, I would be very grateful! Installing these niche programs without an installation wizard is a challenge!
You will need to install mingw32-make. This is a
Windows of port of GNU Make,
a software-build tool that is supported on all operating systems,
indeed the daddy of such tools.
But make alone will not suffice. To build primer3 you will
need a Windows port of the whole GNU toolchain for building software
from source code. Without that, running make by itself will
just expose the absence of the GCC compiler and linker that it
expects to do its bidding.
This is quite a lot of software, but it is easy and quick to install and there
are several open-source offerings. I suggest you go to TDM GCC
and download the TDM64 bundle. This will give you an executable installer.
Just run it and you will end up with the complete GNU toolchain, including,
mingw32-make, in your chosen installation directory.
It will also install in your Windows launch menu the MinGW command prompt.
Launch this and you will be presented with a Windows commandline console
with its environment set up to find and run any of the GNU tools.
In this console change directory to your primer3-X.Y.Z/test directory
and then run mingw32-make TESTOPTS=--windows as per documentation.
Be forwarned that the self-tests of primer3 that are executed to
verify the build may take 1/2 hr. to 1 hr. to run, depending on your
hardware, but they will finish successfully with the steps I've
described, barring problems specific to your machine. It is a foolproof-simple build.
All the built executables are deposited in the primer3-X.Y.Z/src
directory. You may want to move them somewhere more convenient
in in your PATH.
It does seem oddly amateurish that the documentation simply
directs you to run mingw32-make with no preliminary account of
what that is or how to install it, while on the other hand it
advises that you must install perl and strongly recommends a
specific perl distribution; but evidently primer3 is open-source
scientfic software and its documentation is not bad by the standard
of that genre.
When trying to build a library from source using make and MinGW, I realized (from errors) that I don't have the install command, which I understand to be a combination of cp, chown, chmod, strip, and maybe some other stuff. I figured, hey, someone's got to have a copy of that out there, right? But unfortunately the name of the binary makes it near impossible to search for with any search engine.
Does anyone know of an existing MinGW-compatible version of install?
If you are running MinGW as a cross-compiler, hosted on Linux, (as your question title might be construed to imply), the native /usr/bin/install on the Linux host itself serves admirably; (FWIW, this is exactly how my own MinGW development platform is set up).
OTOH, if you really mean "where can I find a Linux-like install utility to accompany MinGW running on MS-Windows?", then (as Diego notes) you will find it among MinGW.org's MSYS tools; running mingw-get install msys-base will install it for you, (assuming you are using mingw-get to manage your MinGW installation).
I have installed Cygwin on my system. But when I try to use the gcc command it says:
bash: gcc: command not found
Can anyone provide me the solution, please?
In my installation there was no generic gcc command either, so I made a symlink for it:
cd /usr/bin
ln -s i686-pc-cygwin-gcc-3.4.4.exe gcc
Now check if it worked by doing which gcc which should give you /usr/bin/gcc and then gcc should give you gcc: no input files. Note that your version of i686-pc-cygwin-gcc-3.4.4.exe may be different. Check in /usr/bin for it.
Maybe during installation of Cygwin you have not selected gcc, gdb and make packages.
I had the same problem and it was resolved after I selected above-mentioned packages.
A couple of things:
I always install the whole Cygwin package. Earlier versions had troubles with dependencies that are fixed now, I believe, but it's still a good habit. You never know when you may need the most esoteric bit of Cygwin.
You may have to change your path. All the tools can generally be found okay if you're running inside the Cygwin bash shell but that's not necessarily the case from cmd.exe.
It's unlikely to be that last one since your error message is coming from bash itself, so I'm pretty certain that's how you're running it.
Have a look to make sure you have /usr/bin/gcc from within bash and that your path includes /usr/bin somewhere:
pax> echo $PATH
/usr/local/bin:/usr/bin:/bin:/cygdrive/c/WINDOWS/system32:/cygdrive/c/WINDOWS
pax> which gcc
/usr/bin/gcc
If it's not there, go back and re-install everything (or the relevant development package if you don't want everything). If it is there and your path doesn't have its location, change your path, in either /etc/profile or the equivalent in your home directory.
Another related issue that wasn't mentioned here, is from the command line the compiler needs the environment path variable updated to find the location of the c++ header files. In windows you can just update the path environment using the 'advanced system properties' GUI and add the location of the c++ include files. This will update the PATH environment variable in Windows cmd & Cygwin automatically upon restarting the shell.
To update your PATH from Linux or the Cygwin shell type... PATH=$PATH:/your_path_here Example:PATH=$PATH:/cygdrive/c/cygwin/lib/gcc/i686-pc-mingw32/4.7.3/include/c++ Also a good idea to add just the include directory as well: PATH=$PATH:/cygdrive/c/cygwin/lib/gcc/i686-pc-mingw32/4.7.3/include/ ...or check the proper directories for the location of your installation's include files, I recommend installing mingw for use with Cygwin, which is envoked with g++.
To install additional needed packages in Cygwin re-run the Cygwin install utility & check install from Internet to add packages from web repositories and add mingw-gcc-g++ & mingw-binutils. To compile your code: g++ hello.cpp -o hello
If using the gcc utility instead compile with the command: gcc hello.cpp -o hello -lstdc++ ... to get your executable.
As long as you have either gcc or mingw installed and the path to the c++ include files is in your path environment, the commands will work.
There is another hard to spot mistake could also cause this error,
If your Makefile uses PATH as variable, the gcc not found error could happen.
This is because it changes the system path temporarily.
I took a lot of time checking the cygwin environment setting to discover this, so I'll leave it here in case this helps anyone finding their way here.
I've installed cygwin environment on Windows.
There is gcc 4.3. How to install gcc 4.4 in this environment?
The alternative is to build one yourself, but it will be extremely slow on cygwin. If you are a Linux user, you can build a native compiler (which runs in cmd.exe on windows, and produces native win32 binaries) on Linux. It is much faster (order of magnitude faster in my experience).
Otherwise, mingw is a good solution, although in my experience, the binary from equation.com work better for gcc 4.4 (there is no official gcc 4.4 from MinGW yet)
If you don't need the cygwin environment for special reasons, I'd go for Mingw with the gcc 4.4. You can find builds on: http://www.tdragon.net/recentgcc/.
Reading the MinGW FAQ, reveals that its possible to pass requests to use the MinGW binaries instead of the ones shipped with Cygwin.
For those who would like to use the Cygwin environment for development, yet generate non-Cygwin-dependant executables, a much easier option to "-mno-cygwin" does exist. Simply install Cygwin and the MinGW distribution in separate directories (i.e. "C:\CYGWIN" and "C:\MINGW"), and make sure that the "/bin" subdirectory beneath your MinGW installation comes before Cygwin's "/bin" subdirectory in your PATH environment variable (i.e. "PATH=%PATH%;C:\MINGW\BIN;C:\CYGWIN\BIN"). This will allow you access to all the UNIX tools you want, while ensuring that the instance of GCC used is the MinGW version. %%%
Bear in mind that within the "/etc/profile" file, Cygwin by default places "/usr/local/bin", "/usr/bin", and "/bin" ahead of your system-level PATH. Therefore, it is not enough to have the MinGW's "/bin" ahead of Cygwin in your Windows path... it must also be set to come first within the Cygwin environment (either by modifying "/etc/profile" or setting it manually).