LNK1169 Error

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/* Nick Vincent */
/* Homework 2
   Reading and printing a sequential file */
#include <stdio.h>

int main()
{ 
   int id;          /* account number */
   char name[ 10 ]; /* account name */
   long balance;  /* account balance */
   int rate;        /* performance rate */
   long salary;     /* starting salary */
   long inc;         /* amount of increase */
   long newSalary;  /* New multiplied salary */

   double perf1;
   double perf2;
   double perf3;
   double perf4;

   perf1 = .045;
   perf2 = .060;
   perf3 = .078;
   perf4 = .090;

   FILE *cfPtr;     /* cfPtr = data.in file pointer */

   /* fopen opens file; exits program if file cannot be opened */ 
   if ( ( cfPtr = fopen( "data.in", "r" ) ) == NULL ) {
      printf( "File could not be opened\n" );
   } /* end if */
   else { /* read account, name and balance from file */
     printf( "%-10s%-15s%-12s%-12s%-12s%-12s\n", "ID", "Name", "PR", "Current", "Incr", "New" );
      fscanf_s( cfPtr, "%d%s%lf%d%1f", &id, name, &balance, &rate, &salary);

      /* while not end of file */
      while ( !feof( cfPtr ) ) { 
		  if ( rate == 1 ) {
			  inc = ( perf1 * salary );
			  newSalary = ( salary + inc );
		  }
		  if ( rate == 2 ) {
			  inc = ( perf2 * salary );
			  newSalary = ( salary + inc );
		  }
		  if ( rate == 3 ) {
			  inc = ( perf3 * salary );
			  newSalary = ( salary + inc );
		  }
		  if ( rate == 4) {
			  inc = ( perf4 * salary );
			  newSalary = ( salary + inc );
		  }
         printf( "%-10d%-15s%-12f%-12f%-12f%-12f\n", &id, name, balance, &rate, &salary, &inc, &newSalary );
         fscanf_s( cfPtr, "%d%s%lf%d%1f%d%1f", &id, name, &balance, &rate, &salary, &inc, &newSalary );
      } /* end while */

      fclose( cfPtr ); /* fclose closes the file */
   } /* end else */

   getchar();
   return 0; /* indicates successful termination */

} /* end main */



I've written the code given above to read a text file which contains the information:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

339 GEORGE  4  26000
221 SANDY   4  22600
101 RONNY   3  35250
115 MILLY   1  40000
445 PETE    2  20335
553 BRIAN   3  34650
209 RUSS    1  40000
199 ANGIE   4  49000
241 BARRY   3  50000
322 MIKE    2  13400
789 PETER   3  35500
900 RICK    2  46000
111 WENDY   2  21000


then the program should take the information and depending on the performance level.. (the number after their name) calculate their new salary and increase rate. However, I am unsure if I have the formatting right for the output and input and I also have the link1169 error. Any help would be awesome.. Thanks
what is a link1169 error?

Can you post the error message?
Visual Studio 2008\Projects\project1\Debug\project1.exe : fatal error LNK1169: one or more multiply defined symbols found

that is the error i'm getting.. not quite sure what it means though.
Is that file your showing the only one? Or is there more files?

Because you may have main defined twice or something
you're right, it was defined twice. All is well now it works. Thanks very much. I can't believe I made such a mistake.
Topic archived. No new replies allowed.