Build error, Can't open header file. What am I missing?

General discussion on mikroC PRO for 8051.
Post Reply
Author
Message
Edward1
Posts: 9
Joined: 20 Dec 2014 01:45

Build error, Can't open header file. What am I missing?

#1 Post by Edward1 » 20 Dec 2014 02:01

I'm new to MikroC Pro for 8051, and before I purchase it I just wanted to test some of my own basic code.
The included example codes, without header file references, do work perfectly. I want to use code created in Keil, with header files, in MikroC.

But when I Build projects, I receive "1 304 error: Can't open include file " 8051.h", and no Hex file is created.
(Same problem with reg51.h, reg52.h, several others.)

I have the header file listed in the Project Manager under Header Files.
The error message log contents are:

0 122 Compilation Started __Lib_Delays.c
418 123 Compiled Successfully __Lib_Delays.c
0 122 Compilation Started __Lib_GlcdFonts.c
496 123 Compiled Successfully __Lib_GlcdFonts.c
1 304 error: Can't open include file " 8051.h" #include< 8051.h> 1 error in preprocessor. C:\Documents and Settings\Ed.XPWS02\Desktop\BlinkLED5\BlinkLED5.c
0 122 Compilation Started BlinkLED5.c
2 325 Too many initializers BlinkLED5.c
0 102 Finished (with errors): 21 Dec 2014, 09:34:49 BlinkLED5.mcp51

Any guidance appreciated.
How can I correct this?

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: Build error, Can't open header file. What am I missing?

#2 Post by filip » 22 Dec 2014 09:35

Hi,

Please, can you attach your project here so I can test it ?

Regards
Filip.

Edward1
Posts: 9
Joined: 20 Dec 2014 01:45

Re: Build error, Can't open header file. What am I missing?

#3 Post by Edward1 » 23 Dec 2014 03:50

Project and header file attached.

I hope we can resolve this, no project I have with a header file will work.
Attachments
BlinkLED5.rar
(865 Bytes) Downloaded 270 times
REG51.rar
(622 Bytes) Downloaded 409 times

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: Build error, Can't open header file. What am I missing?

#4 Post by filip » 23 Dec 2014 09:53

Hi,

I don't see the C source file, so I cannot compile the project, but by looking at the REG51.H file,
I see that it contains register definitions that are also present in the AT89C52.C definition file, located in the Uses folder of the compiler.

So, the compiler complains of the redefinition because the same registers are defined twice in the same project.

The solution is not to include REG51.H, as the definition file is already automatically included in the project from the start.

Regards,
Filip.

croket_2512
Posts: 41
Joined: 05 Aug 2014 03:35

Re: Build error, Can't open header file. What am I missing?

#5 Post by croket_2512 » 23 Dec 2014 10:44

Edward1 wrote:Project and header file attached.

I hope we can resolve this, no project I have with a header file will work.
You should attach all files in your project folder. The mikroC compiler needn't REG51.H like KeilC.

Best regards.

Edward1
Posts: 9
Joined: 20 Dec 2014 01:45

Re: Build error, Can't open header file. What am I missing?

#6 Post by Edward1 » 24 Dec 2014 04:53

Sorry
This should be complete.
See attached.
Attachments
BlinkLED5.zip
(6.09 KiB) Downloaded 260 times

croket_2512
Posts: 41
Joined: 05 Aug 2014 03:35

Re: Build error, Can't open header file. What am I missing?

#7 Post by croket_2512 » 25 Dec 2014 03:13

As I said, you needn't REG51.H, because mikroC for 8051 has already it, inside mikroC, you can't see it. If you use it, the compiler will show error Identifier redifinition. Next, you needn't write delay function, because mikroC also has it. They are: Delay_us(number), Delay_ms(number), Vdelay_ms(number), Delay_Cyc(number), see in Help to know more. I also attached your project below.
Attachments
BlinkLED5 - edited.rar
(10.77 KiB) Downloaded 327 times

Edward1
Posts: 9
Joined: 20 Dec 2014 01:45

Re: Build error, Can't open header file. What am I missing?

#8 Post by Edward1 » 25 Dec 2014 16:58

Thank you.

Post Reply

Return to “mikroC PRO for 8051 General”