Wednesday, June 15, 2011

 

Ifdef preprocessing

These provide a rapid way to "clip" out and insert code.

Consider;

     #define FIRST

main()
{
int a, b, c;

#ifdef FIRST
a=2; b=6; c=4;
#else
printf("Enter a:");
scanf("%d", &a);

printf("Enter a:");
scanf("%d", &a);

printf("Enter a:");
scanf("%d", &a);
#endif
additonal code

Note that if FIRST is defined (which it is in the above) the values of a, b and c are hardcoded to values of 2, 6 and 4. This can save a lot of time when developing software as it avoids tediously typing everything in each and everytime you run your routine. When FIRST is defined, all that is passed to the compiler is the code between the #ifdef and the #else. The code between the #else and the #endif is not seen by the compiler. It is as if it were all a comment.

source: http://www.phanderson.com/C/preprocess.html


 

crypto.h:12:26: error: openssl/hmac.h: No such file or directory

If you get something similar to:

 crypto.h:12:26: error: openssl/hmac.h: No such file or directory
crypto.h:13:25: error: openssl/sha.h: No such file or directory
crypto.h:15:25: error: openssl/rc4.h: No such file or directory
crypto.h:16:25: error: openssl/aes.h: No such file or directory

solution:

$sudo apt-get install openssl
$sudo apt-get install libssl-dev


This page is powered by Blogger. Isn't yours?