|
|
View previous topic :: View next topic |
Author |
Message |
Guest Guest
|
Included header files |
Posted: Mon Jun 21, 2004 5:40 am |
|
|
As a newbe to the CCS compiler, I have a problem with including a main.h with a main.c.
For some reason the compiler does not recognise or accept the contents of the header file resulting in spurious error messages such as undefined type and no such function.
It seems if I include the contents of the header file main.h in main.c and delete main.h or the contents of main.h then there is no problem. I no not normally have this problem with other compilers such as borland, MSVC++ and GNU.
reply much appricated. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Jun 21, 2004 2:24 pm |
|
|
I made a test program, and it worked OK. I compiled this
with PCM vs. 3.202 and used MPLAB vs. 6.42.
I made a new project named "Main", and added the main.c
source file to the "Source Files" section in the Project window.
MPLAB picked up Main.h during the compile, and added it
to the "Header Files" section by itself. I got one warning
about "Condition always True" during the compile. That's OK.
I suggest that you try this test program, and see if it works.
The following code is in main.c
Code: | #include <16F877.h>
#fuses XT, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock = 4000000)
#include "main.h"
//============================================
void main()
{
func1(MY_CONSTANT);
while(1);
}
//========================
// FUNCTIONS
char func1(char c)
{
c += 5;
return(c);
}
|
-----------------------------------------------------
The following code is in main.h
Code: | #define MY_CONSTANT 0x55
char func1(char c); |
|
|
|
Guest Guest
|
Is it case related? |
Posted: Mon Jun 21, 2004 6:55 pm |
|
|
Long time ago I has similar problem using various *.h files and it was related to case sensitivity. |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|