It’s been quite some times since I began learning C and C++ but I’ve been very limited only to the Windows platform and the Visual Studio environment. Recently, I wanted to look into some open source C/C++ projects, so I downloaded a few but I was frustrated because I didn’t know how to compile those software. Then I had to learn about all those g++ and make stuff and still I only have very limited knowledge in those subjects.

Having been used to an environment like Visual Studio, where you can write the code, hit the play button and boom you’re all good to go, it was hard for me to compile a program with the command line at first.

So my question is, if you’re a C/C++ developer, how do you compile your code ? How do you compile relatively large code bases ? What are the tools that you use ? Do you use IDEs or simply text editors ? What is the compiler that you use ? Do you build your applications from the command line ? What is the OS that you usually compile on ?

SideNote: My linux knowledge is zero.

6

At least for free software on Linux, you usually use some builder like make. You could use some other builder program, like scons or omake

For some (mostly historical) reasons, the Makefile may be generated by utilities like autoconf or cmake; these generators also deal with configuration issues (e.g. they disable some features of the software if a dependency is missing). Some frameworks also provide their own Makefile generators, e.g. qmake for Qt

PS. Recent GNU make 4 has a lot of new features (plugins and guile scriptability) which are worthwhile (and probably could IMHO remove the necessity of generating Makefile-s).

When building large C++ code base, I recommend using command line utilities (notably make), because you understand more what is really happening. Also, a lot of large C++ code bases are sometimes using specialized C++ code generators (e.g. the GCC compiler has a dozen of them, internal to it). There are good reasons to sometimes generate some C++ code (perhaps with a simple awk or python script), e.g. some headers or constants, etc.

To build many GNU -or other- large free software bases -at least on Linux-, you generally don’t need to understand all the details of their building. Usually, a README or an INSTALL text file explains how to do that, and it is often -for software using autoconf- (but not always) as simple as running the three commands

 ./configure
 make
 sudo make install

You might prefer to run make install DESTDIR=/tmp/installdir/ then copy the /tmp/installdir with e.g. sudo cp -va /tmp/installdir/ /

For software using cmake, building them is often as simple as

mkdir build 
cd build
cmake ..
make
sudo make install

The pkg-config is also a useful utility, since it gives the compilation and linking flags useful with some packages.

Large software may be difficult to build because of the dependency hell (which is an issue for every large software, on any operating system). Linux distributions are done to manage with it.

I guess that these free software are often easier to build on Linux than on Windows (which I don’t know and never use). BTW, I strongly recommend you to install Linux and learn it, because it is fun and made of free software (whose source code you can study, improve, and contribute to).

Very large or foundational free software like the GCC compiler, the GNU glibc, the Linux kernel are tricky to build (because nearly everything depend upon them). So start building some easier free software from source code. See sourceforge or github to find some.

Some languages or frameworks have their own installer or package manager or builder. For example, ocaml has opam

BTW, notice that all IDE (including Visual Studio on Windows) are just editors with some graphical interface to run the C++ compiler on the command line. So it is better to understand what is really happening, by knowing how to run the compiler thru commands.

2

My experience is that beyond having a Makefile (or sometimes cmake :-(), it varies according to the personal tastes of the individual. Personally, I use a editor that runs from the command line (xterm), and have editor macros (created over a couple of decades) that more or less imitate many of the features of an IDE without the baggage. For instance, one keypress runs make (after saving all open files), dumps the output into a file which I see in the editor, then another keypress on an error line takes me to the originating line in the source. (And this works for other things, like LaTeX documents.) Other people like to use vi(m), emacs, or other tools.

The common core is that almost everything I’ve seen builds from a Makefile. If the project is intended for wide distribution, that may be generated by autoconf tools. (Or cmake &c.) However, if you like IDEs, Wikipedia has a long list that run in Linux: https://en.wikipedia.org/wiki/Category:Linux_integrated_development_environments I’ve no experience with any of them, other than a short (and unpleasant) stint with Eclipse – and that some years ago, so it may well have improved.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật