The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
Google UNIX.COM


High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Compilation problem on HP-UX varuntayur High Level Programming 1 02-19-2008 11:07 AM
Compilation problem with semtimedop rimon High Level Programming 3 11-01-2007 02:54 AM
compilation problem mansoorulhaq SUN Solaris 0 10-19-2007 05:18 AM
fread64 fwrite64 compilation problem (undefined symbol) Isax50 High Level Programming 3 08-16-2005 12:26 AM
gcc compilation collins High Level Programming 3 01-19-2005 09:51 AM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #1  
Old 10-25-2007
Registered User
 

Join Date: Nov 2006
Posts: 52
compilation problem

i have a class name 1.c in tht i am using function n wich has his body in 2.c and declaration in 2.h
now how can i compile 1.c.
ex;
1.c
int main()
{
//some data
n(10);
//somedata
}
*****
2.c
int n(int k)
{
//some data

}
int main()
{
some data
}
*****
2.h
int n(int k);

i complied the progam using command as : cc 1.c -o 1 -lm
i got the error as;
1.c.text+0xd5): undefined reference to `n'.
thank u,
sree
Reply With Quote
Forum Sponsor
  #2  
Old 10-25-2007
andryk's Avatar
Registered User
 

Join Date: Sep 2003
Posts: 448
You could do: cc 1.c 2.c -o 1 -lm, but you'll run into trouble as the two source file have both main() which should be unique in your executable 1 ...
Reply With Quote
  #3  
Old 10-25-2007
Registered User
 

Join Date: Jan 2007
Posts: 2,965
Quote:
Originally Posted by phani_sree View Post
//some data
Don't get in the habit of using C++ comments in C code.
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 05:22 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0