help

Im having trouble building my program, I keep getting these errors:
Build started: Project: prgm2, Configuration: Debug Win32 ------
1>Build started 3/29/2012 11:19:17 AM.
1>PrepareForBuild:
1> Creating directory "F:\ENGR\prgm2\Debug\".
1>InitializeBuildStatus:
1> Creating "Debug\prgm2.unsuccessfulbuild" because "AlwaysCreate" was specified.
1>LINK : error LNK2001: unresolved external symbol _mainCRTStartup
1>F:\ENGR\prgm2\Debug\prgm2.exe : fatal error LNK1120: 1 unresolved externals
1>
1>Build FAILED.



Here is my program:
//HW7CShumate
#include <iomanip>
#include <iostream>
#include <cmath>
#include <fstream>

using namespace std;
double k = 1.25E6; // (spring constant)
double c = 1.40E4; // (dampening coefficient)
double m = 1814.369; // (mass of car)
double phd = .2032; // (depth of pot hole)

double fcn(double t);
bool bisect(double& left, double& right);

int main() {
double tl = 0; //left bound (seconds)
double tr = 0; // right bound (seconds)
int runtimes = -1; // record iterations of program

ofstream outfile("HW7results.txt");

outfile << " iter time(LB) time(RB)";
outfile <<" position(left) position (right)" << endl;
cout << "Enter left bound\n";
cin >> tl;
cout << "Enter right bound\n";
cin >> tr;

if(!outfile){
cout << "Bad outfile stream.\n";
cout << "BAD OUTPUT VALUES##";
return (2);
}
if(tl<0 || tr<0){
cout << "\nTime cannot be negative.";
outfile << "\nTime cannot be negative.";
return 3;
}
if(tl>tr){
cout << "Time cannot be reversed";
return 4;
}

while(outfile && (fabs(tr-tl)>.0000001) && !bisect(tl,tr)){
//write to outfile
runtimes++;
outfile <<" "<< setw(3) << runtimes <<" "<<fixed<< setw(13)<< tl;
outfile <<" "<<fixed<< setw(13)<< tr <<" "<<fixed<< setw(13)<<fcn(tl)<<" ";
outfile <<fixed<< setw(13)<<fcn(tr)<< endl;
}
if( bisect(tl,tr)){
cout << "No root exists on specified interval.";
outfile << "\nNo root exists on specified interval.";
}
else{
outfile << "\nThe root is "<< tr;
cout << "The root is " << tr;
}
return 0;
}
bool bisect(double& left, double& right){
if (fcn(left)*fcn(right) > 0) return (1);
double mid = (left + right)/2;
if (fcn(left)*fcn(mid) < 0) right = mid;
else left = mid;
return 0;
}
double fcn(double t){
double n = c/(2*m);
double s = sqrt((k/m)-((c*c)/(4*(m*m))));
double x = (exp(-n*t))*phd*cos(s*t)+phd*(n/s)*sin(s*t);
return x;
}

Is the file that this code resides in included in your solution? Meaning, is this main.cpp or is it someotherfile.cpp? If it is someotherfile.cpp make sure that you add the file to your project.
Thanks, just tried it and it worked
I'm using Dev C++ 4.9.9.2 on windows 7 64 bit and it complied with no problems. I would guess the problem lies with the compiler not the code.

Here is the output from when I ran the exe
C:\Temp>test222
Enter left bound
1
Enter right bound
2
No root exists on specified interval.

It also created file HW7results.txt

http://www.bloodshed.net/devcpp.html
Dev-C++ is deprecated since a while !
Consider using wxDev-C++ instead !
Topic archived. No new replies allowed.