BWiz
12-29-2007, 07:37 PM
I decided to finally read my C++ book last night, and this morning, I began trying out to create my own programs. I've had no hitches (apart from little errors which I corrected myself quickly) so far.
However, I am trying to create a program which receives input from a user (degrees fahrenheit) and converts it to celsius. I'm pretty sure that my program is sound, however my compiler (Borland C++ BuilderX Personal) keeps giving me the following error:
ilink32 -D -ap -Tpe -x -Gn -v -LC:\Borland\CBuilderX\lib c0x32.obj,"E:\Cpp\Chapter Two\basicInput\windows\Debug_Build\basicInput.exe",,cw32.lib import32.lib,,
Turbo Incremental Link 5.65 Copyright (c) 1997-2002 Borland
Error: Unresolved external '_main' referenced from C:\BORLAND\CBUILDERX\LIB\C0X32.OBJ
ILINK32 exited with error code: 2
Build cancelled due to errors
My source code is:
#include <iostream> // include iostream for I/O (cout etc.)
#include <conio> // include conio for cmd keep alive - Borland only
using namespace std; // saves from using std:: all the time
int main() // initilize main function
{
int ftemp; // declare variable that shall store the temperature in fahrenheit
float ctemp; // declare variable that shall store the temperature in celsius - using Floating Point
cout << "Please enter the temperature in degrees of fahrenheit: "; // prompt
cin >> ftemp; // input for temperature in fahrenheit note >> operator for input
ctemp = ( ftemp - 32 ) * 5/9;
cout << "The equivalent temperature in celsius is: " << ctemp << "\xF8."; // prints equivalent temperature
getch(); // keeps cmd alive - Borland only
return 0;
I would appreciate any help in this matter, because I am unable to discover what is causing the build problem.
Update:
Nevermind, fixed the issue. Seems that the file (basicInput.cpp) didn't link to the project file creating some weird problem or another.
However, I am trying to create a program which receives input from a user (degrees fahrenheit) and converts it to celsius. I'm pretty sure that my program is sound, however my compiler (Borland C++ BuilderX Personal) keeps giving me the following error:
ilink32 -D -ap -Tpe -x -Gn -v -LC:\Borland\CBuilderX\lib c0x32.obj,"E:\Cpp\Chapter Two\basicInput\windows\Debug_Build\basicInput.exe",,cw32.lib import32.lib,,
Turbo Incremental Link 5.65 Copyright (c) 1997-2002 Borland
Error: Unresolved external '_main' referenced from C:\BORLAND\CBUILDERX\LIB\C0X32.OBJ
ILINK32 exited with error code: 2
Build cancelled due to errors
My source code is:
#include <iostream> // include iostream for I/O (cout etc.)
#include <conio> // include conio for cmd keep alive - Borland only
using namespace std; // saves from using std:: all the time
int main() // initilize main function
{
int ftemp; // declare variable that shall store the temperature in fahrenheit
float ctemp; // declare variable that shall store the temperature in celsius - using Floating Point
cout << "Please enter the temperature in degrees of fahrenheit: "; // prompt
cin >> ftemp; // input for temperature in fahrenheit note >> operator for input
ctemp = ( ftemp - 32 ) * 5/9;
cout << "The equivalent temperature in celsius is: " << ctemp << "\xF8."; // prints equivalent temperature
getch(); // keeps cmd alive - Borland only
return 0;
I would appreciate any help in this matter, because I am unable to discover what is causing the build problem.
Update:
Nevermind, fixed the issue. Seems that the file (basicInput.cpp) didn't link to the project file creating some weird problem or another.