PDA

Click to See Complete Forum and Search --> : Linking: fatal error LNK1143


bona
Jun 9th, 2001, 05:15 PM
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

parksie
Jun 9th, 2001, 06:08 PM
Are you using .lib files designed for Borland?

bona
Jun 9th, 2001, 06:28 PM
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.

parksie
Jun 9th, 2001, 06:31 PM
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.

bona
Jun 9th, 2001, 06:49 PM
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;
}
}
}

parksie
Jun 9th, 2001, 06:51 PM
Use code tags ;)

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

What's d?

bona
Jun 9th, 2001, 07:03 PM
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.

bona
Jun 9th, 2001, 09:23 PM
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??

parksie
Jun 10th, 2001, 06:40 AM
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)