View previous topic :: View next topic |
Author |
Message |
Guest
|
multi files |
Posted: Thu Jun 05, 2008 5:44 am |
|
|
I am working on a program with a main.c file which has several includes for other .c, .h and .reg files.
I then call routines in the other files from the main file.
I am not reliably able to include the files in my project. I seemed have achieved this is some cases more by luck than skill.
Files that main can access are in the project list, other are not and I don't seem to be able to add them.
Any ideas?
CCS version 4.71
pic18f8722
regards |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
Guest
|
multi files |
Posted: Thu Jun 05, 2008 8:59 am |
|
|
Thanks for the info.
Do I have to use MPLAB to solve my problen or can I use just the CCS compiler.
I ask this as I have a seperate issue with MPLAB, I can't get it the recognize compiler.
So, if I can use just compiler I will sort that problem first, then MPLAB.
Regards |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
|
Guest
|
Multi files |
Posted: Thu Jun 05, 2008 10:56 am |
|
|
I have PCWH 4.071.
This should do multiple compilation.
Regards |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Thu Jun 05, 2008 10:59 am |
|
|
Are you talking about "Multiple compilation units" as shown on here:
http://www.ccsinfo.com/content.php?page=ideoverview#multiple
I don't have the CCS IDE compiler (PCW, etc.). I only have the
command line compilers which I use with MPLAB. So I can't help
you with multiple compilation units. |
|
|
Guest
|
|
Posted: Thu Jun 05, 2008 11:09 am |
|
|
Quote: | Are you talking about "Multiple compilation units" as shown on here: |
Yes.
Thanks for looking anyway.
Perhaps someone else may help.
Best regards |
|
|
Ken Johnson
Joined: 23 Mar 2006 Posts: 197 Location: Lewisburg, WV
|
|
Posted: Thu Jun 05, 2008 12:44 pm |
|
|
I've just managed to build a small project with "multiple compilation units".
Under menu "Options/Project Options/Files", check both "Multiple Compilation Units" and "Link Separately". Then next to "Source Files, click "Add".
Later, when you return to this dialog, the .c files show up as .o files - confusing.
But this has worked for me. Hope this helps
Ken |
|
|
Guest
|
multi files |
Posted: Sat Jun 07, 2008 12:15 am |
|
|
Thanks for your comments.
I built a small project as a test too, and it worked fine.
My main project has about ten of my includes and it may be this number thats causing the problem.
I will continue to investigate.
Best regards, |
|
|
Franck26
Joined: 29 Dec 2007 Posts: 122 Location: Ireland
|
|
Posted: Wed Jun 11, 2008 7:03 am |
|
|
Hi Ken,
The multi compilation unit is working with CCS IDE???
I tried it many times and never succeed...
Several times I was able to compile, but never able debug with the ICD2:
“Clock and Connection Review” windows which show up after loading...
Do you use the CCS ICD2?
Thanks for any response. |
|
|
KU5D
Joined: 10 Feb 2008 Posts: 46 Location: Asheville, North Carolina
|
|
Posted: Wed Jun 11, 2008 10:13 am |
|
|
I also ran into this when I first started using this compiler. Most of my projects have multiple files, which makes modules easier to use in multiple projects. Some projects have ten files or more. The important thing is to make sure you include the files in your main in the correct order. You cannot have any call to a function unless the order in which they are compiled defines the function before it is called.
I use the CCS IDE version 3.249 and the CCS compiler. _________________ Confidence is the feeling you have right before you fully understand the situation... |
|
|
Franck26
Joined: 29 Dec 2007 Posts: 122 Location: Ireland
|
|
Posted: Wed Jun 11, 2008 12:36 pm |
|
|
Hi KU5D,
Are you sure you are using a "multi compilation unit" project?
Because in another post Kender explained me that the "multi compilation unit" option was not available before V4...
I think you are including your .c files directly in the main file so for the compiler it's like one big file and it's very different than a multi compilation.
About your problem of including the file in the good order, I think that it's because you are not writing the prototype of the function in the appropriate .h file. For each .c file you need to have at least one .f file which will be include in the other .c files.
Regrads,
Franck. |
|
|
KU5D
Joined: 10 Feb 2008 Posts: 46 Location: Asheville, North Carolina
|
|
Posted: Wed Jun 11, 2008 12:51 pm |
|
|
Most likely I misinterpreted the original question. I thought we were simply trying to use multiple source files (which does appear to the compiler as one big 'main'). _________________ Confidence is the feeling you have right before you fully understand the situation... |
|
|
Franck26
Joined: 29 Dec 2007 Posts: 122 Location: Ireland
|
|
Posted: Wed Jun 11, 2008 1:04 pm |
|
|
You couldn't know: this option is not available with your version.
Neither in the V4 in fact, since it's not working!!!
Regards,
Franck. |
|
|
|