new to C--can't get program to compile

This is a discussion on new to C--can't get program to compile within the C Programming forums, part of the General Programming Boards category; Hi. I'm an experienced MATLAB programmer, but know nothing about lower level languages like C. I want to analyze some ...

  1. #1
    Registered User
    Join Date
    Mar 2007
    Posts
    2

    new to C--can't get program to compile

    Hi. I'm an experienced MATLAB programmer, but know nothing about lower level languages like C. I want to analyze some sea surface height data available from http://podaac.jpl.nasa.gov/. I can download the data files, but they are in some unknown binary format, and I can't read them. A C program is provided at http://aspera.jpl.nasa.gov/download/.../c/atgdmp_v2.c which dumps the data to some more readable format. My problem is I can't get the program to run. Having no C compiler, I downloaded one (called Miracle C Compiler) from www.c-compiler.com. But when I try to compile the program, I get:

    too many locals declared
    'short ssha[3127]'
    aborting compile

    Am I doing something wrong? Is there maybe a limit on the size of variables because it's a free trial C compiler? Should I try downloading a different compiler? There seem to be more compilers for C# and C++ than for plain old C. Will these work?

    Thanks a million for any insight.

    Samerune

  2. #2
    CSharpener vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,484
    as I remeber Salem once mentioned that Miracle C is some study project...

    get some real compiler - there are several free available like MS VS Express 2005 - you can find a list with links in the FAQ
    The first 90% of a project takes 90% of the time,
    the last 10% takes the other 90% of the time.

  3. #3
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,484
    Yeah, Miracle C is a toy - not a compiler.

    All the compilers like visual studio express, dev-c++, GCC are all perfectly capable (and $0) of compiling C or C++.
    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.

  4. #4
    Registered User
    Join Date
    Jan 2007
    Posts
    16
    Go with Dev-C++, it's the least tricky to learn, easy to link libraries with and add arguments to main without having to modify any file or entering cmd.exe manually and starting up your compiled program. And other great things...

    I personaly think that Microsoft Visual products are crap, but that's just me.

  5. #5
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,046
    Many people also like Code::Blocks (especially since Dev-C++ is dead . . . well, it's not being developed anymore), although I must say that I've never used it myself.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  6. #6
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    Why does everyone forget to mention LCC?

  7. #7
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,046
    From http://www.cs.virginia.edu/~lcc-win32/:
    This software is not freeware, it is copyrighted by Jacob Navia. It's free for non-commercial use, if you use it professionally you have to have to buy a licence.
    If I had a choice I'd use a free compiler, especially if I was recommending it to someone that might not be able to use it under the license agreement.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  8. #8
    Registered User
    Join Date
    Mar 2007
    Posts
    8
    Quote Originally Posted by dwks View Post
    Many people also like Code::Blocks (especially since Dev-C++ is dead . . . well, it's not being developed anymore), although I must say that I've never used it myself.

    I prefer dev-C++ myself. But I agree, the IDE is dead, but the devpaks's over a given period tend to have updates for MingW associated with it, which is all you really need. Dispite I think they need to churn out some more updates for Dev-C++..

  9. #9
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,046
    I'd help myself, but it's written in Delphi. Can you believe it? A C/C++ IDE written in Delphi.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  10. #10
    Registered User Joelito's Avatar
    Join Date
    Mar 2005
    Location
    Tijuana, BC, México
    Posts
    308
    Quote Originally Posted by dwks View Post
    I'd help myself, but it's written in Delphi. Can you believe it? A C/C++ IDE written in Delphi.
    Yeah! That's why I left Dev-C++ way long time ago....insulting poor C & C++ users
    Visual C++ 2005 express all the way
    * PC: Intel Core 2 DUO E6550 @ 2.33 GHz with 2 GB RAM: Archlinux-i686 with xfce4.
    * Laptop: Intel Core 2 DUO T6600 @ 2.20 GHz with 4 GB RAM: Archlinux-x86-64 with xfce4.

  11. #11
    Woof, woof! zacs7's Avatar
    Join Date
    Mar 2007
    Location
    Australia
    Posts
    3,459
    I prefer PellesC myself (modified LCC) -> http://www.smorgasbordet.com/pellesc/

    With its own beautiful IDE

  12. #12
    Registered User
    Join Date
    Mar 2007
    Posts
    2
    Thanks, everyone. I downloaded a different compiler--LCC. "hello world" works, but unfortunately, I still can't get the program I need to use to compile. I get a whole string of warnings along the lines of "Missing prototype for exit", and then finally "Error undefined reference to _get_hdr_param". The program I'm trying to get to run is at

    http://aspera.jpl.nasa.gov/download/.../c/atgdmp_v2.c

    I guess I need to learn C from the ground up, but obviously that will take a while, and I'd really like to get this program to run sooner. If there's something obvious I need to do to get this to work, I'd really appreciate if is someone could point it out. Thanks again.

  13. #13
    Mad OnionKnight's Avatar
    Join Date
    Jan 2005
    Location
    Umeå, Sweden
    Posts
    555
    The warning about exit() not being prototyped could be avoided by putting #include <stdlib.h> together with the other #include directives.
    The error is due to the fact that there is no get_hdr_param function defined in the code (and it couldn't be found in the compiler's libraries either), and in the parent directory of the link you provided there is a get_hdr_param.c containing the function.
    What you need to do is compile that file together with atgdump_v2.c. I haven't used LCC but if it's like gcc you'd probably only need to do something like
    lcc -o atgdump_v2.exe atgdump_v2.c get_hdr_param.c

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Program Plan
    By Programmer_P in forum C++ Programming
    Replies: 0
    Last Post: 05-11-2009, 01:42 AM
  2. Compile Public Domain Pocket PC C Program
    By m1l in forum Projects and Job Recruitment
    Replies: 2
    Last Post: 07-20-2007, 04:02 AM
  3. Using variables in system()
    By Afro in forum C Programming
    Replies: 8
    Last Post: 07-03-2007, 12:27 PM
  4. Replies: 1
    Last Post: 02-13-2003, 07:08 AM
  5. how do i compile a program that deals w/classes?
    By Shy_girl_311 in forum C++ Programming
    Replies: 5
    Last Post: 11-11-2001, 01:32 AM

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