Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/Linker/Interaction with the IDE    [ Add a report in this area ]  
Report #:  23934   Status: Closed
C++ console application without multithread uses multithread lib cw32mti.lib
Project:  C++Builder Build #:  10.0.2166.28377
Version:    10.0 Submitted By:   Andreas Hausladen
Report Type:  Basic functionality failure Date Reported:  1/21/2006 10:12:47 AM
Severity:    Commonly encountered problem Last Updated: 3/20/2012 2:24:39 AM
Platform:    All platforms Internal Tracking #:   238483
Resolution: Cannot Reproduce (Resolution Comments) Resolved in Build: : 10.0.2223.36393
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: None
Description
A C++ console application where the MultiThread support is disabled ("New console application" wizard) uses cw32mti.lib instead of cw32i.lib.
This results in linker errors like
Error: Unresolved external '_errno' referenced from C:\ERRNOBUG\UNIT1.OBJ
Steps to Reproduce:
1. Create a new C++ Console application
2. Untick the "MultiThreads" checkbox and untick the "use VCL" checkbox
3. Include the <errno.h> file and use the errno "variable".

#include <errno.h>

#pragma argsused
int main(int argc, char* argv[])
{

if (errno == 1) ;

return 0;
}

Expected:
The linker links the program

Actually:
The linker fails with
Error: Unresolved external '_errno' referenced from UNIT1.OBJ
Workarounds
1. Save the project
2. Close the project
3. Open the .bdsproj file with an editor (notepad) and replace cw32mti.lib by cw32i.lib
4. Save the file in the editor
5. Reopen the project in BDS 2006

---------

1. Save the project
2. Close the project
3. Open the .bdsproj file with an editor (notepad) and replace cw32mti.lib by cw32i.lib
4. Save the file in the editor
5. Reopen the project in BDS 2006
Attachment
errnoBug.zip
Comments

Simon Durrant at 2/11/2006 3:40:22 PM -
You can duplicate this bug only if you have previously set some project options as defaults in another app that uses different libs (even if your default changes are unrelated to the libs). Make any options as your default when writing a vcl forms app and you will get these problems in your console apps. In bcb5 you could delete the default project file in the bin folder, and then NEVER set options as defaults. Need to find out how to undo the 'damage' in BCB2006.

Martin Rothschink at 2/17/2006 5:29:38 AM -
To delete default options in BDS 2006 go into c:\local documents and settings\<username>\local settings\Application Data\Borland\BDS\4.0 and delete DefProject.bdsproj.

Server Response from: ETNACODE01