1. Trang chủ
  2. » Công Nghệ Thông Tin

MinGW Starter docx

78 249 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 78
Dung lượng 1,28 MB

Nội dung

www.it-ebooks.info Instant MinGW Starter Develop, debug and prole your C++ applications using the MinGW open source software Ilya Shpigor BIRMINGHAM - MUMBAI www.it-ebooks.info Instant MinGW Starter Copyright © 2013 Packt Publishing All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews. Every eort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book. Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information. First published: January 2013 Production Reference: 1210113 Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK. ISBN 978-1-84969-562-6 www.packtpub.com www.it-ebooks.info Credits Author Ilya Shpigor Reviewer Kyle Schwarz Acquisition Editor Edward Gordon Commissioning Editor Maria D'souza Technical Editor Ankita Meshram Project Coordinator Amigya Khurana Proofreader Maria Gould Production Coordinator Prachali Bhiwandkar Cover Work Prachali Bhiwandkar Cover Image Conidon Miranda www.it-ebooks.info www.it-ebooks.info Foreword "Yoda's aphorism ("There is no 'try'") sounds neat, but it doesn't work for me. I have done most of my work while anxious about whether I could do the job, and ensure that it would be enough to achieve the goal if I did. But I tried anyway, because there was no one but me between the enemy and my city. Surprising myself, I have sometimes succeeded." Richard Matthew Stallman, Launcher of the GNU Project and founder of the Free Software Foundation Sometimes it seems that the world is limited to just the Microsoft Windows operating system and that the developing of complex applications is impossible without the latest version of MS Visual Studio. But there are open houses where there is no need to look at the sky through the windows. There are a lot of development environments that are dierent from commonly used ones, and this variety allows us to feel the world of the software in its entirety. PCs are losing their signicance increasingly and are yielding the personal computing device's role to tablet computers and smartphones. The world does not consist of only one hardware architecture nowadays. The dierent CPU architectures and operating systems for supporting them are available now. The ability to develop cross-platform applications is important too. Many software development tools have been created as a part of the GNU Project since 1984 when the project started. The GNU compiler collection is a part of these software development tools. Minimalist GNU for Windows (MinGW) is a software port of the GNU Toolchain for Microsoft Windows operating system. Its minimalism means that MinGW doesn't provide the whole POSIX compatible environment. In the meantime it doesn't yield to its ancestor for Unix-based systems but allows you to feel Unix philosophy. www.it-ebooks.info MinGW allows open source software developers to port their software to the Windows operating system. MinGW software with any of the well-known cross-platform framework integration allows you to develop cross-platform applications even if you don't care about this feature. This feature provides a great competitive advantage if your customer decides to change his or her computing platform to another suddenly. You don't need a special Linux version or additional developer team in this case. Just make minor changes in your software and that's all you need. The MinGW software allows you to use plenty of open source C and C++ libraries that integrate with MinGW well. You can develop applications with more features and reuse source code thanks to these libraries. Often open source libraries' licenses allow you to choose if your application will be a free software or a proprietary one. The world of command-line interface, Makeles, and build systems can be very enthralling like other new things. Compiling your program with new tools always leads to surprises. It nds faults in places with seemingly clean code. Try to calm it down. You do not get lost. You can integrate MinGW software with an integrated development environment (IDE), such as Code::Blocks, Qt Creator, and even Eclipse if you will tolerate Eclipse's slowness. Good luck! And don't forget to use a control version system for your source code. The frequent commits are a pledge of quick bugs searching that has been added to the developed source code with any new feature or code correction. This book allows you to quickly start new software project development thanks to detailed explanation on how to create a necessary development environment. You will know how to download necessary tools, choose user interface library and compile applications. At rst, it is important to understand where to start. I believe that this book will dispel your doubts and you will understand that these things are actually simple. Try it! Vitaly Lipatov CEO, Etersoft www.it-ebooks.info About the Author Ilya Shpigor is a software developer in a ight simulator manufacturing company in Saint Petersburg, Russia. His work is in developing real-time computing systems that work under heavy computational loads. Ilya prefers to use open source software products, such as the Linux operating system and GNU toolchain, for his daily tasks. He has participated in ALT Linux distribution and Wine open source software development before his current job. Ilya has experience in cross-platform software development, porting applications to other computing platforms, and real-time computing systems design. He is interested in automating routine tasks and researching the capacities of dierent programming languages to solve specic problems. Writing a book is the hard work of many people and not just that of the author. I would like to thank everyone who has helped me with this work. I would like to gratefully acknowledge Navin Mehra, an Author Relationship Executive, who found me and suggested I write this book. It is dicult to overestimate the importance of this event for the book. I would like to thank the Commissioning Editor, Maria D'souza, who corrected my drafts so many times. I would like to thank the technical reviewer, Kyle Schwarz. His comments were very helpful to improve this book signicantly. And a special thanks to my mentor and friend, Vitaly Lipatov, who introduced me to the wonderful world of open source software. www.it-ebooks.info About the Reviewer Kyle Schwarz has been working on Linux machines for over 7 years and has a deep understanding of low-level system functions. He is a detail-oriented individual, who has experience in many aspects of computer software and hardware. He enjoys working with all technology platforms and is constantly expanding his experience in this eld. He has worked for several major companies on projects that involved FFmpeg, Windows BATCH scripting, Linux BASH scripting, web development, web design, Windows Installer scripting, and much more. He currently operates zeranoe.com and does contract work for companies and individuals. I would like to thank my Dad for teaching me the value of hard work. His guidance and leadership have been the most valuable aspects of my life. www.it-ebooks.info www.packtpub.com Support les, eBooks, discount oers and more You might want to visit www.PacktPub.com for support les and downloads related to your book. Did you know that Packt oers eBook versions of every book published, with PDF and ePub les available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at service@ packtpub.com for more details. At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and oers on Packt books and eBooks. www.it-ebooks.info [...]... of MinGW and MinGW- w64 are the same All knowledge gained in this book you can apply to MinGW- w64 software The following website is for the MinGW- w64 project: http:/ /mingw- w64.sourceforge.net 6 www.it-ebooks.info Instant MinGW Starter You can download the archive with MinGW software from here and unpack them After unpacking you will get a ready-to-use MinGW software The following is the website of a MinGW- w64... available at the official MinGW website You can simply install extensions for MinGW software using the mingw- get application The 64-bit MinGW software version is available from the MinGW- w64 fork Fork is an alternative branch of mainstream software development The goal of any fork is to achieve specific software features MinGW- w64 is a completely different software package than MinGW with its own staff... Development Environments (IDE) that support MinGW 4 www.it-ebooks.info Instant MinGW Starter Installation There are several ways to install MinGW software on your computer For example, you can compile whole MinGW software by yourself, or you can just install MinGW software distribution with a few clicks The following steps are the simplest and quickest guide to install MinGW software Step 1 – What do I need?... your login credentials for immediate access www.it-ebooks.info Table of Contents Instant MinGW Starter 1 So, what is MinGW? Installation Step 1 – What do I need? Step 2 – Downloading MinGW Step 3 – Extracting and configuring What do you have to get? Alternative ways to install MinGW Quick start – Creating your first MinGW project Step 1 – Adding source files Step 2 – Adding a Makefile Step 3 – Compiling... 57 People and places you should get to know MinGW official sites MinGW- w64 official sites GNU Compiler Collection official sites www.it-ebooks.info 61 61 61 61 Table of Contents GNU Debugger official sites GNU Make official sites Articles and tutorials Community Twitter 62 62 62 62 62 [ ii ] www.it-ebooks.info Instant MinGW Starter Welcome to Instant MinGW Starter This book has been especially created... software www.it-ebooks.info www.it-ebooks.info Instant MinGW Starter So, what is MinGW? Minimalist GNU for Windows (MinGW) is a native software port of the GNU tool chain for the Microsoft Windows operating system The base components of MinGW software are compiler, linker, and assembler This minimal tool set is enough to start developing applications But MinGW contains some service utilities to make the... applications with MinGW software You will get to know the basic skills to work with MinGW software and discover some tips and tricks for using it This book contains the following sections: So, what is MinGW? – This section describes what MinGW actually is, its common components, and what you can do with it Installation – In this section you will learn how to download and install MinGW software with... official distribution of MinGW software from the following developers' website: http://www .mingw. org I recommend you use the mingw- get installer application with a text-based interface You can get a list of all the available packages by executing the following command: $ mingw- get list Execute the following command to install the necessary packages (for example, GCC, G++, GDB): $ mingw- get install gcc... usually passed through environment variables) 14 www.it-ebooks.info Instant MinGW Starter The following Makefile is a linking example with the static-link boost program options library (the file path of the library is C: \MinGW\ lib\libboost_program_options.a): OBJ=main.o options.o RES=resource.rc CXXFLAGS+=-IC: \MinGW\ include LIBS+=-LC: \MinGW\ lib -lboost_program_options win32-app.exe: $(OBJ) $(RES).res.o g++... main.o and main.cpp) The following Makefile is a linking example with a dynamic-link zlib library (the file path of the library is C: \MinGW\ git\bin\libz.dll): OBJ=main.o RES=resource.rc CXXFLAGS+=-IC: \MinGW\ include 15 www.it-ebooks.info Instant MinGW Starter LIBS+=-LC: \MinGW\ git\bin –lz win32-app.exe: $(OBJ) $(RES).res.o $(CXX) -o $@ $^ $(LIBS) $(RES).res.o: $(RES) windres -o $@ -i $^ clean: rm -f *.o . apply to MinGW- w64 software. The following website is for the MinGW- w64 project: http:/ /mingw- w64.sourceforge.net www.it-ebooks.info 7 Instant MinGW Starter You can download the archive with MinGW. 62 www.it-ebooks.info Instant MinGW Starter Welcome to Instant MinGW Starter. This book has been especially created to provide you with all the information that you need to start developing applications with MinGW. helpful articles and tutorials on MinGW software. www.it-ebooks.info www.it-ebooks.info 3 Instant MinGW Starter So, what is MinGW? Minimalist GNU for Windows (MinGW) is a native software port

Ngày đăng: 31/03/2014, 22:20

Xem thêm

TỪ KHÓA LIÊN QUAN

w