Makefile in Windows VC

Source: Internet
Author: User

A c ++ program can be run on Windows and UNIX. There is a makefile and makefile. UNIX file. How can I compile the program in the VC environment? I'm a newbie. I 'd like to explain the detailed steps as much as possible. Thank you very much?

You cannot compile with VC, and use GCC on win,
It is troublesome to say. paste someone else's tutorial for you:

(1) cygwin/GCC with mingw from: http://dev.csdn.net/article/70/70015.shtm
Cygwin/GCC and mingw are both GCC compiling environments in windows, but what are their differences?
How to select the two compilers.
Cygwin/GCC can be equivalent to GCC in Linux, which can be viewed from the boost Library Division.
Starting out, GCC in cygwin and GCC in Linux use the same toolsets.
Therefore, you can synchronize the GCC version with Linux without worrying about the problem.
Things (without Win32) can be seamlessly used in Linux without any problems. Developed in Windows
A good choice for Linux programs. However, the program compiled in cygwin/GCC must be executed in windows.
Must depend on cygwin1.dll, and the speed is somewhat slow. If you do not want to depend on this thing, you must compile it in GCC
Choose-MnO-cygwin. In fact, the GCC compiler will automatically choose to install
The mingw installed in cygwin/GCC is a cross-Compilation of GCC.
For mingw as an implementation of GCC on Windows, because it is not like the GCC of cygwin on a simulated Linux
Running, while a considerable number of Linux tools are not available, but now there is msys which simulates Unix
Shell can solve a lot of problems, but it is not easy to use cygwin, and the no-cygwin option of cygwin/GCC is
It depends on mingw support, so the update is slower, but now it is only 3.3.3. It can also be upgraded under mingw.
But msys is required. The upgrade method is similar to that in cygwin and Linux. No
However, it seems that my upgrade experience is not smooth. I have no time to perform the in-depth tests.
It also allows the latest installed GCC of cygwin to support no-cygwin. You need to perform cross-compilation again, but I do not
I will do it. I have to forget it. Well, maybe I will fix it that day and open another post.
According to the above analysis, if you develop a Linux program in windows, cygwin is a good choice. If you develop
If the program does not mind a cygwin1.dll, you can also choose cygwin. If you want to develop Windows
The next program must be made of GCC. mingw is a good choice. However, there are too many
Compiler, BC, Vc, Intel c ......
By the way, it is said that the performance of gcc4.0.0 has been greatly improved. If I upgrade gcc4, compile it again
Will gcc4 Improve compilation performance in the future? You have the opportunity to test it.

TIPS: You can run the command gcc-V to know the current version of GCC installation and configuration.
(2) install gcc4.0 from: http://dev.csdn.net/article/69/69161.shtm under cygwin
Gcc4.0 was released, but cygwin is currently the latest gcc3.4.1. Download the cygwin installation package.
Gcc4.0, it seems that I still need to wait for a while. How can I endure this? I used
If GCC has been upgraded in Linux, can it be used in cygwin?

I upgraded GCC in Linux again in cygwin. The result is OK, in sequence and in
In Linux.

1 first download the gcc4.0package gcc-4.0.0.tar.gz in the http://gcc.gnu.org.

2 Use winrarto decompress gcc-4.0.0.tar.gz in the installation directory (C:/temp/gcc-4.0.0), than in
Linux is much easier.

3. Create the target directory (C:/temp/build ).

4. Configure the installation parameters by running configure in the cygwin installation directory.
I did not select too many parameters, but set the installation directory. (
/Cygdrive/C/temp/gcc-4.0.0/configure -- prefix =/lib/GCC/i686-pc-cygwin/4.0.0)

5. Compile and run it in cygwin.

$ CD/cygdrive/C/temp/build

$/Cygdrive/C/temp/gcc-4.0.0/make

It takes about an hour.

6. Users with system administrator permissions are required for installation.

Run in cygwin

$ CD/cygdrive/C/temp/build

$ Make install

The installation is basically the same as in Linux, and it seems easier.

Next:

A. To use the GCC command in a Windows environment, using LN in cygwin is just a quick
Method, there is no way to copy the GCC, G ++, gcj in/lib/GCC/i686-pc-cygwin/4.0.0/bin
Bay to/bin, covering the previous things, this method is not very good, but that's it, huh, huh.

B copy all/lib/GCC/i686-pc-cygwin/4.0.0/lib files to/lib

C. Use the previous C ++ program to test the gcc4.0.0

 

 

How to compile with makefile in VC

Run cmd.exe (or command.com in Win9x)-> enter the VC/bin directory-> run the vc-vars32.bat-> enter the directory where makefile-> nmake/F makefile method is like this, I just do, but to the bin directory, how can not find the vc-vars32.bat this file, is my pirated vc6.0 without this file? I would like to be simpler, in the C:/Program Files directory directly Ctrl + F SEARCH FOR THE vc-vars32.bat file, but the search results are not found. Manually open the C:/program files/Microsoft Visual Studio/vc98/bin directory, found that it is not what TMD damn vc-vars32.bat file, and the file name should be vcvars32.bat this, VC behind the missing that _ symbol, I said how can not find the vc-vars32.bat.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.