QScript is a language to script market research questionnaires for data entry.
On windows qscript requires the MinGW C++ compiler, and the MSYS environment, GNU bison and flex. This document is a step by step guide explaining how to install the required components on Windows and how to compile and install the qscript compiler.If you get stuck at any stage, or you believe the documentation is not clear please email me - NxD_in@yahoo.com The installation involves the following major steps:
set PATH=%PATH%;"c:\Program Files\7-zip";This is assuming that the self exracting exe has installed 7z into c:\program files\7-zip. Note that the double quotes above is required as there is a space in Program Files
The url http://www.mingw.org/wiki/Getting_Started has clear instructions for installing the MinGW-gcc compiler.
When you run the installer it will ask for a directory for installation - it suggests MinGW. You can change the default directory if you want, but please make sure that there are no spaces in the directory names. For example Mingw-foo will do but "Mingw foo" will not work.
Choosing install directory mingw installer
Choosing components to install: Note that the gcc c compiler is installed by default, please also tick the C++ compiler and the MSYS base system which is below. Please have a look at the screenshot below
For the discussion below, I assume that you have installed to c:\MinGW. Once the install is done (i.e. after you have resolved any errors you had by re-installing the same path and faced no errors in the repeated install), add c:\MinGW\bin to the path variable. You should be able to now run gcc -v, g++ -v at the command prompt and see version and build info. Screenshot below.
/* helloworld.c -------------------------------- */ #include <stdio.h> int main() { printf("Hello,World\n"); return 0; }
// helloworld.cpp // ---------------------------------- #include <iostream> int main() { std::cout << "Hello,World from C++" << std::endl; } // ------------------------------------
Compile command
> gcc helloworld.c output a.exe running a.exe -> Hello,World del a.exe > g++ helloworld.cpp output a.exe running a.exe -> Hello,World from C++Please find a screenshot below:
I downloaded the file pdc34dllw.zip - which supports wide characters. Here I am going to put the libraries in c:\usr\lib and the include file in c:\usr\include - this is their standard locations under unix/linux. Please use run the following commands, if you choose another directory you will need to modify the directories in the make file. I will point this out.
# You can ignore the 2 commands below if you are going to use some other tool to extract the files from the zip file. I will explain the mingw-get command later in step 4. # All you have to do is extract the files into a convenient directory c:\Mingw-foo6 > set PATH=%PATH%;c:\MinGW-foo6\bin;c:\MinGW-foo6\msys\1.0\bin c:\Mingw-foo6 > mingw-get install msys-unzip c:\Mingw-foo6 > cd \users\windows-7\Downloads cd \users\windows-7\Downloads > mkdir temp c:\users\windows-7\Downloads > cd temp c:\users\windows-7\Downloads\temp > unzip ../pdc34dllw.zip c:\users\windows-7\Downloads\temp > mkdir c:\usr c:\users\windows-7\Downloads\temp > mkdir c:\usr\include c:\users\windows-7\Downloads\temp > mkdir c:\usr\lib c:\users\windows-7\Downloads\temp > copy *.h c:\usr\include c:\users\windows-7\Downloads\temp > copy pdcurses.* c:\usr\libPlease have a look at the screenshot below.
For those who are interested in details, read this paragraph, others please skip to Step 4. Actually there is a pdcurses library which is distributed with MinGW, however i was not able to get dynamic libraries i.e. dlls working and so am relying on static linking. The original Step 3 is at the bottom of this document for those interested in installing the msys-pdcurses.
Before we go to this step, a caveat. mingw-get is the command line tool that is used to install various components of the mingw/msys system. Sometimes if mingw-get is invoked incorrectly, it will try to rename itself - this is how it tries to update to a later version, while the current version is running. Please refer to the MinGW website and mailing list for more details. Here I am showing the commands required to restore things back to normal. Note that the directory I have installed happens to be c:\Mingw-foo5, but this need not be the directory that you have installed MinGW.
Please see the 2 screenshots below to do the renames, should you type in the mingw command incorrectly. If you type in mingw-get a second time and get "command not found", this is a clear indicator that something went wrong with the previous invocation of mingw-get and you need to do the renaming exercise as shown in the screenshots below.
c:\mingw-foo5\bin > .\mingw-get.exe install msys-bison
Screenshots for installing bison are below. I have included 2 screenshots, because you may see a lot of catalog files being displayed on the screen, and this is part of the install process, so no need to panic. Again as mentioned earlier, should any file fail while downloading, please run the command again. mingw-get will download the components the failed the first time and install them.
c:\mingw-foo5\bin > .\mingw-get.exe install msys-flex
Screenshots for installing flex
c:\Mingw-foo6 > set PATH=c:\MinGW-foo6\bin;c:\MinGW-foo6\msys\1.0\bin Now test that the msys commands are being picked up from the path c:\Mingw-foo6 > ls --colorPlease see the screenshot below.
Note that the command is C:\Users\windows-7\Programs\qscript-0.7 > make -f CustomQScriptMakefile.Win32 local_install
C:\Users\windows-7\Programs\qscript-0.7 > ls bin lib
Make sure that the PLATFORM is set to WINDOWS and NCURSES_LINK_LIBRARY_NAME is set to pdcurses. Otherwise you will get link errors after the compiler has generated the code and tries to link the files together.
Thank you. Enjoy!
Neil.
Step 3: Installation of the pdcurses library. For this we need to run mingw-get by hand.
c:\mingw-foo5\bin > .\mingw-get.exe install mingw32-pdcurses
Screenshots are below. I have included 2 screenshots, because you may see a lot of catalog files being displayed on the screen, and this is part of the install process, so no need to panic. Again as mentioned earlier, should any file fail while downloading, please run the command again. mingw-get will download the components the failed the first time and install them.
c:\mingw-foo5\bin > .\mingw-get.exe install libpdcurses-dev
Screenshots are below.