<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>MEMOBALL.info &#187; C/C++</title>
	<atom:link href="http://www.memoball.info/category/programming/c-programing/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.memoball.info</link>
	<description>All of my Memories</description>
	<lastBuildDate>Thu, 22 Jul 2010 06:17:14 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>การเขียน makefile</title>
		<link>http://www.memoball.info/01/%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b9%80%e0%b8%82%e0%b8%b5%e0%b8%a2%e0%b8%99-makefile/</link>
		<comments>http://www.memoball.info/01/%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b9%80%e0%b8%82%e0%b8%b5%e0%b8%a2%e0%b8%99-makefile/#comments</comments>
		<pubDate>Mon, 25 Jan 2010 03:56:53 +0000</pubDate>
		<dc:creator>spnball</dc:creator>
				<category><![CDATA[C/C++]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.memoball.info/?p=420</guid>
		<description><![CDATA[วันนี้ได้ทำการเขียน makefile ใหม่ให้มีประสิทธิ์ภาพมากขึ้น โดยการใช้ inference rules จึงไปค้นหาเวปมาได้เวปดีๆ คือ
http://www-cip.physik.uni-bonn.de/pool/infos/make/advanced.html 


Getting started with Makefiles: Advanced features

1. What are macros and why should I use them?
Think of programs that shall be used at different locations: CERN, DESY, SLAC, University of Bonn, &#8230; The C/C++ programs are highly portable (at least after some effort) but the names of the [...]]]></description>
			<content:encoded><![CDATA[<p>วันนี้ได้ทำการเขียน makefile ใหม่ให้มีประสิทธิ์ภาพมากขึ้น โดยการใช้ inference rules จึงไปค้นหาเวปมาได้เวปดีๆ คือ<br />
<a href="http://www-cip.physik.uni-bonn.de/pool/infos/make/advanced.html">http://www-cip.physik.uni-bonn.de/pool/infos/make/advanced.html</a> <span id="more-420"></span></p>
<h2>
<hr noshade="noshade" /></h2>
<h2><span style="font-family: Arial,Helvetica">Getting started with Makefiles: Advanced features</span></h2>
<hr noshade="noshade" />
<h2><span style="font-family: Arial,Helvetica">1. What are macros and why should I use them?</span></h2>
<p>Think of programs that shall be used at different locations: CERN, DESY, SLAC, University of Bonn, &#8230; The C/C++ programs are highly portable (at least after some effort) but the names of the programs used to compile them &#8211; as well as their arguments &#8211; may be very different. So it would be nice to once give the program name, the list of arguments, etc. and then only use symbolic names so that you can rapidly adjust to the local computing environment. Those symbolic names are called &#8220;macros&#8221;. Let&#8217;s recall<tt> <strong><a href="http://www-cip.physik.uni-bonn.de/pool/infos/make/Makefile5">Makefile5</a></strong>.</tt></p>
<table border="1" cellpadding="20" width="100%" bgcolor="#ffffbf">
<tbody>
<tr>
<td><strong><tt>.IGNORE:</tt></strong><br />
<strong><tt>.SILENT:</tt></strong><strong><tt>mirror:    input.o mirror.o process.o output.o</tt></strong><br />
<strong><tt> g++ -o mirror input.o mirror.o process.o output.o</tt></strong></p>
<p><strong><tt>mirror.o:  mirror.cc</tt></strong><br />
<strong><tt> g++ -c -Wall mirror.cc</tt></strong></p>
<p><strong><tt>input.o:   input.cc</tt></strong><br />
<strong><tt> g++ -c -Wall input.cc</tt></strong></p>
<p><strong><tt>output.o:  output.cc</tt></strong><br />
<strong><tt> g++ -c -Wall output.cc</tt></strong></p>
<p><strong><tt>process.o: process.cc</tt></strong><br />
<strong><tt> g++ -c -Wall process.cc</tt></strong></p>
<p><strong><tt>clean:</tt></strong><br />
<strong><tt> rm -f *.o core</tt></strong></p>
<p><strong><tt>distclean:</tt></strong><br />
<strong><tt> make clean</tt></strong><br />
<strong><tt> rm -f mirror</tt></strong></p>
<p><strong><tt>again:</tt></strong><br />
<strong><tt> make distclean</tt></strong><br />
<strong><tt> make mirror</tt></strong></td>
</tr>
</tbody>
</table>
<p>All object files are made using <tt>g++</tt>. On other machines that may be<tt> cxx, cpp, </tt>or something the like. So let&#8217;s define a macro for the C++ compiler:</p>
<table border="1" cellpadding="20" width="100%" bgcolor="#ffffbf">
<tbody>
<tr>
<td><strong><tt>C++ = g++</tt></strong></td>
</tr>
</tbody>
</table>
<p>The command line options are also different for different compilers so it&#8217;s a good idea to have a macro for them:</p>
<table border="1" cellpadding="20" width="100%" bgcolor="#ffffbf">
<tbody>
<tr>
<td><strong><tt>C++-Flags = -c -Wall</tt></strong></td>
</tr>
</tbody>
</table>
<p>On some machines the command to remove files is<tt> rm </tt>(or<tt> rm -f), </tt>on others<tt> del, </tt>some use<tt> delete, </tt>some<tt> erase, </tt>and some even<tt> discard.</tt>So that&#8217;s another candidate for a macro:</p>
<table border="1" cellpadding="20" width="100%" bgcolor="#ffffbf">
<tbody>
<tr>
<td><strong><tt>RM = rm -f</tt></strong></td>
</tr>
</tbody>
</table>
<p>Even make may not always be called make (though I know of no system where this is the case):</p>
<table border="1" cellpadding="20" width="100%" bgcolor="#ffffbf">
<tbody>
<tr>
<td><strong><tt>MAKE = make</tt></strong></td>
</tr>
</tbody>
</table>
<p>In our example the linker is also g++. In general that need not be the case. So we define the following two macros:</p>
<table border="1" cellpadding="20" width="100%" bgcolor="#ffffbf">
<tbody>
<tr>
<td><strong><tt>LINKER       = g++</tt></strong><br />
<strong><tt>LINKER-FLAGS = -o</tt></strong></td>
</tr>
</tbody>
</table>
<p>The meaning of the following two macros is obvious:</p>
<table border="1" cellpadding="20" width="100%" bgcolor="#ffffbf">
<tbody>
<tr>
<td><strong><tt>OBJS   = input.o mirror.o process.o output.o</tt></strong><br />
<strong><tt>TARGET = mirror</tt></strong></td>
</tr>
</tbody>
</table>
<p>After these changes the present state of the Makefile is<tt> <strong><a href="http://www-cip.physik.uni-bonn.de/pool/infos/make/Makefile6">Makefile6</a></strong>:</tt></p>
<table border="1" cellpadding="20" width="100%" bgcolor="#ffffbf">
<tbody>
<tr>
<td><strong><tt>C++          = g++</tt></strong><br />
<strong><tt>C++-FLAGS    = -c -Wall</tt></strong><br />
<strong><tt>LINKER       = g++</tt></strong><br />
<strong><tt>LINKER-FLAGS = -o</tt></strong><br />
<strong><tt>RM           = rm -f</tt></strong><br />
<strong><tt>MAKE         = make</tt></strong><br />
<strong><tt>OBJS         = input.o mirror.o process.o output.o</tt></strong><br />
<strong><tt>TARGET       = mirror</tt></strong><strong><tt>.IGNORE:</tt></strong><br />
<strong><tt>.SILENT:</tt></strong></p>
<p><strong><tt>$(TARGET): $(OBJS)</tt></strong><br />
<strong><tt> $(LINKER) $(LINKER-FLAGS) $(TARGET) $(OBJS)</tt></strong></p>
<p><strong><tt>mirror.o:  mirror.cc</tt></strong><br />
<strong><tt> $(C++) $(C++-FLAGS) mirror.cc</tt></strong></p>
<p><strong><tt>input.o:   input.cc</tt></strong><br />
<strong><tt> $(C++) $(C++-FLAGS) input.cc</tt></strong></p>
<p><strong><tt>output.o:  output.cc</tt></strong><br />
<strong><tt> $(C++) $(C++-FLAGS) output.cc</tt></strong></p>
<p><strong><tt>process.o: process.cc</tt></strong><br />
<strong><tt> $(C++) $(C++-FLAGS) process.cc</tt></strong></p>
<p><strong><tt>clean:</tt></strong><br />
<strong><tt> $(RM) *.o core</tt></strong></p>
<p><strong><tt>distclean:</tt></strong><br />
<strong><tt> $(MAKE) clean</tt></strong><br />
<strong><tt> $(RM) $(TARGET)</tt></strong></p>
<p><strong><tt>again:</tt></strong><br />
<strong><tt> $(MAKE) distclean</tt></strong><br />
<strong><tt> $(MAKE) $(TARGET)</tt></strong></td>
</tr>
</tbody>
</table>
<h2><strong><span style="font-family: Arial,Helvetica">2. What are inference rules and what are they good for?</span></strong></h2>
<p>If you have a close look at the rules to make<tt> mirror.o, input.o, output.o, </tt>and<tt> process.o</tt> you see that they are all the same:</p>
<table border="1" cellpadding="20" width="100%" bgcolor="#ffffbf">
<tbody>
<tr>
<td><strong><tt>&lt;filename&gt;.o: &lt;filename&gt;.cc</tt></strong><br />
<strong><tt> $(C++) $(C++-FLAGS) &lt;filename&gt;.cc</tt></strong></td>
</tr>
</tbody>
</table>
<p>To avoid all these lenthy entries in a Makefile there are inference rules: They describe the &#8217;standard procedure&#8217; of making files of type b from files of type a. In this case the rule to make an object file from a given C++ file is</p>
<table border="1" cellpadding="20" width="100%" bgcolor="#ffffbf">
<tbody>
<tr>
<td><strong><tt>.cc.o:</tt></strong><br />
<strong><tt> $(C++) $(C++-FLAGS) $&lt;</tt></strong></td>
</tr>
</tbody>
</table>
<p>or alternatively you could use</p>
<table border="1" cellpadding="20" width="100%" bgcolor="#ffffbf">
<tbody>
<tr>
<td><strong><tt>.cc.o:</tt></strong><br />
<strong><tt> $(C++) $(C++-FLAGS) $*.cc</tt></strong></td>
</tr>
</tbody>
</table>
<p>It&#8217;s easy to see what<tt> $&lt; </tt>and<tt> $* </tt>mean but I&#8217;ll come back to that in just a moment. First I will change the rule for making the target &#8216;mirror&#8217; so that it makes use of another strange-looking predefined macros:</p>
<table border="1" cellpadding="20" width="100%" bgcolor="#ffffbf">
<tbody>
<tr>
<td><strong><tt>$(TARGET): $(OBJS)</tt></strong><br />
<strong><tt> $(LINKER) $(LINKER-FLAGS) $@ $(OBJ)</tt></strong></td>
</tr>
</tbody>
</table>
<p>Now let&#8217;s have a look at the meaning of <tt>$*, $&lt;, </tt>and<tt> $@:</tt></p>
<p><strong><tt>$*</tt></strong> ist the current target without an extension (the base file name) with path. For example, in</p>
<table border="1" cellpadding="20" width="100%" bgcolor="#ffffbf">
<tbody>
<tr>
<td><strong><tt>input.o: input.cc</tt></strong><br />
<strong><tt> $(C++) $(C++-FLAGS) $*.cc</tt></strong></td>
</tr>
</tbody>
</table>
<p>the value of<strong><tt> $* </tt></strong>is <strong><tt>input</tt></strong>.<strong><tt> $* </tt></strong>is commonly used only in inference rules and command lines.</p>
<p><tt><strong>$@</strong> </tt>is the current target (including extension, if any). For example, in</p>
<table border="1" cellpadding="20" width="100%" bgcolor="#ffffbf">
<tbody>
<tr>
<td><strong><tt>mirror: $(OBJS)</tt></strong><br />
<strong><tt> $(LINKER) $(LINKER-FLAGS) $@ $(OBJS)</tt></strong></td>
</tr>
</tbody>
</table>
<p>the value of<tt> <strong>$@</strong> </tt>is<strong><tt> mirror</tt></strong>.</p>
<p><strong><tt>$&lt;</tt></strong> is a dependent file out-of date with the target file. For example,</p>
<table border="1" cellpadding="20" width="100%" bgcolor="#ffffbf">
<tbody>
<tr>
<td><strong><tt>.cc.o:</tt></strong><br />
<strong><tt> $(C++) $(C++-FLAGS) $*.cc</tt></strong></td>
</tr>
</tbody>
</table>
<p>Notice that <strong><tt>$&lt;</tt></strong>, in an inference rule such as <strong><tt>.cc.o</tt></strong>, is equivalent to <strong><tt>$*.cc</tt></strong> (as already mentioned).</p>
<p>Just to remind you: Your Makefile should now look like<tt> <strong><a href="http://www-cip.physik.uni-bonn.de/pool/infos/make/Makefile7">Makefile7</a></strong></tt>:</p>
<table border="1" cellpadding="20" width="100%" bgcolor="#ffffbf">
<tbody>
<tr>
<td><strong><tt>C++          = g++</tt></strong><br />
<strong><tt>C++-FLAGS    = -c -Wall</tt></strong><br />
<strong><tt>LINKER       = g++</tt></strong><br />
<strong><tt>LINKER-FLAGS = -o</tt></strong><br />
<strong><tt>RM           = rm -f</tt></strong><br />
<strong><tt>MAKE         = make</tt></strong><br />
<strong><tt>OBJS         = input.o mirror.o process.o output.o</tt></strong><br />
<strong><tt>TARGET       = mirror</tt></strong><strong><tt>.IGNORE:</tt></strong><br />
<strong><tt>.SILENT:</tt></strong></p>
<p><strong><tt>$(TARGET): $(OBJS)</tt></strong><br />
<strong><tt> $(LINKER) $(LINKER-FLAGS) $@ $(OBJS)</tt></strong></p>
<p><strong><tt>.cc.o:</tt></strong><br />
<strong><tt> $(C++) $(C++-FLAGS) $&lt;</tt></strong></p>
<p><strong><tt>clean:</tt></strong><br />
<strong><tt> $(RM) *.o core</tt></strong></p>
<p><strong><tt>distclean:</tt></strong><br />
<strong><tt> $(MAKE) clean</tt></strong><br />
<strong><tt> $(RM) $(TARGET)</tt></strong></p>
<p><strong><tt>again:</tt></strong><br />
<strong><tt> $(MAKE) distclean</tt></strong><br />
<strong><tt> $(MAKE) $(TARGET)</tt></strong></td>
</tr>
</tbody>
</table>
<h2><span style="font-family: Arial,Helvetica">3. Continuation lines</span></h2>
<p>If your project consists of a great number of files (or you need lots of options) you may wish to split lines. Another reason for splitting lines is increasing the readability of your Makefile (don&#8217;t underestimate that point!).  In<tt> <strong><a href="http://www-cip.physik.uni-bonn.de/pool/infos/make/Makefile7">Makefile7</a></strong> </tt>you could change the line reading</p>
<table border="1" cellpadding="20" width="100%" bgcolor="#ffffbf">
<tbody>
<tr>
<td><strong><tt>OBJS = input.o mirror.o process.o output.o</tt></strong></td>
</tr>
</tbody>
</table>
<p>to read</p>
<table border="1" cellpadding="20" width="100%" bgcolor="#ffffbf">
<tbody>
<tr>
<td><strong><tt>OBJS = input.o   \</tt></strong><br />
<strong><tt> mirror.o  \</tt></strong><br />
<strong><tt> process.o \</tt></strong><br />
<strong><tt> output.o</tt></strong></td>
</tr>
</tbody>
</table>
<h2><span style="font-family: Arial,Helvetica">4.  Comments</span></h2>
<p>You can also add comments to your Makefile like the ones in<tt> <strong><a href="http://www-cip.physik.uni-bonn.de/pool/infos/make/Makefile8">Makefile8</a></strong></tt>:</p>
<table border="1" cellpadding="20" width="100%" bgcolor="#ffffbf">
<tbody>
<tr>
<td><strong><tt>C++          = g++           # use GNU C++ compiler </tt></strong><br />
<strong><tt>C++-FLAGS    = -c -Wall      # warn all </tt></strong><br />
<strong><tt>LINKER       = g++           # use GNU C++ as linker </tt></strong><br />
<strong><tt>LINKER-FLAGS = -o            # flags for linker </tt></strong><br />
<strong><tt>RM           = rm -f         # how to remove files </tt></strong><br />
<strong><tt>MAKE         = make          # name of make utility </tt></strong><br />
<strong><tt># you cannot add comments after the continuation character! </tt></strong><br />
<strong><tt>OBJS         = input.o   \ </tt></strong><br />
<strong><tt> mirror.o  \ </tt></strong><br />
<strong><tt> process.o \ </tt></strong><br />
<strong><tt> output.o </tt></strong><br />
<strong><tt>TARGET       = mirror        # name of executable </tt></strong><strong><tt>.IGNORE:                     # ignore problems (as far as possible) </tt></strong><br />
<strong><tt>.SILENT:                     # don't echo commands executed </tt></strong></p>
<p><strong><tt>$(TARGET):  $(OBJS) </tt></strong><br />
<strong><tt> $(LINKER) $(LINKER-FLAGS) $@ $(OBJS) </tt></strong></p>
<p><strong><tt>.cc.o: </tt></strong><br />
<strong><tt> $(C++) $(C++-FLAGS) $&lt; </tt></strong></p>
<p><strong><tt># remove object files and core (if any) </tt></strong><br />
<strong><tt>clean: </tt></strong><br />
<strong><tt> $(RM) *.o core </tt></strong></p>
<p><strong><tt># remove object files, core dump, and executable (if any) </tt></strong><br />
<strong><tt>distclean: </tt></strong><br />
<strong><tt> $(MAKE) clean </tt></strong><br />
<strong><tt> $(RM) $(TARGET) </tt></strong></p>
<p><strong><tt># remove object files, core dump, and executable (if any) and </tt></strong><br />
<strong><tt># make them again. </tt></strong><br />
<strong><tt>again: </tt></strong><br />
<strong><tt> $(MAKE) distclean </tt></strong><br />
<strong><tt> $(MAKE) $(TARGET)</tt></strong></td>
</tr>
</tbody>
</table>
<h2><span style="font-family: Arial,Helvetica">5. The .SUFFIXES pseudo target</span></h2>
<p>make comes with a couple of predefined rules how to make certain files. To get rid of them simply use</p>
<table border="1" cellpadding="20" width="100%" bgcolor="#ffffbf">
<tbody>
<tr>
<td><strong><tt>.SUFFIXES:</tt></strong></td>
</tr>
</tbody>
</table>
<p>If you do that you have to list all suffixes that your Makefile does support. In the above case that would be</p>
<table border="1" cellpadding="20" width="100%" bgcolor="#ffffbf">
<tbody>
<tr>
<td><strong><tt>.SUFFIXES: .o .cc</tt></strong></td>
</tr>
</tbody>
</table>
<p>You can also use<strong><tt> .SUFFIXES </tt></strong>to add rules to the predefined ones (in precisely the same manner as in the example above).</p>
<h2><span style="font-family: Arial,Helvetica">6. Using environment variables</span></h2>
<p>You can use environment variables in the same way as macros (besides that they are defined outside the Makefile):</p>
<table border="1" cellpadding="20" width="100%" bgcolor="#ffffbf">
<tbody>
<tr>
<td><strong><tt>info:</tt></strong><br />
<strong><tt> echo $(USER)</tt></strong></td>
</tr>
</tbody>
</table>
<p>Surely this is not a very useful example. Finding more useful ones is left to the reader.  Now, your Makefile should look like<tt> <strong><a href="http://www-cip.physik.uni-bonn.de/pool/infos/make/Makefile9">Makefile9</a></strong></tt>:</p>
<table border="1" cellpadding="20" width="100%" bgcolor="#ffffbf">
<tbody>
<tr>
<td><strong><tt>C++          = g++           # use GNU C++ compiler</tt></strong><br />
<strong><tt>C++-FLAGS    = -c -Wall      # warn all</tt></strong><br />
<strong><tt>LINKER       = g++           # use GNU C++ as linker </tt></strong><br />
<strong><tt>LINKER-FLAGS = -o            # flags for linker</tt></strong><br />
<strong><tt>RM           = rm -f         # how to remove files</tt></strong><br />
<strong><tt>MAKE         = make          # name of make utility</tt></strong><br />
<strong><tt># you cannot add comments after the continuation character!</tt></strong><br />
<strong><tt>OBJS         = input.o   \</tt></strong><br />
<strong><tt> mirror.o  \</tt></strong><br />
<strong><tt> process.o \</tt></strong><br />
<strong><tt> output.o</tt></strong><br />
<strong><tt>TARGET       = mirror        # name of executable</tt></strong><strong><tt>.IGNORE:                     # ignore problems (as far as possible)</tt></strong><br />
<strong><tt>.SILENT:                     # don't echo commands executed</tt></strong><br />
<strong><tt>.SUFFIXES:                   # get rid of predefined rules</tt></strong><br />
<strong><tt>.SUFFIXES: .cc .o</tt></strong></p>
<p><strong><tt>$(TARGET): $(OBJS)</tt></strong><br />
<strong><tt> $(LINKER) $(LINKER-FLAGS) $@ $(OBJS)</tt></strong></p>
<p><strong><tt>.cc.o:</tt></strong><br />
<strong><tt> $(C++) $(C++-FLAGS) $&lt;</tt></strong></p>
<p><strong><tt># remove object files and core (if any)</tt></strong><br />
<strong><tt>clean:</tt></strong><br />
<strong><tt> $(RM) *.o core</tt></strong></p>
<p><strong><tt># remove object files, core dump, and executable (if any)</tt></strong><br />
<strong><tt>distclean:</tt></strong><br />
<strong><tt> $(MAKE) clean</tt></strong><br />
<strong><tt> $(RM) $(TARGET)</tt></strong></p>
<p><strong><tt># remove object files, core dump, and executable (if any) and</tt></strong><br />
<strong><tt># make them again.</tt></strong><br />
<strong><tt>again:</tt></strong><br />
<strong><tt> $(MAKE) distclean</tt></strong><br />
<strong><tt> $(MAKE) $(TARGET)</tt></strong></p>
<p><strong><tt># echo username</tt></strong><br />
<strong><tt>info:</tt></strong><br />
<strong><tt> echo User is: $(USER)</tt></strong></td>
</tr>
</tbody>
</table>
<hr noshade="noshade" />Last changed tuesday 6/2/1998</p>
]]></content:encoded>
			<wfw:commentRss>http://www.memoball.info/01/%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b9%80%e0%b8%82%e0%b8%b5%e0%b8%a2%e0%b8%99-makefile/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>วิธีการลง C Kernel header File ใน Ubuntu</title>
		<link>http://www.memoball.info/12/%e0%b8%a7%e0%b8%b4%e0%b8%98%e0%b8%b5%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%a5%e0%b8%87-kernel-c-header-file/</link>
		<comments>http://www.memoball.info/12/%e0%b8%a7%e0%b8%b4%e0%b8%98%e0%b8%b5%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%a5%e0%b8%87-kernel-c-header-file/#comments</comments>
		<pubDate>Thu, 25 Dec 2008 17:49:40 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Application]]></category>
		<category><![CDATA[C/C++]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://memoball.nabzer.com/?p=4</guid>
		<description><![CDATA[เวลาลง VMWare server ใน linux ตัวติดตั้งจะต้องการการคอมไพล์โดยใช้ header ของตัว linux kernel โดยจะขึ้นข้อความมาถาม ดังต่อไปนี้ 
What is the location of the directory of C header files that match
 your running kernel?

ในคำสั่งด้านบน ถ้าใส่ directory ผิดจะมีการขึ้นข้อความในลักษณะดังต่อไปนี้
The header files in /usr/include are generally for C libraries, not for the
running kernel. If you do not have kernel header files in your /usr/src
directory, [...]]]></description>
			<content:encoded><![CDATA[<p>เวลาลง VMWare server ใน linux ตัวติดตั้งจะต้องการการคอมไพล์โดยใช้ header ของตัว linux kernel โดยจะขึ้นข้อความมาถาม ดังต่อไปนี้ </p>
<pre dir="ltr">What is the location of the directory of C header files that match
 your running kernel?</pre>
<p><span id="more-4"></span><br />
ในคำสั่งด้านบน ถ้าใส่ directory ผิดจะมีการขึ้นข้อความในลักษณะดังต่อไปนี้</p>
<pre dir="ltr">The header files in /usr/include are generally for C libraries, not for the
running kernel. If you do not have kernel header files in your /usr/src
directory, you probably do not have the kernel-source package installed. Are
you sure that /usr/include contains the header files associated with your
running kernel?</pre>
<p>
ในกรณีที่ยังไม่มี C header file ดังกล่าว ให้ลง build-essential ของ Ubuntu ดังต่อไปนี้</p>
<div id="bodyContent">
<h3 id="siteSub"><a href="http://wiki.memoball.info/index.php/%E0%B8%A7%E0%B8%B4%E0%B8%98%E0%B8%B5%E0%B8%81%E0%B8%B2%E0%B8%A3%E0%B8%A5%E0%B8%87_C_Kernel_header_File_%E0%B9%83%E0%B8%99_Ubuntu">จาก WikiBall</a></h3>
<div id="contentSub"></div>
<div id="jump-to-nav"></div>
<p>			<!-- start content --></p>
<p>ลง build-essential ของ Ubuntu โดยใช้คำสั่งดังต่อไปนี้
</p>
<pre style="border: 1px inset; margin: 0px; padding: 6px; overflow: auto; width: 100%; height: 34px; text-align: left;" dir="ltr">apt-get install linux-headers-`uname -r` build-essential</pre>
<p>
</p>
<p>โดย C header file จะอยู่ใน
</p>
<pre dir="ltr">/lib/modules/2.6.27-7-server/build/include</pre>
<p>&nbsp;<br />
อ้างอิงจาก
</p>
<dl>
<dd> <a href="http://www.howtoforge.com/forums/showthread.php?t=7306" class="external free" title="http://www.howtoforge.com/forums/showthread.php?t=7306" rel="nofollow">http://www.howtoforge.com/forums/showthread.php?t=7306</a>
</dd>
</dl>
<p><!--<br />
NewPP limit report<br />
Preprocessor node count: 10/1000000<br />
Post-expand include size: 0/2097152 bytes<br />
Template argument size: 0/2097152 bytes<br />
Expensive parser function count: 0/100<br />
--></p>
<p><!-- Saved in parser cache with key memoball_wiki:pcache:idhash:41-0!1!0!!th!2!edit=0 and timestamp 20090825090231 --></p>
<div class="printfooter">
<h5>รับข้อมูลจาก (Reference) : </h5>
<p>จาก WikiBall : <a href="http://wiki.memoball.info/index.php/%E0%B8%A7%E0%B8%B4%E0%B8%98%E0%B8%B5%E0%B8%81%E0%B8%B2%E0%B8%A3%E0%B8%A5%E0%B8%87_C_Kernel_header_File_%E0%B9%83%E0%B8%99_Ubuntu">http://wiki.memoball.info/index.php/วิธีการลง_C_Kernel_header_File_ใน_Ubuntu</a></div>
<div id='catlinks' class='catlinks'>
<div id="mw-normal-catlinks"><a href="http://wiki.memoball.info//index.php/%E0%B8%9E%E0%B8%B4%E0%B9%80%E0%B8%A8%E0%B8%A9:Categories" title="พิเศษ:Categories">หมวดหมู่</a>:&#32;<span dir='ltr'><a href="http://wiki.memoball.info//index.php?title=%E0%B8%AB%E0%B8%A1%E0%B8%A7%E0%B8%94%E0%B8%AB%E0%B8%A1%E0%B8%B9%E0%B9%88:Vmware&amp;action=edit&amp;redlink=1" class="new" title="หมวดหมู่:Vmware (ยังไม่ได้สร้าง)">Vmware</a></span></div>
</div>
<p>			<!-- end content --></p>
<div class="visualClear"></div>
</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.memoball.info/12/%e0%b8%a7%e0%b8%b4%e0%b8%98%e0%b8%b5%e0%b8%81%e0%b8%b2%e0%b8%a3%e0%b8%a5%e0%b8%87-kernel-c-header-file/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
