3 Replies - 1768 Views - Last Post: 01 January 2013 - 06:17 AM Rate Topic: **--- 2 Votes

#1 NitinJotwani  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 20
  • Joined: 28-September 12

error as unknown preprocessor directive:warning

Posted 27 December 2012 - 09:40 AM

im tring to use C Preprocessor directive #warning, but im getting error in ma code
//PreProcessor Conditional Compilation
#include<stdio.h>
#include<conio.h>
#define Num 85
int main(void)
{
	clrscr();
	#ifdef Num
		printf("Num is Defined to %d",Num);
	#endif
	#ifndef Number
		#warning Number is not defined
		printf("\nNumber is Not Defined");
	#else
		#error Preprocessor NEVER reaches here
		printf("\nNumber is Defined to %d",Number);
	#endif
	getch();
	return 0;
}



Is This A Good Question/Topic? 0
  • +

Replies To: error as unknown preprocessor directive:warning

#2 sepp2k  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2151
  • View blog
  • Posts: 3,307
  • Joined: 21-June 11

Re: error as unknown preprocessor directive:warning

Posted 27 December 2012 - 09:52 AM

#warning is not a standard directive - it's not supported by all compilers. If you get an error when trying to use #warning, you might be using a compiler that does not support it.
Was This Post Helpful? 1
  • +
  • -

#3 no2pencil  Icon User is offline

  • Admiral Fancy Pants
  • member icon

Reputation: 5382
  • View blog
  • Posts: 27,350
  • Joined: 10-May 07

Re: error as unknown preprocessor directive:warning

Posted 27 December 2012 - 09:56 AM

& seeing conio.h in there, I would assume either this code came from a project designed to be used with the Borland Turbo C++ compiler, or that is what you are using. Either way I agree with sepp2k that the code as designed will not work with whatever compiler you are using.
Was This Post Helpful? 1
  • +
  • -

#4 NitinJotwani  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 20
  • Joined: 28-September 12

Re: error as unknown preprocessor directive:warning

Posted 01 January 2013 - 06:17 AM

yes sepp2k is right, i also googled for this n found similar result's.
@no2pencil, yes i used this in turbo c++ compiler.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1