当前位置: 技术问答>linux和unix
how to solve such question about compile. come in, quickly! Thank you !
来源: 互联网 发布时间:2015-04-24
本文导语: i use the command as following: gcc -O2 -o -s DownloadFlash.cpp. but come out such result. why, and how to in /tmp/ and i can't find cc**.o same, cc**.o changes after one compiled save me!!!!!!!!!!!!!! /tmp/ccctgJxV.o: In function `main': /tmp/ccctgJxV....
i use the command as following:
gcc -O2 -o -s DownloadFlash.cpp.
but come out such result. why, and how to in /tmp/
and i can't find cc**.o
same, cc**.o changes after one compiled
save me!!!!!!!!!!!!!!
/tmp/ccctgJxV.o: In function `main':
/tmp/ccctgJxV.o(.text+0x480): the `gets' function is dangerous and should not be used.
/tmp/ccctgJxV.o: In function `putp(int, int, int)':
/tmp/ccctgJxV.o(.text+0xc6e): undefined reference to `outp(unsigned, int)'
/tmp/ccctgJxV.o(.text+0xca3): undefined reference to `outp(unsigned, int)'
/tmp/ccctgJxV.o(.text+0xcdf): undefined reference to `outp(unsigned, int)'
/tmp/ccctgJxV.o(.text+0xd0f): undefined reference to `inp(unsigned)'
/tmp/ccctgJxV.o: In function `test_port()':
/tmp/ccctgJxV.o(.text+0x1699): undefined reference to `outp(unsigned, int)'
/tmp/ccctgJxV.o(.text+0x16a9): undefined reference to `inp(unsigned)'
/tmp/ccctgJxV.o(.text+0x16f0): undefined reference to `outp(unsigned, int)'
/tmp/ccctgJxV.o(.text+0x1700): undefined reference to `inp(unsigned)'
/tmp/ccctgJxV.o(.text+0x1744): undefined reference to `outp(unsigned, int)'
/tmp/ccctgJxV.o(.text+0x1754): undefined reference to `inp(unsigned)'
/tmp/ccctgJxV.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status
gcc -O2 -o -s DownloadFlash.cpp.
but come out such result. why, and how to in /tmp/
and i can't find cc**.o
same, cc**.o changes after one compiled
save me!!!!!!!!!!!!!!
/tmp/ccctgJxV.o: In function `main':
/tmp/ccctgJxV.o(.text+0x480): the `gets' function is dangerous and should not be used.
/tmp/ccctgJxV.o: In function `putp(int, int, int)':
/tmp/ccctgJxV.o(.text+0xc6e): undefined reference to `outp(unsigned, int)'
/tmp/ccctgJxV.o(.text+0xca3): undefined reference to `outp(unsigned, int)'
/tmp/ccctgJxV.o(.text+0xcdf): undefined reference to `outp(unsigned, int)'
/tmp/ccctgJxV.o(.text+0xd0f): undefined reference to `inp(unsigned)'
/tmp/ccctgJxV.o: In function `test_port()':
/tmp/ccctgJxV.o(.text+0x1699): undefined reference to `outp(unsigned, int)'
/tmp/ccctgJxV.o(.text+0x16a9): undefined reference to `inp(unsigned)'
/tmp/ccctgJxV.o(.text+0x16f0): undefined reference to `outp(unsigned, int)'
/tmp/ccctgJxV.o(.text+0x1700): undefined reference to `inp(unsigned)'
/tmp/ccctgJxV.o(.text+0x1744): undefined reference to `outp(unsigned, int)'
/tmp/ccctgJxV.o(.text+0x1754): undefined reference to `inp(unsigned)'
/tmp/ccctgJxV.o(.eh_frame+0x11): undefined reference to `__gxx_personality_v0'
collect2: ld returned 1 exit status
|
first of all,your compilation command line is wrong,should:
gcc -o youfile.S -O2 -S DownloadFlash.cpp do you want ASM level output? I Guess.
second,the wrong of "undefined reference" is as you use the "inp,outp..."。in linux system.it will be “inb,inw,inl,outb,outw,outl",and you must include the
.and don't forget the gcc option "-O2".otherwise,you get the "undefine reference".
gcc -o youfile.S -O2 -S DownloadFlash.cpp do you want ASM level output? I Guess.
second,the wrong of "undefined reference" is as you use the "inp,outp..."。in linux system.it will be “inb,inw,inl,outb,outw,outl",and you must include the
.and don't forget the gcc option "-O2".otherwise,you get the "undefine reference".
|
这主要是因为你的系统中找不到对outp等函数的定义,确定它们在什么头文件,然后再include吧。在dos的turbo c下好像是io.h头文件,但是在unix下就不知道了。
|
用g++编译
|
你用的是C++吧。用g++编译