Solved

# fatal error LNK1120: 1 unresolved externals

Posted on 2003-10-23

ok well here is my code and i can't figure out why it keeps throwing this error.

#include <iostream>

#include <stdlib.h>

#include <stdio.h>

#include <math.h>

#include <time.h>

#include "activity.h"

#include <conio.h>

using namespace std;

void randNum(int);

void brute(const activity&);

void dynamic(const activity&);

void greedy (const activity&);

void init_mm();

int number_range(int from, int to);

int number_mm(void);

static int rgiState[2+55];

int main()

{

//variables for this program

activity* problems;

problems = new activity[90];

int random;

long n = 1; //n from the psuedocode in the book

init_mm(); //seed the number generator

//generate the activity problems to find

for(int i = 0; i < 90; i++)

{

random = number_range(0, 100);

problems[i].setStartTime((long)random);

problems[i].setFinishTime((long)random + n);

if(i % 3 == 0) //increment the n value for every third run of our for loop

{

n++;

}

}

//debug for loop checking for actually creation

for(int i = 0; i < 90; i++)

{

cout << problems[i].getStartTime() << " " << endl;

}

getch();

//call three algorithms #2

//brute force a

//dynamic b

//greedy c

//give output of the time it took to accomplish and an average

//close up stuff

delete[] problems;

return 0;

}

void brute(const activity& probs)

{

}

void dynamic(const activity& probs)

{

}

void greedy(const activity& probs)

{

}

//random number generator stuff

int number_mm( void )

{

int *piState;

int iState1;

int iState2;

int iRand;

piState = &rgiState[2];

iState1 = piState[-2];

iState2 = piState[-1];

iRand = ( piState[iState1] + piState[iState2] )

& ( ( 1 << 30 ) - 1 );

piState[iState1] = iRand;

if ( ++iState1 == 55 )

iState1 = 0;

if ( ++iState2 == 55 )

iState2 = 0;

piState[-2] = iState1;

piState[-1] = iState2;

return iRand >> 6;

}

int number_range( int from, int to )

{

int power;

int number;

if ( ( to = to - from + 1 ) <= 1 )

return from;

for ( power = 2; power < to; power <<= 1 )

;

while ( ( number = number_mm( ) & ( power - 1 ) ) >= to )

;

return from + number;

}

void init_mm( )

{

int *piState;

int iState;

piState = &rgiState[2];

piState[-2] = 55 - 55;

piState[-1] = 55 - 24;

piState[0] = ( (int) time( NULL ) ) & ( ( 1 << 30 ) - 1 );

piState[1] = 1;

for( iState = 2; iState < 55; iState++ )

{

piState[iState] = ( piState[iState-1] + piState[iState-2] )

& ( ( 1 << 30 ) - 1 );

}

return;

}