Hello,

Most probably many of you have read my previous post entitled "Malloc code".

You all have given very good feedback in that post. I am using in an embeded
compiler, and one of the feedbacks this news groups suggested was a hint (I
believe!) that said, since my embede compiler might slightly compile C code
diffrently, I should take this code and replicate it in MS VC++ .NET to see
if it compiles right before posting for help in this newsgroup thread. I am
using VC++ 2003 vresion. I agree with this because if it compiles in the VC++
compiler, it will be easier for this thread to debug.

Anyhow I used to code in VC++ (as a beginer!) but had to stop two years ago,
and today I tried to get some code from the embeded compiler and replicated
it in MSVC++ and I get an error. It has something to do with the fact that it
doesn't see the other files!

Here is the error:
c:\_DTS_PROGRAMMING\C_PROGRAMMING\c\CCS_TESTS\Test1\Test\Main.c(6): fatal
error C1083: Cannot open include file: 'LCD.h': No such file or directory

Here is the code:
(Please notice this is just test code to see if I can compile in VC++)
==============================================Main.c
#include <stdio.h>
#include <string.h>
#include <conio.h>
#include <stdlib.h>
#include <malloc.h>
#include <LCD.h>
#include <TCP.h>

#include <LCD.c>
#include <TCP.c>

void TCP_CONFIG_GMM(struct MCB *MCBptrs[3])
{
struct MCB *y;
MCBptrs[0] = malloc(11*(sizeof(struct MCB)));
y = MCBptrs[1];
}

int main(void)
{
int a=1;
struct MCB *MCBptrs[3];

TCP_CONFIG_GMM(MCBptrs);
return 0;
}
==============================================

===========================================LCD.h
//No code for now
===============================================
===========================================LCD.c
//No code for now
===============================================

===========================================TCP.h
struct MCB{
int A0;
int A1;
int A2; };
===============================================

===========================================TCP.c
//No code for now
====================================================

I have looked in properties of VC++ but I don't know what setting I should
set to rectify this error. Can someone please help. Thanking all in advace!

--
Best regards
Robert

Re: Can't compile! by Victor

Victor
Thu Jan 03 14:09:36 CST 2008

Robby wrote:
> Hello,
>
> Most probably many of you have read my previous post entitled "Malloc
> code".
>
> You all have given very good feedback in that post. I am using in an
> embeded compiler, and one of the feedbacks this news groups suggested
> was a hint (I believe!) that said, since my embede compiler might
> slightly compile C code diffrently, I should take this code and
> replicate it in MS VC++ .NET to see if it compiles right before
> posting for help in this newsgroup thread. I am using VC++ 2003
> vresion. I agree with this because if it compiles in the VC++
> compiler, it will be easier for this thread to debug.
>
> Anyhow I used to code in VC++ (as a beginer!) but had to stop two
> years ago, and today I tried to get some code from the embeded
> compiler and replicated it in MSVC++ and I get an error. It has
> something to do with the fact that it doesn't see the other files!
>
> Here is the error:
> c:\_DTS_PROGRAMMING\C_PROGRAMMING\c\CCS_TESTS\Test1\Test\Main.c(6):
> fatal error C1083: Cannot open include file: 'LCD.h': No such file or
> directory
>
> Here is the code:
> (Please notice this is just test code to see if I can compile in VC++)
> ==============================================Main.c
> #include <stdio.h>
> #include <string.h>
> #include <conio.h>
> #include <stdlib.h>
> #include <malloc.h>
> #include <LCD.h>

For your own files, try changing angle brackets to double quotation
marks:

#include "LCD.h"

There is a difference between the two WRT where the files are looked up.

> #include <TCP.h>
>
> #include <LCD.c>
> #include <TCP.c>
> [..]

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask



Re: Can't compile! by Ben

Ben
Thu Jan 03 17:07:31 CST 2008

>> Here is the code:
>> (Please notice this is just test code to see if I can compile in VC++)
>> ==============================================Main.c
>> #include <stdio.h>
>> #include <string.h>
>> #include <conio.h>
>> #include <stdlib.h>
>> #include <malloc.h>
>> #include <LCD.h>
>
> For your own files, try changing angle brackets to double quotation
> marks:
>
> #include "LCD.h"
>
> There is a difference between the two WRT where the files are looked up.

Being that the compiler looks for filenames inside quotes starting in the
directory where the current file is found, while angle brackets send it
searching in the system include path.

If you are using any third party libraries, you may find it helpful to add
them to the system include path at Tools -> Options -> Projects and
Solutions -> VC++ Directories (at least on VS 2005).

Speaking of which, you should probably try VC++ 2008 Express Edition instead
of fighting the 5 year old bugs in VS2003 (although there are some new
ones).