Compile C code for Windows 64 [closed]
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this questionI haven't touched C for years but need to compile some C source code for Windows 7 64. The source comes with a makefile. Can someone please recommend a C compiler with make?
PS:
The make file:
POSTFIX="_amd64"
CC = CC="cc -Wall"
RANLIB=RANLIB="ranlib"
INSTALLDIR=/usr/local/bin
LIBINSTALLDIR=/usr/local/lib
VERSION=4.12
DATE=10/10/10
PROGRAMS=bib2xml ris2xml end2xml endx2xml med2xml isi2xml copac2xml \
biblatex2xml ebi2xml wordbib2xml \
xml2ads xml2bib xml2end xml2isi xml2ris xml2wordbib modsclean
all : FORCE
cd lib; make -k $(CC) -k $(RANLIB); cd ..
cd bin; make -k $(CC) -k VERSION="$(VERSION)" -k DATE="$(DATE)"; cd ..
clean: FORCE
cd lib ; make clean ; cd ..
cd bin ; make clean ; cd ..
cd test ; make clean ; cd ..
realclean: FORCE
cd lib ; make realclean ; cd ..
cd bin ; make realclean ; cd ..
cd test ; make realclean ; cd ..
rm -rf update lib/bibutils.pc
test: all FORCE
cd lib ; make test; cd ..
开发者_运维问答 cd bin ; make test; cd ..
install: all FORCE
cd lib ; make -k LIBINSTALLDIR=$(LIBINSTALLDIR) install; cd ..
sed 's/VERSION/${VERSION}/g' packageconfig_start > lib/bibutils.pc
@for p in ${PROGRAMS}; \
do ( cp bin/$$p ${INSTALLDIR}/$$p ); \
done
package: all FORCE
csh -f maketgz.csh ${VERSION} ${POSTFIX}
deb: all FORCE
csh -f makedeb.csh ${VERSION} ${POSTFIX}
FORCE:
Since everyone here is oblivious to your clear 64-bit statement, I'll give a correct answer:
If the makefile is an Nmake makefile, you can install the Visual Studio Express for Windows Desktop, open a command prompt from the start menu (choose the one targetting 64-bit Windows),
cd
to your project's directory, and runnmake
. You'll need to modify the makefile to call cl and link.If the Makefile is a MinGW makefile, you will need mingw-w64's toolchains targetting Win64 (note also 32-bit toolchains are provided). I recommend the official builds provided through an installer or the ones installable from MSYS2 (see point 3). Install, open the MinGW-w64 command prompt,
cd
to your projects directory, and runmingw32-make
.If the Makefile is a Unix/MSYS makefile, I suggest using MSYS2. You can use the above toolchain, or do
pacman -S mingw-w64-x86_64-gcc
to install a toolchain from the MSYS2 shell. Be sure to either add/mingw64/bin
toPATH
or launch from the "MSYS2 MinGW-w64 64-bit" shortcut to use it. Note you can use MSYS2 as a package management tool only: install any dependency you want (there are tons of 3rd party library binaries ready for use) and just add the<MSYS2 root>/mingw64/bin
directory toPATH
and call the compiler from anywhere.If the project uses Unix functionality (like
fork()
or other Unix system calls), you can use 64-bit Cygwin, install its compiler, and link with the Cygwin dll. This is not recommended as there is a performance (well, relative to porting the code to Win32 APIs) and license penalty (The Cygwin DLL is GPL, which forces your program to be licensed in a GPL-compatible way).
These are four ways of compiling a C source file for 64-bit Windows with free tools. If you are a student, you can probably use the following ways as well:
Download Visual Studio Professional from Dreamspark (if your university/college/school has an agreement with Microsoft for this) and use that. Pretty much equivalent to point 1 except if you use stuff like MFC/ATL and/or VS plugins, which don't work in the express version.
Download the Intel compiler from their Education offerings website. Requires Visual Studio Professional from point 5 though. You'll need to modify the Makefile to use the Intel compiler though.
Download the LLVM/Clang compiler from here (the Windows snapshot builds) and use it in conjunction with point 5. You'll need to modify the makefile to call clang.
I know this is more than what you asked for, but my high-rated answers need to be complete, right?
You could use Visual C and look at nmake
see: How to use makefiles in Visual Studio?
You could try MinGW to have makefiles similar to GCC ones.
Have a look at http://www.cygwin.com/
Code::Blocks comes with a built in Mingw environment, which should handle makefiles just fine.
精彩评论