views:

867

answers:

7

I haven't done C in a long time. I'd like to compile this program, but I have no idea how to proceed. It seems like the makefile refers to GCC a lot and I've never used GCC.

I just want an executable that will run on windows.

+4  A: 

If it requires gcc and you want it to run on Windows, you could download Cygwin.

That's basically an emulator for GNU/Linux type stuff for Windows. It works with an emulation DLL.

http://www.cygwin.com/

m0j0
This is not good advice. Someone who runs windows and has never run gcc doesn't want cygwin. He wants a compiler, not a Unix-like environment. Direct him to mingw, not cygwin.
jmucchiello
If they have an existing Makefile designed for a UNIX environment, and they just want to build something, then Cygwin would work fine. I stand by my answer.
m0j0
+3  A: 

You almost certainly don't need all of cygwin to compile using gcc. There are plenty of standalone gcc clones for Windows, like gcw.

Jekke
This thing looks abandoned. MinGW seems a better option...
Malkocoglu
+9  A: 

You may need to install either cygwin or mingw, which are UNIX-like environments for Windows.

When downloading/installing either cygwin or mingw, you will have the option of downloading and installing some optional features; you will need the following:

  • gcc (try version 2.x first, not 3.x)
  • binutils
  • GNU make (or gmake)

Cheers, V.

vladr
+3  A: 

If it's reasonably portable C code (I haven't looked at it), then you may be able to just ignore the included Makefile and feed the source into whatever compiler you do want to use. What happens when you try that?

Greg Hewgill
I don't have a C compiler.
AngryHacker
I see. In that case, if it's already got a Makefile for gcc, then install Cygwin or MinGW and compile it using those tools.
Greg Hewgill
+4  A: 

In order to compile this program you need a C compiler. It does not have to be gcc, although you are already given a makefile set up to use gcc. The simplest thing for you to do would be the following:

  1. Install cygwin
  2. Open the cygwin command prompt
  3. go into the directory where you have your makefile
  4. type 'make'
  5. That should compile your program

If you are not comfortable with using command line tools then you can download the free version of MS Visual Studio and import the source files into a new Visual Studio project. This way you would not need to install cygwin and use gcc, but you would need to know how to create projects and run programs in Visual Studio.

Dima
And you might need to do some porting, if the code is using UNIX-specific system calls or include files such as unistd.h.
m0j0
+1  A: 

Dev-C++ provides a simple but nice IDE which uses the Mingw gcc compiler and provides Makefile support. Here are the steps I used to build the above code using Dev-C++ (i.e. this is a "how-to")

After downloading the source zip from NIST, I

  • downloaded and installed the Dev-C++ 5 beta 9 release
  • created a new empty project
  • added all the .c files from sts-2.0\src

Then under Project Options

  • added -lm in the Linker column under Parameters
  • added sts-2.0\include to the Include Directories in Directories
  • set the Executable and Object directories to the obj directory under the Build Options

and then hit OK to close the dialog. Go to Execute > Compile and let it whirl. A minute later, you can find the executable in the sts-2.0\obj directory.

ctuffli
A: 

First, there is little chance that a program with only makefiles will build with visual studio, if only because visual studio is not a good C compiler from a standard POV (the math functions in particular are very poorly supported on MS compilers). It may be possible, but it won't be easy, specially if you are not familiar with C. You should really stick to the makefiles instead of trying to import the code in your own IDE - this kind of scienfitic code is clearly meant to be compiled from the command line. It is a test suite, so trying things randomly is NOT a good idea.

You should use mingw + msys to install it: mingw will give you the compilers (gcc, etc...) and msys the shell for the make file to run correctly. Contrary to one other poster, I would advise you against using gcc 2 - I don't see any point in that. I routinely use gcc 3 (and even 4) on windows to build scientific code, it works well when the code is unix-like (which is the standard platform for this kind of code).

David Cournapeau