LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   make command for an application (http://www.linuxquestions.org/questions/programming-9/make-command-for-an-application-821193/)

aa.bb.cc 07-21-2010 02:40 AM

make command for an application
 
hello

i have made a small program to find the md5 checksum of a string.i am using xshell to compile the program.
Code:

#include <string.h>

#include <stdio.h>
#include <sys/types.h>
#include <md5.h>

int main(int argc, char * argv) {
        MD5_CTX context;
        char digest[33];
        const char * p = "hello";
        const char * p2 = " world\n";
        MD5Init(&context);
        MD5Update(&context,(const void*) p, 5);
        MD5Update(&context,(const void*) p2, 7);
        MD5End(&context,digest);
        printf("%s\n", digest);
   
    return 0;
}

can you please tell me what should be the make command for this program. i tried using -I switch, didnt work.

thanks in advance

Sergei Steshenko 07-21-2010 03:25 AM

Quote:

Originally Posted by aa.bb.cc (Post 4040354)
... i tried using -I switch, didnt work. ...

  1. what was the full command line ?
  2. what documentation and/or tutorials did you read ?
  3. which keywords did you use while performing WEB search (if any) ?

JohnGraham 07-21-2010 03:36 AM

Quote:

Originally Posted by aa.bb.cc (Post 4040354)
can you please tell me what should be the make command for this program. i tried using -I switch, didnt work.

What exactly have you tried? If you're determined to use make, and your file is saved as (say) program.c, then you should just be able to issue the command "make program". If this goes wrong, please cut and paste the complete output of the command.

(I must stress the cut and paste (don't try and type it out) and complete. Please don't just cut and paste the first/last section of the output - if you don't know what you're looking for, you may miss something important we can use to help you.)

bigearsbilly 07-21-2010 04:11 AM

I explained in another thread!
You need to link the library.

try this: (I called your code aa.c)
Code:

export LDLIBS=-lmd
make aa
cc -O2 -pipe  aa.c -lmd -o aa


MTK358 07-21-2010 07:27 AM

Quote:

Originally Posted by aa.bb.cc (Post 4040354)
i am using xshell to compile the program.

What is "xshell"?


All times are GMT -5. The time now is 06:03 PM.