0

I have 3 files:

  • main.c is to test all function in table.h
  • table.c is to implement its header file.
  • table.h is the header file. I have included table.h in main.c, but when compile, it have me this error:

Undefined symbols for architecture x86_64: "_insertItem", referenced from: _main in main-788b5b.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) Quocs-MBP:A3 jarvis$

#ifndef _TABLE_H
#define _TABLE_H

//---------------------------------------------------------------------        
--------
// CONSTANTS AND TYPES
//--------------------------------------------------------------------- 
--------
#ifndef _BOOL_
typedef enum BOOL { false, true } bool;
#endif
//--------------------------------------------------------------------- 
--------
// PROTOTYPES
//--------------------------------------------------------------------- 
--------

// add an element to the table
// Return TRUE if the item is in the table
// Return FALSE if the item is *not* in the table
bool insertItem( int item );
// removes the int from the table
bool removeItem( int item );
// empty the table so that we clear all memory and can start a fresh 
table
void clearTable( );
// tells us whether or not the given item is in the table
bool search( int item );
// table iterators
// Return TRUE if item was assigned
// Return FALSE if item was *not* assigned
bool firstItem( int * const item );
bool nextItem( int * const item );

#endif

I have test in table.c and every is normal, so I don't put it here. Below is the first part of main.c:

#include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include "table.h"

//typedef enum BOOL { false, true } bool;                                               

// Linked list node definition                                                          
typedef struct Node node;

and this is where I try to use function insertItem(int Item):

  //TEST insertItem(int Item) function                                                  

  //Case: Insert to an empty table                                                      
  //insertItem(0);                                                                      
  if(top ==NULL){
    printf("THE TABLE IS EMPTY\n");
  }
  insertItem(10);
  print();


  return 0;
}

Sorry if my post is vague or unvalid, i'm new to StackOverflow. Thank you.

1 Answers1

0

I've seen this.

make clean; make

You are trying to build for x64 with build output trash from your last x86 build. That doesn't work too good.

Joshua
  • 40,822
  • 8
  • 72
  • 132