Like Tree2Likes
  • 1 Post By Salem
  • 1 Post By CommonTater

Linker error help

This is a discussion on Linker error help within the C Programming forums, part of the General Programming Boards category; Hi, I would like to ask for some help I'm using turbo c. I search a code from the net ...

  1. #1
    Registered User
    Join Date
    Mar 2011
    Posts
    6

    Linker error help

    Hi,

    I would like to ask for some help I'm using turbo c. I search a code from the net here's the code
    Code:
    #include <time.h>
    	#include <stdio.h>
    
    	int main(void)
    	{
    		struct tm str_time;
    		time_t time_of_day;
    
    		str_time.tm_year = 2012-1900;
    		str_time.tm_mon = 6;
    		str_time.tm_mday = 5;
    		str_time.tm_hour = 10;
    		str_time.tm_min = 3;
    		str_time.tm_sec = 5;
    		str_time.tm_isdst = 0;
    
    		time_of_day = mktime(&str_time);
    		printf(ctime(&time_of_day));
    
    		return 0;
    	}
    I don't know why I'm encountering LINKER ERROR: UNDEFINED SYMBOL _STRUCT IN MODULE

    please I need some help
    Last edited by bonks; 03-15-2011 at 07:08 AM.

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,532
    There is no help for you if you're using TurboC.

    Tell us your real OS, and we can suggest some real compilers.

    Also, if you missed the intro threads on HOW TO POST CODE (which you did), what does that say about your attention to detail?
    rags_to_riches likes this.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Registered User
    Join Date
    Mar 2011
    Posts
    6
    I'm currently using windows XP. I'm using Turbo C version 2.01, because a friend of mine introduced it to me. I'm a beginner in using Turbo C and I was curious to learn it and sorry for the messy code I created earlier

  4. #4
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,532
    Consider one of the following
    Downloads - get the larger "mingw" package, as this one is the IDE and compiler.

    smorgasbordet - Pelles C

    Visual Studio2010 Express Editions |Microsoft Visual Studio


    If you really want to make sure the code you're writing is good, then download all of them
    If the same code works with several compilers, you're probably doing it right.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  5. #5
    Registered User
    Join Date
    Mar 2011
    Posts
    6
    @Salem

    I've already tried the code using turbo c+, and it works fine. Thank you for the different compilers but the thing is I need to write this code using Turbo C. I want to learn if Turbo C can handle military time.

    I'm a bit curios if turbo C can handle time that is input by the user, because I wrote a program that computes the total hours worked by an employee. In the program I wrote I used atoi() to compute the time. I wanted to simplify it or make my code shorter by using time.h that is why I wanted to learn why I'm encountering the Linker error.
    Last edited by bonks; 03-16-2011 at 02:43 AM.

  6. #6
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by bonks View Post
    @Salem

    I've already tried the code using turbo c+, and it works fine. Thank you for the different compilers but the thing is I need to write this code using Turbo C. I want to learn if Turbo C can handle military time.

    I'm a bit curios if turbo C can handle time that is input by the user, because I wrote a program that computes the total hours worked by an employee. In the program I wrote I used atoi() to compute the time. I wanted to simplify it or make my code shorter by using time.h that is why I wanted to learn why I'm encountering the Linker error.
    Ok, lets see if we can get this to sink in...

    Turbo C and Turbo c++ are ancient compilers made to work with equipment that now sits in museums. Most computers these days are 64 bits, operating systems are slowly moving to 64 bits... your compiler is 16 bits... The programs it produces won't run on current 64 bit platforms and soon won't run at all.

    How to say this gently...
    Whatever you write in Turbo C is automatically garbage simply because of the age of the compiler.

    At a bare minimum you need a compiler that can work both 32 and 64 bit executables. Of the links already given... Pelles C is your best bet.

    Now if you have software out there running on Turbo C... you can update it to newer compilers without too much muss and fuss. In fact you're soon going to be left no choice but to do that as its' only a matter of updates until your 16 bit code stops working altogether.
    ಠ_ಠ likes this.

  7. #7
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,532
    > I want to learn if Turbo C can handle military time.
    And you think it's going to handle Y2K issues - it's 1980's technology.

    Listen, we simply don't care any more about supporting that old fossil. Support around the web is drying up - make a choice, if you don't want to be stranded in the middle of the desert.

    > I want to learn if Turbo C can handle military time.
    And you think it's going to handle Y2K issues - it's 1980's technology.

    Listen, we simply don't care any more about supporting that old fossil. Support around the web is drying up - make a choice, if you don't want to be stranded in the middle of the desert.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  8. #8
    Registered User
    Join Date
    Mar 2011
    Posts
    6
    @Salem

    Thanks for that information I'll just do the things you told me, can I have a heads up if Pelles C can handle the issue about the Military time?

  9. #9
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    All C compilers handle military time, and have done so since computers were invented.

    The a.m and p.m time format is just another convenience they added, later.

    You'll love Pelles C.

  10. #10
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,532
    Specifically, look up gmtime() and localtime()
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  11. #11
    Registered User
    Join Date
    Mar 2011
    Posts
    6
    I would like to ask if C compilers can handle military time that is inputted by the user and also if C compilers has a function to be able to compute the inputted the difference of 2 time. Example 1st time 08:00 2nd time is 13:00 and difference is 4 hrs. can I use difftime in this situation?

  12. #12
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,532
    Yes, you can use difftime
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  13. #13
    Registered User
    Join Date
    Mar 2011
    Posts
    6
    @salem
    Do you have a tutorial on how to use Pelles I would like to know how to use it. Thanks

  14. #14
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,532
    Any pelles tutorials will be on the pelles website.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  15. #15
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Quote Originally Posted by bonks View Post
    @salem
    Do you have a tutorial on how to use Pelles I would like to know how to use it. Thanks
    The best PellesC tutorial is it's own help file....

    Open the IDE, click help -> Contents and start reading.

    It's one of the most complete help files I've ever seen. All library calls are detailed as well as IDE usage and a lot of information about C99 as well.

    If you need a beginners tutorial on C itself, there is a good one on this Forum's parent site. or you can google "C99 tutorial" and take your pick.
    Last edited by CommonTater; 03-17-2011 at 08:20 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Linker question
    By ryanfx in forum C Programming
    Replies: 2
    Last Post: 03-22-2010, 04:20 PM
  2. Linker problem... no idea
    By cyreon in forum C Programming
    Replies: 2
    Last Post: 04-03-2009, 02:53 PM
  3. linker
    By George2 in forum C++ Programming
    Replies: 6
    Last Post: 02-23-2008, 12:25 AM
  4. Linker errors in VC++ 2005
    By C+/- in forum C++ Programming
    Replies: 0
    Last Post: 05-18-2007, 07:42 AM
  5. Linker errors when compiling
    By The Wazaa in forum C++ Programming
    Replies: 4
    Last Post: 10-07-2006, 12:55 PM

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