制作“制作文件"时出错Unix [英] Error while making "Make File" unix
本文介绍了制作“制作文件"时出错Unix的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有7个文件,如下所示:;
-hw1.cpp
-mul.cpp
-mul.h
-div.cpp
-div.h
-common.cpp
-common.h
每个文件都会编译而不会发出警告.并运行良好...但是当我制作make文件时,例如::: make hw1
出现以下错误...请帮助
I have 7 files which are as follows:;
-hw1.cpp
-mul.cpp
-mul.h
-div.cpp
-div.h
-common.cpp
-common.h
Each and every file compiles without warning. and runs well... but when i make make file eg::: make hw1
following error is comming... Please help
shallin07@ubuntu:~/Downloads$ make hw1
g++ hw1.cpp -o hw1
/tmp/cck5CENS.o: In function `main'':
hw1.cpp:(.text+0x98): undefined reference to `IsDigitString(std::basic_string<char,>, std::allocator<char> >)''
hw1.cpp:(.text+0x152): undefined reference to `IsDigitString(std::basic_string<char,>, std::allocator<char> >)''
hw1.cpp:(.text+0x249): undefined reference to `multiply(std::basic_string<char,>, std::allocator<char> >, std::basic_string<char,>, std::allocator<char> >)''
hw1.cpp:(.text+0x30f): undefined reference to `divide(std::basic_string<char,>, std::allocator<char> >, std::basic_string<char,>, std::allocator<char> >)''
collect2: ld returned 1 exit status
make: *** [hw1] Error 1
shallin07@ubuntu:~/Downloads$ ;
请帮助::
Please help::
推荐答案
make hw1 g ++ hw1.cpp -o hw1 /tmp/cck5CENS.o:在"main"函数中: hw1.cpp :(.text + 0x98):对`IsDigitString(std :: basic_string< char,> std :: allocator< char>)的未定义引用'') hw1.cpp :(.text + 0x152):对`IsDigitString(std :: basic_string< char,> std :: allocator< char>)的未定义引用'') hw1.cpp :(.text + 0x249):对`multiply(std :: basic_string< char,> ;, std :: allocator< char> ;, std :: basic_string< char,> ;, std ::的未定义引用分配器< char>)'') hw1.cpp :(.text + 0x30f):对`divide(std :: basic_string< char,> ;, std :: allocator< char> ;, std :: basic_string< char,> ;, std ::的未定义引用分配器< char>)'') collect2:ld返回1退出状态 make:*** [hw1]错误1 mustin07 @ ubuntu:〜/下载
make hw1 g++ hw1.cpp -o hw1 /tmp/cck5CENS.o: In function `main'': hw1.cpp:(.text+0x98): undefined reference to `IsDigitString(std::basic_string<char,>, std::allocator<char> >)'' hw1.cpp:(.text+0x152): undefined reference to `IsDigitString(std::basic_string<char,>, std::allocator<char> >)'' hw1.cpp:(.text+0x249): undefined reference to `multiply(std::basic_string<char,>, std::allocator<char> >, std::basic_string<char,>, std::allocator<char> >)'' hw1.cpp:(.text+0x30f): undefined reference to `divide(std::basic_string<char,>, std::allocator<char> >, std::basic_string<char,>, std::allocator<char> >)'' collect2: ld returned 1 exit status make: *** [hw1] Error 1 shallin07@ubuntu:~/Downloads
;
请帮忙:
Please help::
Makefile
看起来不对,以下行
TheMakefile
looks wrong, the following line
成员8186541写道:
Member 8186541 wrote:
g ++ hw1.cpp -o hw1
g++ hw1.cpp -o hw1
应该(可能)是;
should (probably) be;
g++ -c hw1.cpp -o hw1.o
您应该以其他方式修复其他编译指令,并最终添加链接指令.
You should fix, in similar way the other compiling directives and eventually add the linking one.
这篇关于制作“制作文件"时出错Unix的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文