Page 2 of 2 FirstFirst 12
Results 11 to 16 of 16

Thread: C programming compiling error,please help!

  1. #11
    Join Date
    Feb 2009
    Location
    Baton Rouge
    Beans
    120
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: C programming compiling error,please help!

    Alexander
    i joined Gateway users to try and find help for my wireless its a t6330u i tried several times to send you a message asking about this but the forum wont let
    says i need more posts in order to send a message
    xoxo
    jes

  2. #12
    Join Date
    Jan 2007
    Location
    heaven , Malaysia
    Beans
    806

    Re: C programming compiling error,please help!

    that is not my code,i got it from one of website,does it mean that code is just dummy code...?it is posted there but isn't usable...i'm trying to make des encryption in c or c++(that able to execute,at least)...any help would be appreciated .TQ
    もう誰かのためじゃなくて 自分のために笑っていいよ
    ~ Please do mark as resolved thread if your problem is solved,thanks~

  3. #13
    Join Date
    May 2008
    Location
    UK
    Beans
    1,451
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: C programming compiling error,please help!

    Alexender - what C code have you written allready ? (The reason I ask is that the need for a main() is requirement for ALL C programs, and it is C language 101 - if you are struggling with the concept then you should go back and re-read your c programming books/tutorials/lessons - and start with something easier).

    In your specific case :

    your des.c and des.h together define two public functions :
    Code:
    void EncryptDES(bool key[56], bool outBlk[64], bool inBlk[64], int verbose); 
    
    void DecryptDES(bool key[56], bool outBlk[64], bool inBlk[64], int verbose);
    These functions will need to be called, by you, before they work.

    What you will to do is to write a 2nd .c file (your application) which includes a main() function, and which calls the EncryptDES and DecryptDES functions appropriately (it will probably do a lot else as well).

    assuming you have created your des.o file as follows :
    Code:
    gcc -c des.c -o des
    des.o is a object module - you can link other things to it, but not run it.

    If you have called your application source code file main.c - then you will be able to build your application by compiling :
    Code:
    gcc main.c des.o -o application
    This compiles main.c and links it to des.o and creates an executable (in your current directory) called application.

    and then run it via
    Code:
    ./application
    NOte : My primary language is Python and the gcc commands above maybe incorrect - if they are i apologise and i am sure other in this forum will provide corrections as neccessary
    Tony - Happy to try to help.
    Unless otherwise stated - all code posted by me is untested. Remember to Mark the Thread as Solved.
    Ubuntu user number # 24044 Projects : TimeWarp - on the fly Backups

  4. #14
    Join Date
    Jan 2007
    Location
    heaven , Malaysia
    Beans
    806

    Re: C programming compiling error,please help!

    i know that every c script needs main() to run...but because that website doesn't provide any of it....i ask here if there any way to run the code without main (without error)....i frequently use whatever.h as header file,but i admit i never call public function from other file and use it in other file....(i do that only in JAVA)..tq for noted me that i'm need to do that.thank you
    もう誰かのためじゃなくて 自分のために笑っていいよ
    ~ Please do mark as resolved thread if your problem is solved,thanks~

  5. #15
    Join Date
    Jun 2007
    Location
    Maryland, US
    Beans
    6,288
    Distro
    Kubuntu

    Re: C programming compiling error,please help!

    There is no way to call this DES functions w/o a main() function. Similarly in Java, a "public static main()" function is required.

    I will cheerfully develop the main() function for you if you would be so kind as to provide documentation as to how the two DES functions should be used.

    I need to know the specifics as to what data should be placed in each of the arrays that the functions require.

  6. #16
    Join Date
    Jan 2007
    Location
    heaven , Malaysia
    Beans
    806

    Re: C programming compiling error,please help!

    Quote Originally Posted by dwhitney67 View Post
    There is no way to call this DES functions w/o a main() function. Similarly in Java, a "public static main()" function is required.

    I will cheerfully develop the main() function for you if you would be so kind as to provide documentation as to how the two DES functions should be used.

    I need to know the specifics as to what data should be placed in each of the arrays that the functions require.
    Quote Originally Posted by AlexenderReez View Post
    i know that every c script needs main() to run...but because that website doesn't provide any of it....i ask here if there any way to run the code without main (without error)....i frequently use whatever.h as header file,but i admit i never call public function from other file and use it in other file....(i do that only in JAVA)..tq for noted me that i'm need to do that.thank you
    i'm blur , thank you for help
    もう誰かのためじゃなくて 自分のために笑っていいよ
    ~ Please do mark as resolved thread if your problem is solved,thanks~

Page 2 of 2 FirstFirst 12

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •