Results 1 to 9 of 9

Thread: Linking: fatal error LNK1143

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 2000
    Location
    Auckland, NZ
    Posts
    182

    Linking: fatal error LNK1143

    Could anyone help me to find what is wrong with my program. When I compiled it, I received such error message:
    "libcid.lib(streamb1.obj) : fatal error LNK1143: invalid or corrupt file: no symbol for comdat section 0x3
    Error executing link.exe."

    I made the program in Borland Builder and it was OK, but when I tryed to compile it in MS VC++ 6.0 I have got a linker error. I created a project Win32 console and pasted all code into 3 files: one main .cpp - driver program and another .cpp - small file with only one class and .h file for it.

    I would appreciate any help.
    Thanks

  2. #2
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Are you using .lib files designed for Borland?
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Nov 2000
    Location
    Auckland, NZ
    Posts
    182
    Thanks parksie.
    I think that a am using both libraries. I have installed Borland an MS VC.
    So far I found one strange things: the problem is in a driver. And the problem seems to be a while loop which I am using for a menu. When I deleted this loop all OK, but when I am trying to use menu routines even with different implementation but all use the while, I getting the same linker error. This sounds strange, but this is fact. Now I will try to find how to make menu in VC.

  4. #4
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    The MS linker doesn't understand Borland files I expect. Anyway, making a menu in Borland is identical to MSVC from a code point of view.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Nov 2000
    Location
    Auckland, NZ
    Posts
    182
    I made oroject in VC from scratch, created new cpp and h files, and pasted code into it. Now when I deleted while loop, all compiled OK and I have exe file, but when I put while loop I have got the same linker error. Yhis is very strange, but ...
    Here is example of menu (function clrscr() not vorking in VC, but it isn't a problem):

    while(!finished)
    {
    do
    {
    cout << ("\n 1.Enter date");
    cout << ("\n 2.Increment date");
    cout << ("\n 3.Exit");
    cout << ("\n\n\n ->Choice: ");
    cin >> string;
    clrscr(); // Clear screen
    } while( !strchr("123", *string) || strlen(string) > 1);

    switch(*string)
    { // Gets date from user
    case '1' : enterDate(d);
    cout << "Date: ";
    d.print();
    cout << endl;
    cout << endl;
    break;
    // Get number of times to increment from user
    case '2' : increment = incrementDate();
    cout << "Original date: \n";
    d.print();
    // Perform incrementing only if number of times to increment > 0
    if (increment > 0)
    {
    cout << "Incrementing: \n";
    for (int i = 0; i < increment; ++i)
    {
    d.nextDay();
    d.print();
    }
    }
    break;
    // Terminate the program
    case '3' : finished = 1;
    }
    }
    }

  6. #6
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Use code tags

    clrscr() -- use system("cls")

    What's d?
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Nov 2000
    Location
    Auckland, NZ
    Posts
    182
    d is an object of a Date class I am testing.
    Code tags ...? Is it 'go to' tag? Unfortunately I can't use 'go to' expressions here.

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Nov 2000
    Location
    Auckland, NZ
    Posts
    182
    I got it.
    The problem caused "cin >> ..." statement. Only after I replaced statement #include<iostream.h> by :

    #include <iostream>
    using namespace std

    ewerything fixed. But why it happened? What is the difference between those two ways to include libraries??

  9. #9
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    iostream.h and iostream are very different. It's nearly always best to use <iostream> as that's the one from the Standard Library.

    PS: you also have to use this if you use anything from the STL (standard template library, now incorporated into the standard library)
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width