Where do I place my header(.h) files to include in my source code
Hello,
I am going to include my header file I am trying to use, my source code, and the error I am receiving. If anyone could help that would be much appreciated!
Thanks,
-Nick
#include <stdio.h>
#include "stack.h"
int main(){
Stack s, s1, s2;
int n;
//creating stacks
s = create();
s1 = create();
s2 = create();
//adding numbers to stacks s, s1, and s2
push(s, 0);
push(s1, 1);
push(s2, 2);
n = pop(s);
printf("\npopped %d from stack s\n", n);
return 0;
}
//
// Created by Nick on 4/24/18.
//
#ifndef UNTITLED72_STACK_H
#define UNTITLED72_STACK_H
#include <stdbool.h>
typedef struct stack_type *Stack;
Stack create(void);
void destroy(Stack s);
void make_empty(Stack s);
bool is_empty(Stack s);
bool is_full(Stack s);
void push(Stack s, int i);
int pop(Stack s);
#endif //UNTITLED72_STACK_H
ERROR:
/Applications/CLion.app/Contents/bin/cmake/bin/cmake --build /Users/nicholausbrell/CLionProjects/untitled72/cmake-build-debug --target untitled72 -- -j 2
[ 50%] Linking C executable untitled72
Undefined symbols for architecture x86_64:
"_create", referenced from:
_main in main.c.o
"_pop", referenced from:
_main in main.c.o
"_push", referenced from:
_main in main.c.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[3]: *** [untitled72] Error 1
make[2]: *** [CMakeFiles/untitled72.dir/all] Error 2
make[1]: *** [CMakeFiles/untitled72.dir/rule] Error 2
make: *** [untitled72] Error 2
请先登录再写评论。
Hello!