Thread: Linker Error (Severity 8) when using Miracle C Workbench

  1. #1
    Registered User
    Join Date
    Jun 2003
    Posts
    6

    Question Linker Error (Severity 8) when using Miracle C Workbench

    I am a student, but not looking for anyone to re-write code. I just need some direction with this error code.

    My code:
    Code:
    /* Currency Converter Program */
    /* This program displays 5 currencies and their equivalents to the US dollar */
    
    #include <stdio.h>
    #include <ctype.h>
    
    #define Pound .595817;
    #define Yen 118.258;
    #define Ruble 30.3800;
    #define Rand 7.91769;
    #define Peso 10.6205;
    
    
    int main (void)
    {
    /* Declaration and Initialization of Variables to be Utilized */
    
    float value = 0.00;
    float amount = 0.00;
    char answer;
    
    /* The follwing 3 lines are static information displayed on the screen to announce the program */
    printf("Currency Conversion \n");
    printf("Exchange Rates Retrieved On 18 June 2003  12:35 PM EST and Are No Longer Accurate \n\n\n\n");
    
    printf("\t\t\t\t Currency Selection \n\n\n");
    printf("\t\t\t 1. United Kingdom Pound \n\n");
    printf("\t\t\t 2. Japanese Yen \n\n");
    printf("\t\t\t 3. Russian Ruble \n\n");
    printf("\t\t\t 4. South African Rand \n\n");
    printf("\t\t\t 5. Mexican Peso \n\n\n\n");
    
    {
           int choice;
           printf("\t\t\t Please select which currency equivalent you would like to see \n");
           printf("\t\t\t Or enter q to Quit\n\n");
           while ((choice=getchar())!='q')
           {
                        switch(choice)
                        {
                             case 1:
                                   printf("\t\t\t Please enter the amount of American money you have \n");
                                   scanf("%f", &amount);
                                   value = amount*Pound
                                   printf("\t\t\t Your American money converts to $%.2f in United Kingdom Pounds. \n\n", value);
                                   printf("--------------------------------------\n\n");
                                   printf(" Please enter a US Dollar Amount:\n\n ");  // Enter Dollar Amount
                                   scanf("%f",&amount);
                                   printf("Please make another currency selection, or'q' to quit \n");
                                   break;
                             case 2:
                                   printf("\t\t\t Please enter the amount of American money you have \n");
                                   scanf("%f", &amount);
                                   value = amount*Yen
                                   printf("\t\t\t Your American money converts to $%.2f in Japanese Yen. \n\n", value);
                                   printf("--------------------------------------\n\n");
                                   printf(" Please enter a US Dollar Amount:\n\n ");  // Enter Dollar Amount
                                   scanf("%f",&amount);
                                   printf("Please make another currency selection, or'q' to quit \n");
                                   break;
                             case 3:
                                   printf("\t\t\t Please enter the amount of American money you have \n");
                                   scanf("%f", &amount);
                                   value = amount*Ruble
                                   printf("\t\t\t Your American money converts to $%.2f in Russian Rubles. \n\n", value);
                                   printf("--------------------------------------\n\n");
                                   printf(" Please enter a US Dollar Amount:\n\n ");  // Enter Dollar Amount
                                   scanf("%f",&amount);
                                   printf("Please make another currency selection, or'q' to quit \n");
                                   break;
                             case 4:
                                   printf("\t\t\t Please enter the amount of American money you have \n");
                                   scanf("%f", &amount);
                                   value = amount*Rand
                                   printf("\t\t\t Your American money converts to $%.2f in South American Rands. \n\n", value);
                                   printf("--------------------------------------\n\n");
                                   printf(" Please enter a US Dollar Amount:\n\n ");  // Enter Dollar Amount
                                   scanf("%f",&amount);
                                   printf("Please make another currency selection, or'q' to quit \n");
                                   break;
                             case 5:
                                   printf("\t\t\t Please enter the amount of American money you have \n");
                                   scanf("%f", &amount);
                                   value = amount*Peso
                                   printf("\t\t\t Your American money converts to $%.2f in Mexican Pesos. \n\n", value);
                                   printf("--------------------------------------\n\n");
                                   printf(" Please enter a US Dollar Amount:\n\n ");  // Enter Dollar Amount
                                   scanf("%f",&amount);
                                   printf("Please make another currency selection, or'q' to quit \n");
                                   break;
                             default :
                                   printf("\t\t\t Invalid Entry");
                                   printf("\t\t\t Please choose another currency or 'q' to quit \n");
                                   break;
                         }
            }
     
     }
       getchar();
       return 0;
     
    }
    App seems to Compile fine, but bombs in Build:

    Miracle C Compiler (r3.2), written by bts.
    Compiling c:\documents and settings\larcyn\my documents\dad\phoenix material\pos 370\first currency converter\currency3.c
    main

    2% cg space used
    Time taken: 0.12 seconds

    Linking object c:\documents and settings\larcyn\my documents\dad\phoenix material\pos 370\first currency converter\currency3.obj,,c:\documents and settings\larcyn\my documents\dad\phoenix material\pos 370\first currency converter\currency3.map,c:\Program Files\Miracle C\ccl.lib ;

    Linker Error (Severity 8)
    Destination string too small (256 bytes) to hold:
    "c:\documents and settings\larcyn\my documents\dad\phoenix material\pos 370\first currency converter\currency3.obj,,c:\documents and settings\larcyn\my documents\dad\phoenix material\pos 370\first currency converter\currency3.map,c:\Program Files\Miracle C\ccl.lib ;" (265 bytes)

    Build completed

    As a result, the app will not execute. I know this post is long, but I wanted to give all pertinent info. Any help and/or advice would be greatly appreciated.


    Code tags added by Hammer

  2. #2
    Registered User
    Join Date
    Jan 2003
    Posts
    115
    please use the code tags
    hard to read..


    >> value = amount*Pound
    >> value = amount*Yen

    seems like all the value
    forget the ';' ?

    and use double not float
    and change the conversion to %lf
    Last edited by kurz7; 06-25-2003 at 08:25 PM.
    there are only 10 people in the world, those who know binary and those who dont

  3. #3
    Registered User
    Join Date
    Jun 2003
    Posts
    6
    You're right Kurz, I apologize and it is very hard to read. Once I posted I realized my error. Thank you for your reply though!

  4. #4
    Registered User
    Join Date
    Jan 2003
    Posts
    115
    and also you never used your local variable "answer"
    there are only 10 people in the world, those who know binary and those who dont

  5. #5
    Registered User
    Join Date
    Jun 2003
    Posts
    6
    Fixed all the errors pointed out by Kurz, but I still get the same error during the build. Any idea what 'Destination string too small' means?
    Last edited by lbyram; 06-25-2003 at 08:34 PM.

  6. #6
    Registered User
    Join Date
    Jan 2003
    Posts
    115
    your program compiles on my machine but it doesnt work as planned.
    Perhaps you could fix that up also.
    there are only 10 people in the world, those who know binary and those who dont

  7. #7
    C++ Developer XSquared's Avatar
    Join Date
    Jun 2002
    Location
    Ontario, Canada
    Posts
    2,718
    Miracle C is not a good C compiler. Try Dev-C++ for a free compiler. Despite the name, it compiles both C and C++.
    Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah

    You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie

  8. #8
    Just Lurking Dave_Sinkula's Avatar
    Join Date
    Oct 2002
    Posts
    5,005
    >Any idea what 'Destination string too small' means?

    To me it looks like the command line is too long because of the paths. This is to say that if the project files were in a directory like c:\mycode\cc3 you wouldn't be having the linker problem.
    7. It is easier to write an incorrect program than understand a correct one.
    40. There are two ways to write error-free programs; only the third one works.*

  9. #9
    julie lexx... btq's Avatar
    Join Date
    Jun 2002
    Posts
    161
    this is just a pure guess as I don't know the compiler or what linker it uses, but it seems out-dated as old apps are
    often restricted to 256-byte-strings when accessing various
    functions in the API.

    Anyways, it's not the code causing this error it's the linker.
    You might wanna try another IDE (perhaps DEV-C++ since it's free)or see if you
    can change linker settings (using a newer linker ) in your
    current one. Or see if you can compile .obj files with you're current
    one and link them from the command line.
    I'd go with downloading DEV-C++ or something similar though



    /btq
    ...viewlexx - julie lexx

  10. #10
    Registered User
    Join Date
    Jun 2003
    Posts
    6
    With the coding tips from Kurz7 and the path tip from Dave, I am happy to say that I now have a functional, albeit ugly, program. I cannot believe the response I received from this post and the speed with which you were all so willing to help. I only hope I can return the favor once I get my feet wet!

    Thanks to everyone involved, and I will be checking out the other compilers that were mentioned.

  11. #11
    Registered User
    Join Date
    Jun 2003
    Posts
    6
    Thanks for the heads up on the compiler Salem. As evidenced by my original post, I am new to this and am using the compiler supplied by my instructor. I will be changing that today!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Linker errors
    By jw232 in forum C++ Programming
    Replies: 3
    Last Post: 06-12-2009, 12:56 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, 01: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 error using system(*.*)
    By Winston4u in forum C Programming
    Replies: 5
    Last Post: 05-09-2003, 05:54 PM