I am defining the below function in order to calculate combinations .... it works fine on borland... but when i run it on vc++ 6.0, it generates the
error

"error LNK2001: unresolved external symbol "public: void __thiscall bruteFrce::generate_combination(int)" (?generate_combination@bruteFrce@@QAEXH@Z)
Debug/AlgoProject.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe."

i have included the following classes in my code...

#include "stdio.h"
#include "string.h"
#include "stdlib.h"
#include "stdafx.h"
#include "AlgoProject.h"
#include "bruteFrce.h"
#include "time.h"
#include "iostream.h"

and the function is :

void generate_combination (int tasks)
{

unsigned int max_mask_length;
unsigned int mask;
int s_pos,c_pos=0;

unsigned int comb_mask = 0x00000001;
char source_string[MAX];
char combination_string[MAX];

int len, lencomb;
int m,n=0;
char** combinations = new char*[200];
for(int j=0; j<200; j++)
  combinations[j] = new char [50];
for (int i=0; i<tasks; i++)
    source_string[i]= i;
len = strlen (source_string);
  max_mask_length = ~(0x00000001 << len);
 while (1)
    {
        mask = 0x00000001;
        s_pos = 0, c_pos = 0;
         while ((mask & max_mask_length))
        {
          if ((comb_mask & mask))
          {
              combination_string[c_pos] = source_string[s_pos];
              c_pos++;
          }
          s_pos++;
          mask <<= 1;
        }
combination_string[c_pos] = 0;
lencomb = strlen (combination_string);
for (int k=0 ;k< lencomb ; k++)
 combinations[m][k] =  combination_string[k];
m++;
if (c_pos ==0)
  break;

else
  continue;
    }
}

kindly guide me which library or class am i missing,,, ?? or is there any other reason for the error...

Should generate_combination() be an operation of the class bruteFrce? Like void bruteFrce::generate_combination(int) or should it really be outside the scope of the class bruteFrce?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.