dis is a simple c program.. but while using it in borland c++ 4.5 ,, declaration syntax error is being displayed at file1.h ..why so?

file1.h

#define USD 1

file2.h

#define UKP 1

file3

#include<stdio.h>
	#include <file1.h>


	#ifdef USD
	#define curr 46
	#endif

	#ifdef UKP
	#define curr 100
	#endif
	void main()
	{
	  int rs;
	  rs=10*curr;
	  printf ("%d",rs);

	}

Edited 6 Years Ago by Nick Evan: Added code-tags

I tried this and it worked:

file1.h

#define USD 1

file2.h

#define UKP 1

file3.c

#include<stdio.h>
#include "file1.h"
/*#include "file2.h"*/


#ifdef USD
	#define curr 46
#endif

/*#ifdef UKP
	#define curr 100
#endif*/
int main()
{
	int rs;
	rs = 10 * curr;
	printf ( "ans->%d\n", rs);
	return 0;
}

program output:
ans->460

gerard, please don't fix people's code for them with no explanation. They learn nothing.

solitude_spark, the problem is you specified #include <file1.h> . The <brackets> tell the compiler to look in the compiler and system directories but not in the current directory. To search in the current dir use "double quotes" #include "file1.h" .

Too bad. What are you going to do about it.

probably bang my head against a wall ....... or wud better try to reinstall borland on my pc.. which 1 is a better idea sir?hehehe

probably bang my head against a wall ....... or wud better try to reinstall borland on my pc.. which 1 is a better idea sir?hehehe

How about posting your current code, so we can have a look at it?

Edited 6 Years Ago by Nick Evan: n/a

How about posting your current code, so we can have a look at it?

the code is still d same sir........

the code is still d same sir........

So how do you figure it's going to work when you don't change it? We gave you plenty tips to fix it.

This article has been dead for over six months. Start a new discussion instead.