external link error...?

This is a discussion on external link error...? within the C++ Programming forums, part of the General Programming Boards category; Hi all.... To make the long story short I have the following function declaration in my program: Code: bool examine_string(int ...

  1. #1
    Registered User matheo917's Avatar
    Join Date
    Sep 2001
    Posts
    279

    external link error...?

    Hi all....

    To make the long story short I have the following function declaration in my program:

    Code:
    bool examine_string(int array[][ASCII_INDEX], char string[], int accepting_states[], int size);



    and my function definition is:

    Code:
    //---------------------------------------------------------------------------------------
    // test_strings() function
    // 
    // Arguments:	   double array of ints, single array of characters (string)
    //
    // Return Value:   bool (true or false) that corresponds to accepts or reject respectively
    
    bool test_string(int array[][ASCII_INDEX], char string[], int accepting_states[], int size)
    {
    	int length = strlen(string);
    
    	cout << length << endl;
    
    	
    	int trap_state = 0;
    	int current_state = 0;
    
    	for(int i = 0; string[i] != '\0' && i < length; i++)	// loops for every character...
    	{
            if(array[current_state][string[i]] == trap_state)
    		{
    			return false;			// means no tranistion defined from that state given
    		}							// that chracter transition...
    
    		else
    		{
    			current_state = array[current_state][string[i]]; // if such transition exists
    		}													 // then assign new state to
    	}														 // current_state...
    
    	
    	for(int j = 0; j < size; j++)	// examine if the finishing state of the string is
    	{								// an accepting state or a rejecting state...
    		if(current_state == accepting_states[j])
    			return true;
    	}
    
    
    	return false;			// if all the accepting states got examined and none of them
    							// match our final state then string is rejected...
    }
    	
    //---------------------------------------------------------------------------------------
    syntatically compiler is doing ok, but during linkage i'm getting the following error:


    CIS_280_DFSA error LNK2019: unresolved external symbol "bool __cdecl examine_string(int (* const)[128],char * const,int * const,int)" (?examine_string@@YA_NQAY0IA@HQADQAHH@Z) referenced in function _main

    I think it has to do with the call signature but I'm not seeing it, can anyone point me in the right direction or even perhaps explain the error....

    Thanks in advance...
    ........................
    matheo917

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,822
    Is ASCII_INDEX set to 128 ?

    If it isn't, you've tried to call this function with a different sized array, and there is no matching implementation
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Registered User
    Join Date
    May 2003
    Posts
    161
    Your function is declared and called as examine_string() but defined as test_string().

  4. #4
    Registered User matheo917's Avatar
    Join Date
    Sep 2001
    Posts
    279
    yep.......thanx all..........my eyes must be tired.....that's a sign that I must rest now....


    Regards,
    .......................
    matheo917

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Testing some code, lots of errors...
    By Sparrowhawk in forum C Programming
    Replies: 48
    Last Post: 12-15-2008, 04:09 AM
  2. Errors including <windows.h>
    By jw232 in forum Windows Programming
    Replies: 4
    Last Post: 07-29-2008, 02:29 PM
  3. file reading
    By gunghomiller in forum C++ Programming
    Replies: 9
    Last Post: 08-07-2007, 11:55 PM
  4. Connecting to a mysql server and querying problem
    By Diod in forum C++ Programming
    Replies: 8
    Last Post: 02-13-2006, 10:33 AM
  5. Linking error
    By DockyD in forum C++ Programming
    Replies: 10
    Last Post: 01-20-2003, 05:27 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21