In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains "how to solve the Linux makefile problem". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn how to solve the Linux makefile problem.
Write the relationship of each module into makefile, and specify the compilation command, so that when the source code of the module is modified, you can recompile all the modules involved in the module modification by running the makefile file using the make command, and do not worry about other modules.
Makefile file is written as follows:
Target, component
Rules
For example, there are the following five files:
/ * main.c * /
# include "mytool1.h"
# include "mytool2.h"
Int main (int argc,char * * argv)
{
Mytool1_print ("hello")
Mytool2_print ("hello")
}
/ * mytool1.h * /
# ifndef _ MYTOOL_1_H
# define _ MYTOOL_1_H
Void mytool1_print (char * print_str)
# endif
/ * mytool1.c * /
# include "mytool1.h"
Void mytool1_print (char * print_str)
{
Printf ("This is mytool1 print% s\ n", print_str)
}
/ * mytool2.h * /
# ifndef _ MYTOOL_2_H
# define _ MYTOOL_2_H
Void mytool2_print (char * print_str)
# endif
/ * mytool2.c * /
# include "mytool2.h"
Void mytool2_print (char * print_str)
{
Printf ("This is mytool2 print% s\ n", print_str)
}
You can compile in this way to run the executable main
Gcc-c main.c (generate main.o)
Gcc-c mytool1.c (generate mytool1.0)
Gcc-c mytool2.c (generate mytool2.0)
Gcc-o main main.o mytool1.o mytool2.o (generate main)
You can also write makefile files this way.
Main main.o mytool.o mytool2.o
Gcc-0 $@ $^
Main.0 main.c mytool1.h mytool2.h
Gcc-c $<
Mytool1.0 mytool1.c mytool1.h
Gcc-c $
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.