编译用make多个C文件 [英] Compile multiple C files with make

查看:160
本文介绍了编译用make多个C文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

(我运行Linux操作系统Ubuntu 9.10,所以扩展可执行文件是executablefile.out c)中,我只是进入模块化编程(编程多个文件),我想知道如何编译在一个单一的多个文件makefile文件。例如,什么是编译这些文件生成文件:main.c中,dbAdapter.c,dbAdapter.h? (顺便说一句,如果你还没有想通出来呢,主要功能是在main.c中),也可能有人张贴链接到一个makefile的文件?

(I am running Linux Ubuntu 9.10, so the extension for an executable is executablefile.out) I am just getting into modular programming (programming with multiple files) in C and I want to know how to compile multiple files in a single makefile. For example, what would be the makefile to compile these files: main.c, dbAdapter.c, dbAdapter.h? (By the way, If you haven't figured it out yet, the main function is in main.c) Also could someone post a link to the documentation of a makefile?

推荐答案

请参阅我的<一个href=\"https://sites.google.com/site/michaelsafyan/software-engineering/how-to-write-a-makefile\">Makefile教程:如何写一个Makefile 。它提供了一个精心设计的Makefile文件,将建立这样一个项目(具有多个C和C ++源文件),说明它是如何工作的,并警告对常见的陷阱以及那些都太普通了可怜的makefile的做法在野外遇到了

See my Makefile Tutorial: How To Write A Makefile. It provides a well-crafted Makefile that will build such a project (with multiple C and C++ source files), explains how it works, and warns against common pitfalls as well as poor makefile practices that are all too common to encounter out in the wild.

这篇关于编译用make多个C文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆