Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

linuxÏÂgcc±àÒësinº¯Êý³ö´íµÄÎÊÌâ

 
Q:
I
keep getting
errors due to library functions being undefined,
but I'm #including all
the right header files.
A:
In the general case of calling code in an
external library,
using #include
to pull in
the right header file(s) is only half
of the story; you also have to tell the linker to search the
external library itself.
The declarations in the header file
only tell the compiler how to call the external functions;
the header file doesn't supply the definitions of the external
functions, or tell the compiler/linker where to find those
definitions.
In some cases
(especially if the functions are nonstandard)
obtaining
those definitions
may require explicitly asking
for the correct libraries to be
searched
when you link the program.
(Some systems may be able to arrange
that whenever you #include
a header,
its associated library, if nonstandard,
is automatically requested at link time,
but such a facility is not
widespread.)
See also questions
10.11
,
11.30
,
13.26
,
14.3
,
and
19.40
.
Q:
I'm trying to do some simple
trig,
and I am #including <math.h>
,
but
the linker keeps
complaining
that functions like sin
and cos
are undefined.
A:
Make sure you're actually linking with the math library.
For instance,
due to a longstanding bug in Unix and Linux systems,
you usually need to use an explicit -lm
flag,
at the
end
of the command line,
when compiling/linking.
See also questions
13.25
,
13.26
,
and
14.2
.
µ±Ê¹ÓÃgcc±àÒëÆ÷±àÒ뺬Êýѧº¯ÊýµÄC³ÌÐòʱ,»á³öÏÖundefined reference to `sin'´íÎó.ÕâÖÖ´íÎóÒ»°ãÊÇÓÉÓÚȱÉÙ¿âÔì³ÉµÄ.ʹÓÃ-lm¼´¿É.Makefile¿ÉÒÔÕâÑùд:
pe14-18-11:pe14-18-11.o
         gcc pe14-18-11.o -lm -o pe14-18-11
pe14-18-11.o:pe14-18-11.c
         gcc -c pe14-18-11.c -o pe14-18-11.o
clean:
         rm -f *.o pe14-18-11
¾ßÌåÔ­Òò¼°½â¾ö°ì·¨Îª:
¼ÓÈëÁ¬½áµÄº¯Ê½¿


Ïà¹ØÎĵµ£º

cin EOF Linux

 ÎÒΪʲôдÕâ¸öÌâÄ¿ÄØ£¬ÒòΪÎÒ½ñÌìҪдµÄ²©ÓëÕâÈýÕß¶¼ÓйØÏµ£¬ÖÁÉÙÎÒ¸öÈËÈÏΪÊÇÕâÑùµÄ¡£
ÓиöÈËÎÊÁËÒ»¸öÕâÑùµÄС³ÌÐò£¬ËµÓÐÎÊÌ⣺
#include <iostream>
#include <vector>
#include <string>
using namespace std;
int main()
{
vector <string*> spvec;
string str;
cout & ......

linuxѧϰ±Ê¼Ç

1.ǰÑÔ£ºÈý¸öÎÊÌâ
1.1ʲôÊDzÙ×÷ϵͳ£¬²Ù×÷ϵͳµÄ×÷Ó㬲Ù×÷ϵͳµÄ½Ó¿Ú£¿
²Ù×÷ϵͳÊǹÜÀí¼ÆËã»ú×ÊÔ´µÄÖ÷³ÌÐò£¬ÊÇϵͳÈí¼þµÄºËÐÄ¡£
Ëü¿ØÖƳÌÐòµÄÖ´ÐкÍÌṩ×ÊÔ´·ÖÅä¡¢µ÷¶È¡¢ÊäÈë/Êä³ö¿ØÖƺÍÊý¾Ý¹ÜÀíµÈ·þÎñ¡£
²Ù×÷ϵͳÌṩÈýÖÖÀàÐ͵ĽӿڣºÃüÁî½Ó¿Ú¡¢³ÌÐò½Ó¿Ú¡¢Í¼Ðνӿڡ£
1.2ϵͳ×é³É£º
ÓÉËĸö²¿·Ö×é³É£º Äںˡ¢Îļþϵ ......

linuxÎÞÁ¬½Ó»ñÈ¡²»µ½IP

  ½ñÌìÔÚVMÖа²×°REDHat9Ö®ºó£¬ÔÚÖÕ¶ËÖÐÖ´ÐÐifconfigÖ¸Áî·¢ÏÖ²»ÄÜ»ñÈ¡²»µ½IP£¬Ö´ÐÐsetupÃüÁÐÞ¸ÄIP»ñÈ¡·½Ê½Îª¶¯Ì¬»ñÈ¡ºó»¹ÊÇ»ñÈ¡²»µ½£¬Ö´ÐÐsetup eth0 ÏÔʾ“ÎÞÁ¬½Ó¡£¡£¡£”ÉÏÍø²éÕÒÔ­ÒòºÜ¶àÈ˶¼ËµÊÇÇý¶¯Ã»°²×°¡¢Íø¿¨Ã»°²×°µÈ£¬×îºó·¢ÏÖ¶¼Êdz¶µ­¡£ÕæÕýµÄÔ­ÒòÊÇδ°²×°VMware Tools¡£°²×°VMtools·½Ê½
1 µã» ......

Linux DNS´î½¨ÊÔÑéºÍÏêϸ¹ý³Ì

¹Ù·½ÍøÕ¾£ºhttp://www.isc.org
Ò»£ºÔ´Âë°üµÄ°²×°ºÍÅäÖÃ
ÏÂÔØÔ´Âë°üÎļþ£ºhttp://ftp.isc.org/isc/bind9/9.4.2/bind-9.4.2.tar.gz
½âѹ²¢°²×°bind
Tar –zxvf bind-9.4.2.tar.gz
ÅäÖÃÔ´Âë°ü£º
./configure --prefix=/usr/local/named --enable-threads  #--enable-threads¿ªÆô¶àÏ̴߳¦ÀíÄÜÁ¦ 
......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ