Error Compiling

This is a discussion on Error Compiling within the C Programming forums, part of the General Programming Boards category; I'm new to C programming. There is a program written for unix that I need to get to work on ...

  1. #1
    Registered User
    Join Date
    Aug 2005
    Posts
    80

    Error Compiling

    I'm new to C programming. There is a program written for unix that I need to get to work on a Windows XP machine. I'm able to get it to compile, but it the executable doesn't work. I think it has to something to do with the following warning I get when trying to compile:

    ATSYMB.INC(29,21):Cannot create pre-compiled header:initialized data in header.

    I've tried searching for information on this error and haven't had any luck. Can someone explain this error or point me in the right direction? Below is the source for ATSYMB.INC:

    Code:
    /*
     * symbols initialize
     */
    /*
     * conversion note from Fortran to C:
     * There is a great deal of dependency by the Fortran
     * code on 1-based data arrays. Therefore, the C will
     * make all data arrays 1 item longer, and use 1-based
     * loops for them. We will handle character strings
     * as zero-based, per C usage. 
     *
     * Not the best solution, * but it will be a lot closer 
     * to the algorithms of the original authors.
     */
    
    /*
     * this set of symbols is treated as an array
     * of 2-character element symbols. Each symbol
     * is a null-delimited string. The list
     * is terminated by NULL, for searching
     * purposes.
     *
     */
    
    /* we only initialize once */
    
    #ifdef MAIN_PROGRAM
    
    	char 	*atsymb[] = {"D ",
         "H ",  "He",  "Li",  "Be",  "B ",  "C ",  "N ",
         "O ",  "F ",  "Ne",  "Na",  "Mg",  "Al",  "Si",
         "P ",  "S ",  "Cl",  "Ar",  "K ",  "Ca",  "Sc",
         "Ti",  "V ",  "Cr",  "Mn",  "Fe",  "Co",  "Ni",
         "Cu",  "Zn",  "Ga",  "Ge",  "As",  "Se",  "Br",
         "Kr",  "Rb",  "Sr",  "Y ",  "Zr",  "Nb",  "Mo",
         "Tc",  "Ru",  "Rh",  "Pd",  "Ag",  "Cd",  "In",
         "Sn",  "Sb",  "Te",  "I ",  "Xe",  "Cs",  "Ba",
         "La",  "Ce",  "Pr",  "Nd",  "Pm",  "Sm",  "Eu",
         "Gd",  "Tb",  "Dy",  "Ho",  "Er",  "Tm",  "Yb",
         "Lu",  "Hf",  "Ta",  "W ",  "Re",  "Os",  "Ir",
         "Pt",  "Au",  "Hg",  "Tl",  "Pb",  "Bi",  "Po",
         "At",  "Rn",  "Fr",  "Ra",  "Ac",  "Th",  "Pa",
         "U ",  "Np",  "Pu",  "Am",  "Cm",  "Bk",  "Cf",
         "Es",  "Fm",  "Md",  "No",  "Lr",  "R ",NULL};
    #else
    	extern char 	*atsymb[];
    #endif

  2. #2
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,831
    Turn off pre-compiled headers.

    BTW, reading the comment there, you can make Fortran arrays zero based by specifying the lower bound. Eg.

    Integer*4 Array(10) will be Array(1), Array(2)... Array(10)
    Integer*4 Array(0:9) will be Array(0), Array(1)... Array(9)
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  3. #3
    Registered User
    Join Date
    Aug 2005
    Posts
    80

    Thanks for your reply

    The information you provided is useful. The Fortran information you gave me will come in handy because there are other parts of this project that I need to convert from Fortran to C yet.


    I'm very new to programming, so I'll probably have many more posts. Trying to learn as much as possible on my own, but find myself getting stuck fairly often.

    James

  4. #4
    Registered User
    Join Date
    Aug 2005
    Posts
    80

    getopt() problems

    I turned off precompiled headers and it got rid of the error.

    I'm down to figuring out how to convert the Unix command line processor function getopt() to Windows. I've been having alot of difficulty with this.

    There is a program called XGetOpt, which sounds great but my program is in C versus C++ and it doesn't include MFC functions.

    Is it possible to include XGetOpt (a c++ program) in a C program if I include the MFC framework?

    Any advice is appreciated.

    James

Popular pages Recent additions subscribe to a feed

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