This site works best with JavaScript enabled
Sign In
Discussions
Activity
Sign In
All
Project.001: C Programming, Data Structures
Issues, queries and suggestions related to C, C programming, data structures using C and C based projects.
Project.001: C Programming, Data Structures
47.Data Structures. Queues
spatlou
June 2020
All queries, discussions, updates and clarifications related to Project.001; Session.47.Data Structures. Queues
should be posted here.
rajsaw9973
December 2020
when i use function pointer i am getting this error
[root@localhost 1.00]# ls
clearQueue.c declerations.h destroyQueue.o enQueue.o init.c Makefile
clearQueue.o deQueue.c displayQueue.c exitFunc.c main.c peek.c
creatQueue.c deQueue.o displayQueue.o exitFunc.o mainMenu.c peek.o
creatQueue.o destroyQueue.c enQueue.c headers.h mainMenu.o
[root@localhost 1.00]# make
gcc -o Queue mainMenu.o exitFunc.o creatQueue.o enQueue.o deQueue.o displayQueue.o clearQueue.o peek.o destroyQueue.o
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/10/../../../../lib64/crt1.o: in function `_start':
(.text+0x24): undefined reference to `main'
/usr/bin/ld: mainMenu.o: in function `mainMenu':
mainMenu.c:(.text+0x9d): undefined reference to `fptr'
/usr/bin/ld: mainMenu.c:(.text+0xb6): undefined reference to `fptr'
/usr/bin/ld: creatQueue.o: in function `creatQueue':
creatQueue.c:(.text+0x50): undefined reference to `fptr'
/usr/bin/ld: creatQueue.c:(.text+0xb7): undefined reference to `fptr'
collect2: error: ld returned 1 exit status
make: *** [Makefile:4: Queue] Error 1
[root@localhost 1.00]#
rajsaw9973
December 2020
rajsaw9973
December 2020
decleration
typedef struct
{
int *queue;
unsigned int size;
int f,r;
}Queue;
int init();
extern void* mainMenu(void*);
extern void* exitFunc(void*);
extern void* creatQueue(void*);
extern void* enQueue(void*);
extern void* deQueue(void*);
extern void* displayQueue(void*);
extern void* clearQueue(void*);
extern void* peek(void*);
extern void* destroyQueue(void*);
extern void* (*fptr[9])(void*);
~
jyotipandey9813
March 2021
void* mainMenu(void*);
.
.
void* destroyQueue(void*);
void* (*fptr[9])(void*);
“Undefined Reference” error occurs when we have a reference to object name but the linker cannot find the definition of a linked object,
so
Make sure these above function_declarations should be defined in your
init.c
file or
main.c
file
deepak4u106
May 2021
jyotipandey9813
You have to use
extern
storage class while declaring the functions
jyotipandey9813
May 2021
@deepak4u106
he already used "extern storage class" during
declaring
the function in declaration.h
but for allocating them memory he has to define this functions without extern in main.c or init.c .
deepak4u106
May 2021
@
jyotipandey9813
Yes after defining the function in init.c he has to call the function in main.c
Add a Comment
Powered by
Vanilla
Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
Sign In
Apply for Membership
Categories
All Discussions
0
Module.101: Advanced Data Structures using C
17
Module.303: Linux System Programming
32
Project 22. Ethernet Network Device Driver Development
0
Project.14. Linux System and Network Administration
0
Project.10. Embedded Linux ARM, Configuring and Porting using Storage
0
Project.203 Linux System Programming. MySQL
0
Pravjot Sir Classes
113
Events at EmbLogic
2
Query
506
Module.000: Linux System Administration
24
Project.001: C Programming, Data Structures
77
Project.002: OOPs, C++, Eclipse, Linux
22
Project.003: Linux System Programming
34
Project.004: Linux Network Programming
8
Project.005: Character Device Drivers Development
21
Project.105: Parallel Port Device Drivers Development
5
Project.205: Serial Port Device Drivers Development
3
Project.008: Block Device Driver Development
3
Project.009: Embedded Linux-ARM. Storage
7
Module.011: Shell Scripting using Bash
6
Project 12: Linux Kernel Architecture and Internals
2
Project.015: Python with Eclipse on Linux
27
Project 16: SPI Device Driver Development
2
Project 17: I2C Device Driver Development
0
Project 18: PCI Device Driver Development
0
Project 19: Embedded Linux on ARM Using Network TFTP
0
Project 20: CAN Bus Protocol and Driver Development
0
Project 21: USB Device Drivers Development
0
Embedded Linux
0
ARM Embedded Processor
0
Training
2
Members Area
1
Word From Admin
1