Prob with typedef

This is a discussion on Prob with typedef within the C Programming forums, part of the General Programming Boards category; Hi all, I wrote this function which takes a struct type Time and returns the total number of seconds. anyway, ...

  1. #1
    Unregistered
    Guest

    Prob with typedef

    Hi all,
    I wrote this function which takes a struct type Time and returns the total number of seconds. anyway, the part that I am having a problem with is this one:
    int functime(Time parm)
    {
    t_n_s = ((3600 * Time.hours) + (Time.minutes) + Time.seconds);
    return t_n_s;
    }
    I get an error saying that "Time was declared as typedef and cannot occur as an expression".
    Can someone tell me what I am doing wrong.Any help will be greatly appreciated.
    Thanks
    Janis

  2. #2
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    t_n_s = ((3600 * Time.hours) + (Time.minutes) + Time.seconds);

    should be

    t_n_s = ((3600 * parm.hours) + (parm.minutes) + (parm.seconds);

    Time is the type of the variable, parm is the identifier which is used in expressions.

    -Prelude
    My best code is written with the delete key.

  3. #3
    Unregistered
    Guest
    I get it,
    Thanks a lot.

  4. #4
    Unregistered
    Guest

    another problem

    Now awhen I compile it I get:
    ld:
    Unresolved:
    main

    What does it mean?
    Thanks

  5. #5
    Im back! shaik786's Avatar
    Join Date
    Jun 2002
    Location
    Bangalore, India
    Posts
    345
    It means you have not written the function main() at all in your program. Remember, in a C Program, the first function to be called is this one.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 09:18 PM
  2. Need help understanding info in a header file
    By hicpics in forum C Programming
    Replies: 8
    Last Post: 12-02-2005, 12:36 PM
  3. Please STICKY this- vital to MSVC 6 dev - BASETSD.h
    By VirtualAce in forum Game Programming
    Replies: 11
    Last Post: 03-15-2005, 09:22 AM
  4. build errors migrated from dx9b to dx9c sdk
    By reanimated in forum Game Programming
    Replies: 4
    Last Post: 12-17-2004, 07:35 AM
  5. oh me oh my hash maps up the wazoo
    By DarkDays in forum C++ Programming
    Replies: 5
    Last Post: 11-30-2001, 12:54 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21