| | |
Linking 2 files.
Please support our C advertiser: Programming Forums - DaniWeb Sister Site
![]() |
C Syntax (Toggle Plain Text)
C:\>bcc ami.c freidman.c

C Syntax (Toggle Plain Text)
/* ami.h */ #ifndef AMI #define AMI void function(void); #endif
C Syntax (Toggle Plain Text)
/* ami.c */ #include "ami.h" void function(void) { /* ... */ }
C Syntax (Toggle Plain Text)
/* freidman.c */ #include "ami.h" int main(void) { function(); return 0; }
Last edited by Inanna; Oct 5th, 2006 at 8:13 pm.
•
•
Join Date: Oct 2006
Posts: 58
Reputation:
Solved Threads: 0
Yea I know I need to declare.
Where exactly do I type:
Thanks
Ami
Where exactly do I type:
C Syntax (Toggle Plain Text)
C:\>bcc ami.c freidman.c
Thanks
Ami
•
•
Join Date: Oct 2006
Posts: 58
Reputation:
Solved Threads: 0
Ok!
Yes it IS bcc.
I put the 2 files in the same directory as BIN and then ran:
It opened a MS-DOS (Im using Win XP) window for a sec and closed. I assume it did something.
Now in file 2 I have this:
It doesnt recognize "get_j". I diclared get_j in file1.c
Any idea why?
Thanks
Ami
Yes it IS bcc.
I put the 2 files in the same directory as BIN and then ran:
C Syntax (Toggle Plain Text)
bcc file1.c file2.c
Now in file 2 I have this:
C Syntax (Toggle Plain Text)
/* file2.c */ #include <stdio.h> int main() { extern int i; /* get_j(void) is in file1.c */ int get_j(void); printf("i == %d\n", ++i); printf("j == %d\n", get_j()); return 0; }
It doesnt recognize "get_j". I diclared get_j in file1.c
Any idea why?
Thanks
Ami
Last edited by amishosh; Oct 5th, 2006 at 9:27 pm.
Just a hunch, but try this and paste the error that you get.
C Syntax (Toggle Plain Text)
/* file2.c */ #include <stdio.h> int get_j(void); int main() { extern int i; printf("i == %d\n", ++i); printf("j == %d\n", get_j()); return 0; }
![]() |
Similar Threads
- Problems Linking C++ Files (C++)
- Linking files for Compilation in C++ Data Structures (C++)
- problems wid cpp files (C++)
Other Threads in the C Forum
- Previous Thread: Createdialog_box Error.
- Next Thread: Problem starting a homework problem for class. Please help!
| Thread Tools | Search this Thread |
#include * ansi append array arrays asterisks bash binarysearch centimeter changingto char character convert copyimagefile cprogramme creafecopyofanytypeoffileinc createprocess() database dynamic execv fgets file floatingpointvalidation fork framework function getlogicaldrivestrin givemetehcodez grade gtkwinlinux hacking histogram ide inches include infiniteloop initialization input interest intmain() iso kernel keyboard kilometer km license linked linkedlist linux list lists looping lowest matrix meter microsoft number oddnumber open opendocumentformat openwebfoundation overwrite owf pdf pointer pointers posix power probleminc process program programming radix recursion recv recvblocked research reversing segmentationfault sequential single socket socketprogramming standard strchr string suggestions systemcall test testing threads turboc unix urboc user variable wab whythiscodecausesegmentationfault windowsapi





