Click here to Skip to main content
15,895,606 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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::
Posted
Updated 9-Sep-11 0:28am
v4
Comments
Wendelius 9-Sep-11 0:47am    
Pre tags added
Emilio Garavaglia 9-Sep-11 2:30am    
< and > replaced with &lt; &gt;
Richard MacCutchan 9-Sep-11 3:54am    
Are you missing a "-I" include directive in your make file?
You cannot do it this way unless you have a makefile that drives the build process. It looks like you don't have such a file so the make command is just trying to build the executable file hw1 from the source hw1.cpp.

1 solution

The Makefile looks wrong, the following line
Member 8186541 wrote:
g++ hw1.cpp -o hw1

should (probably) be;
C++
g++ -c hw1.cpp -o hw1.o


You should fix, in similar way the other compiling directives and eventually add the linking one.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900