keep getting fatal error LNK 1104

I'm not sure what I've done wrong, but my program won't run. It doesn't seem to be a problem with the syntax.


#include <iostream>
#include <fstream>
#include <string>
using namespace std;

int main()
{
int shirtsNum[5], postersNum[5], recordsNum[5];
float shirtsPrice[5], postersPrice[5], recordsPrice[5];
string venue[5];

ifstream fin;
fin.open("merch.txt"); //opens file that data will come from

int z=0;
while(!fin.eof())
{
fin>>venue[z]>>shirtsNum[z]>>shirtsPrice[z]>>postersNum[z]>>postersPrice[z]>>recordsNum[z]>>recordsPrice[z];
z++;

}

ofstream fout;
fout.open("salesresults.txt"); //opens files where data will be sent

for(int y=0; y<10; y++)
{
fout<<"Total sales for "<<venue[y]<<" is:";
fout<<shirtsNum[y]*shirtsPrice[y]+postersNum[y]*postersPrice[y]+recordsNum[y]*recordsPrice[y]<<endl;
}






return 0;
}
Please post the full error text. Also, you should use [code] tags around your code.
This is the error text that is shown:

1>------ Build started: Project: Proj1, Configuration: Debug Win32 ------
1>Build started 2/17/2013 2:43:35 PM.
1>InitializeBuildStatus:
1> Touching "Debug\Proj1.unsuccessfulbuild".
1>ClCompile:
1> All outputs are up-to-date.
1>LINK : fatal error LNK1104: cannot open file 'C:\Users\CK\Documents\Visual Studio 2010\Projects\Proj1\Debug\Proj1.exe'
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:12.37
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
Compiles fine for me with VS2010.

Some notes on your code:
1) You don't check that the open of your input file succeeded.
2) What happens if z exceeds 5?
3) In your second loop, you are indexing past the bounds bounds of your arrays regardless of how many items your read.
Topic archived. No new replies allowed.