View previous topic :: View next topic |
Author |
Message |
Ray Livingston Guest
|
PCM & Multiple Source Files under MPLAB |
Posted: Tue Aug 05, 2003 4:29 pm |
|
|
Using MPLAB 6.3, PCM 3.158: Is it possible to have multiple C source files? When I try, each module generates an error "Function referenced but not defined" on the all extern references. Because of these errors (which should not really be errors, as they are declared as extern....) the linker does not run.
Am I doing something wrong?
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516691 |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
Re: PCM & Multiple Source Files under MPLAB |
Posted: Tue Aug 05, 2003 5:30 pm |
|
|
:= Using MPLAB 6.3, PCM 3.158: Is it possible to have multiple C source files? When I try, each module generates an error "Function referenced but not defined" on the all extern references. Because of these errors (which should not really be errors, as they are declared as extern....) the linker does not run.
--------------------------------------------------------
It's not MPLAB. It's the compiler. It doesn't support
linking separate object modules together. You have to
#include all source modules in your main file. Then
compile it. See the following link for an example.
<a href="http://www.pic-c.com/forum/general/posts/50.html" TARGET="_blank">http://www.pic-c.com/forum/general/posts/50.html</a>
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516693 |
|
|
TS Guest
|
Re: PCM & Multiple Source Files under MPLAB |
Posted: Tue Aug 05, 2003 7:24 pm |
|
|
:=:= Using MPLAB 6.3, PCM 3.158: Is it possible to have multiple C source files? When I try, each module generates an error "Function referenced but not defined" on the all extern references. Because of these errors (which should not really be errors, as they are declared as extern....) the linker does not run.
:=
:=--------------------------------------------------------
:=
:=It's not MPLAB. It's the compiler. It doesn't support
:=linking separate object modules together. You have to
:=#include all source modules in your main file. Then
:=compile it. See the following link for an example.
:= <a href="http://www.pic-c.com/forum/general/posts/50.html" TARGET="_blank"> <a href="http://www.pic-c.com/forum/general/posts/50.html" TARGET="_blank">http://www.pic-c.com/forum/general/posts/50.html</a></a>
You are putting the C module files after the functions in the main file. Are you doing this so that if you use the modifier 'static' before a variable in a module (but not in a function in that module), it will have a scope limited to (will only be seen by) that module?
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516696 |
|
|
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
|
Re: PCM & Multiple Source Files under MPLAB |
Posted: Tue Aug 05, 2003 8:49 pm |
|
|
There is but one and only one module for the CCS compiler. It doesn't really matter if you include them in the begining or end of the file.
:=:=:= Using MPLAB 6.3, PCM 3.158: Is it possible to have multiple C source files? When I try, each module generates an error "Function referenced but not defined" on the all extern references. Because of these errors (which should not really be errors, as they are declared as extern....) the linker does not run.
:=:=
:=:=--------------------------------------------------------
:=:=
:=:=It's not MPLAB. It's the compiler. It doesn't support
:=:=linking separate object modules together. You have to
:=:=#include all source modules in your main file. Then
:=:=compile it. See the following link for an example.
:=:= <a href="http://www.pic-c.com/forum/general/posts/50.html" TARGET="_blank"> <a href="http://www.pic-c.com/forum/general/posts/50.html" TARGET="_blank"> <a href="http://www.pic-c.com/forum/general/posts/50.html" TARGET="_blank">http://www.pic-c.com/forum/general/posts/50.html</a></a></a>
:=
:=You are putting the C module files after the functions in the main file. Are you doing this so that if you use the modifier 'static' before a variable in a module (but not in a function in that module), it will have a scope limited to (will only be seen by) that module?
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516699 |
|
|
Ray Livingston Guest
|
Re: PCM & Multiple Source Files under MPLAB |
Posted: Wed Aug 06, 2003 9:21 am |
|
|
OK, that's the conclusion I reached. Thanks! Is the same true for PCW?
:=:=:= Using MPLAB 6.3, PCM 3.158: Is it possible to have multiple C source files? When I try, each module generates an error "Function referenced but not defined" on the all extern references. Because of these errors (which should not really be errors, as they are declared as extern....) the linker does not run.
:=:=
:=:=--------------------------------------------------------
:=:=
:=:=It's not MPLAB. It's the compiler. It doesn't support
:=:=linking separate object modules together. You have to
:=:=#include all source modules in your main file. Then
:=:=compile it. See the following link for an example.
:=:= <a href="http://www.pic-c.com/forum/general/posts/50.html" TARGET="_blank"> <a href="http://www.pic-c.com/forum/general/posts/50.html" TARGET="_blank"> <a href="http://www.pic-c.com/forum/general/posts/50.html" TARGET="_blank">http://www.pic-c.com/forum/general/posts/50.html</a></a></a>
:=
:=You are putting the C module files after the functions in the main file. Are you doing this so that if you use the modifier 'static' before a variable in a module (but not in a function in that module), it will have a scope limited to (will only be seen by) that module?
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516714 |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
Re: PCM & Multiple Source Files under MPLAB |
Posted: Wed Aug 06, 2003 5:13 pm |
|
|
:=You are putting the C module files after the functions in the main file. Are you doing this so that if you use the modifier 'static' before a variable in a module (but not in a function in that module), it will have a scope limited to (will only be seen by) that module ?
--------------------------------------------------------------
I don't think that feature of the "static" keyword works
in CCS, because CCS doesn't support linkable object modules.
I put the C source files at the end of the main file because
they're out of the way, and it makes it look nicer.
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516733 |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
Re: PCM & Multiple Source Files under MPLAB |
Posted: Wed Aug 06, 2003 5:15 pm |
|
|
:=:=You are putting the C module files after the functions in the main file. Are you doing this so that if you use the modifier 'static' before a variable in a module (but not in a function in that module), it will have a scope limited to (will only be seen by) that module?
----------------------------------------------------------
To TS:
I don't think that feature of the "static" keyword works
in CCS, because CCS doesn't support linkable object modules.
I put the C source files at the end of the main file because
they're out of the way, and it makes it look nicer.
___________________________
This message was ported from CCS's old forum
Original Post ID: 144516734 |
|
|
|