undefined reference to ‘io_xxx‘

在使用libaio库和线程库pthread时遇到编译错误,如'io_getevents', 'io_setup', 'io_submit'及'pthread_create', 'pthread_join'的undefined reference。解决方法是在g++编译时添加'-laio'和'-lpthread'参数,以确保正确链接这两个库。

我们在使用libaio库的时候,在编译时可能会报如下错:
undefined reference to ‘io_getevents’
undefined reference to ‘io_setup’
undefined reference to ‘io_submit’
这时,只需要在编译中要加 '-laio’参数即可

同样的还有thread,如报如下错:
undefined reference to ‘pthread_create’
undefined reference to ‘pthread_join’
加’-lpthread’参数即可

g++ -O2 test.c -o test -laio -lpthread
报错:d:/yl/documents/arduino/arduimo_project/hardware/esp32/tools/xtensa-esp32s3-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: C:\Users\YL\AppData\Local\arduino\sketches\F636E5A98FDBB535A1CB89E56A45F6EF\libraries\BluetoothSerial\BluetoothSerial.cpp.o:(.literal._ZL8_stop_btv+0x18): undefined reference to `esp_spp_disconnect' d:/yl/documents/arduino/arduimo_project/hardware/esp32/tools/xtensa-esp32s3-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: C:\Users\YL\AppData\Local\arduino\sketches\F636E5A98FDBB535A1CB89E56A45F6EF\libraries\BluetoothSerial\BluetoothSerial.cpp.o:(.literal._ZL8_stop_btv+0x1c): undefined reference to `esp_spp_deinit' d:/yl/documents/arduino/arduimo_project/hardware/esp32/tools/xtensa-esp32s3-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: C:\Users\YL\AppData\Local\arduino\sketches\F636E5A98FDBB535A1CB89E56A45F6EF\libraries\BluetoothSerial\BluetoothSerial.cpp.o:(.literal._ZL16_spp_send_bufferv+0xc): undefined reference to `esp_spp_write' d:/yl/documents/arduino/arduimo_project/hardware/esp32/tools/xtensa-esp32s3-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: C:\Users\YL\AppData\Local\arduino\sketches\F636E5A98FDBB535A1CB89E56A45F6EF\libraries\BluetoothSerial\BluetoothSerial.cpp.o:(.literal._ZL8btSetPinv+0xc): undefined reference to `esp_bt_gap_set_pin' d:/yl/documents/arduino/arduimo_project/hardware/esp32/tools/xtensa-esp32s3-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: C:\Users\YL\AppData\Local\arduino\sketches\F636E5A98FDBB535A1CB89E56A45F6EF\libraries\BluetoothSerial\BluetoothSerial.cpp.o:(.literal._ZN15BluetoothSerial5beginE6Stringb+0x38): undefined reference to `esp_bt_gap_register_callback' d:/yl/documents/arduino/arduimo_project/hardware/esp32/tools/xtensa-esp32s3-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: C:\Users\YL\AppData\Local\arduino\sketches\F636E5A98FDBB535A1CB89E56A45F6EF\libraries\BluetoothSerial\BluetoothSerial.cpp.o:(.literal._ZN15BluetoothSerial5beginE6Stringb+0x3c): undefined reference to `esp_spp_register_callback' d:/yl/documents/arduino/arduimo_project/hardware/esp32/tools/xtensa-esp32s3-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: C:\Users\YL\AppData\Local\arduino\sketches\F636E5A98FDBB535A1CB89E56A45F6EF\libraries\BluetoothSerial\BluetoothSerial.cpp.o:(.literal._ZN15BluetoothSerial5beginE6Stringb+0x40): undefined reference to `esp_spp_init' d:/yl/documents/arduino/arduimo_project/hardware/esp32/tools/xtensa-esp32s3-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: C:\Users\YL\AppData\Local\arduino\sketches\F636E5A98FDBB535A1CB89E56A45F6EF\libraries\BluetoothSerial\BluetoothSerial.cpp.o:(.literal._ZN15BluetoothSerial5beginE6Stringb+0x44): undefined reference to `esp_bt_gap_set_security_param' d:/yl/documents/arduino/arduimo_project/hardware/esp32/tools/xtensa-esp32s3-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: C:\Users\YL\AppData\Local\arduino\sketches\F636E5A98FDBB535A1CB89E56A45F6EF\libraries\BluetoothSerial\BluetoothSerial.cpp.o:(.literal._ZN15BluetoothSerial5beginE6Stringb+0x48): undefined reference to `esp_bt_gap_set_cod' d:/yl/documents/arduino/arduimo_project/hardware/esp32/tools/xtensa-esp32s3-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: C:\Users\YL\AppData\Local\arduino\sketches\F636E5A98FDBB535A1CB89E56A45F6EF\libraries\BluetoothSerial\BluetoothSerial.cpp.o:(.literal._ZL10esp_spp_cb18esp_spp_cb_event_tP18esp_spp_cb_param_t+0x28): undefined reference to `esp_bt_gap_set_scan_mode' d:/yl/documents/arduino/arduimo_project/hardware/esp32/tools/xtensa-esp32s3-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: C:\Users\YL\AppData\Local\arduino\sketches\F636E5A98FDBB535A1CB89E56A45F6EF\libraries\BluetoothSerial\BluetoothSerial.cpp.o:(.literal._ZL10esp_spp_cb18esp_spp_cb_event_tP18esp_spp_cb_param_t+0x2c): undefined reference to `esp_spp_start_srv' d:/yl/documents/arduino/arduimo_project/hardware/esp32/tools/xtensa-esp32s3-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: C:\Users\YL\AppData\Local\arduino\sketches\F636E5A98FDBB535A1CB89E56A45F6EF\libraries\BluetoothSerial\BluetoothSerial.cpp.o:(.literal._ZL10esp_spp_cb18esp_spp_cb_event_tP18esp_spp_cb_param_t+0x30): undefined reference to `esp_spp_connect' d:/yl/documents/arduino/arduimo_project/hardware/esp32/tools/xtensa-esp32s3-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: C:\Users\YL\AppData\Local\arduino\sketches\F636E5A98FDBB535A1CB89E56A45F6EF\libraries\BluetoothSerial\BluetoothSerial.cpp.o:(.literal._ZL13esp_bt_gap_cb21esp_bt_gap_cb_event_tP21esp_bt_gap_cb_param_t+0x20): undefined reference to `esp_bt_gap_resolve_eir_data' d:/yl/documents/arduino/arduimo_project/hardware/esp32/tools/xtensa-esp32s3-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: C:\Users\YL\AppData\Local\arduino\sketches\F636E5A98FDBB535A1CB89E56A45F6EF\libraries\BluetoothSerial\BluetoothSerial.cpp.o:(.literal._ZL13esp_bt_gap_cb21esp_bt_gap_cb_event_tP21esp_bt_gap_cb_param_t+0x2c): undefined reference to `esp_bt_gap_cancel_discovery' d:/yl/documents/arduino/arduimo_project/hardware/esp32/tools/xtensa-esp32s3-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: C:\Users\YL\AppData\Local\arduino\sketches\F636E5A98FDBB535A1CB89E56A45F6EF\libraries\BluetoothSerial\BluetoothSerial.cpp.o:(.literal._ZL13esp_bt_gap_cb21esp_bt_gap_cb_event_tP21esp_bt_gap_cb_param_t+0x30): undefined reference to `esp_spp_start_discovery' d:/yl/documents/arduino/arduimo_project/hardware/esp32/tools/xtensa-esp32s3-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: C:\Users\YL\AppData\Local\arduino\sketches\F636E5A98FDBB535A1CB89E56A45F6EF\libraries\BluetoothSerial\BluetoothSerial.cpp.o:(.literal._ZL13esp_bt_gap_cb21esp_bt_gap_cb_event_tP21esp_bt_gap_cb_param_t+0x40): undefined reference to `esp_bt_gap_pin_reply' d:/yl/documents/arduino/arduimo_project/hardware/esp32/tools/xtensa-esp32s3-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: C:\Users\YL\AppData\Local\arduino\sketches\F636E5A98FDBB535A1CB89E56A45F6EF\libraries\BluetoothSerial\BluetoothSerial.cpp.o:(.literal._ZL13esp_bt_gap_cb21esp_bt_gap_cb_event_tP21esp_bt_gap_cb_param_t+0x44): undefined reference to `esp_bt_gap_ssp_confirm_reply' d:/yl/documents/arduino/arduimo_project/hardware/esp32/tools/xtensa-esp32s3-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: C:\Users\YL\AppData\Local\arduino\sketches\F636E5A98FDBB535A1CB89E56A45F6EF\libraries\BluetoothSerial\BluetoothSerial.cpp.o: in function `_stop_bt()': D:\YL\Documents\Arduino\arduimo_project\hardware\esp32\hardware\esp32\2.0.7\libraries\BluetoothSerial\src/BluetoothSerial.cpp:714: undefined reference to `esp_spp_disconnect' d:/yl/documents/arduino/arduimo_project/hardware/esp32/tools/xtensa-esp32s3-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: D:\YL\Documents\Arduino\arduimo_project\hardware\esp32\hardware\esp32\2.0.7\libraries\BluetoothSerial\src/BluetoothSerial.cpp:715: undefined reference to `esp_spp_deinit' d:/yl/documents/arduino/arduimo_project/hardware/esp32/tools/xtensa-esp32s3-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: C:\Users\YL\AppData\Local\arduino\sketches\F636E5A98FDBB535A1CB89E56A45F6EF\libraries\BluetoothSerial\BluetoothSerial.cpp.o: in function `_spp_send_buffer()': D:\YL\Documents\Arduino\arduimo_project\hardware\esp32\hardware\esp32\2.0.7\libraries\BluetoothSerial\src/BluetoothSerial.cpp:189: undefined reference to `esp_spp_write' d:/yl/documents/arduino/arduimo_project/hardware/esp32/tools/xtensa-esp32s3-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: C:\Users\YL\AppData\Local\arduino\sketches\F636E5A98FDBB535A1CB89E56A45F6EF\libraries\BluetoothSerial\BluetoothSerial.cpp.o: in function `btSetPin()': D:\YL\Documents\Arduino\arduimo_project\hardware\esp32\hardware\esp32\2.0.7\libraries\BluetoothSerial\src/BluetoothSerial.cpp:153: undefined reference to `esp_bt_gap_set_pin' d:/yl/documents/arduino/arduimo_project/hardware/esp32/tools/xtensa-esp32s3-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: C:\Users\YL\AppData\Local\arduino\sketches\F636E5A98FDBB535A1CB89E56A45F6EF\libraries\BluetoothSerial\BluetoothSerial.cpp.o: in function `BluetoothSerial::begin(String, bool)': D:\YL\Documents\Arduino\arduimo_project\hardware\esp32\hardware\esp32\2.0.7\libraries\BluetoothSerial\src/BluetoothSerial.cpp:651: undefined reference to `esp_bt_gap_register_callback' d:/yl/documents/arduino/arduimo_project/hardware/esp32/tools/xtensa-esp32s3-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: C:\Users\YL\AppData\Local\arduino\sketches\F636E5A98FDBB535A1CB89E56A45F6EF\libraries\BluetoothSerial\BluetoothSerial.cpp.o: in function `_init_bt': D:\YL\Documents\Arduino\arduimo_project\hardware\esp32\hardware\esp32\2.0.7\libraries\BluetoothSerial\src/BluetoothSerial.cpp:664: undefined reference to `esp_spp_register_callback' d:/yl/documents/arduino/arduimo_project/hardware/esp32/tools/xtensa-esp32s3-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: D:\YL\Documents\Arduino\arduimo_project\hardware\esp32\hardware\esp32\2.0.7\libraries\BluetoothSerial\src/BluetoothSerial.cpp:664: undefined reference to `esp_spp_init' d:/yl/documents/arduino/arduimo_project/hardware/esp32/tools/xtensa-esp32s3-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: D:\YL\Documents\Arduino\arduimo_project\hardware\esp32\hardware\esp32\2.0.7\libraries\BluetoothSerial\src/BluetoothSerial.cpp:691: undefined reference to `esp_bt_gap_set_security_param' d:/yl/documents/arduino/arduimo_project/hardware/esp32/tools/xtensa-esp32s3-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: D:\YL\Documents\Arduino\arduimo_project\hardware\esp32\hardware\esp32\2.0.7\libraries\BluetoothSerial\src/BluetoothSerial.cpp:695: undefined reference to `esp_bt_gap_set_cod' d:/yl/documents/arduino/arduimo_project/hardware/esp32/tools/xtensa-esp32s3-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: C:\Users\YL\AppData\Local\arduino\sketches\F636E5A98FDBB535A1CB89E56A45F6EF\libraries\BluetoothSerial\BluetoothSerial.cpp.o: in function `esp_spp_cb(esp_spp_cb_event_t, esp_spp_cb_param_t*)': D:\YL\Documents\Arduino\arduimo_project\hardware\esp32\hardware\esp32\2.0.7\libraries\BluetoothSerial\src/BluetoothSerial.cpp:265: undefined reference to `esp_bt_gap_set_scan_mode' d:/yl/documents/arduino/arduimo_project/hardware/esp32/tools/xtensa-esp32s3-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: D:\YL\Documents\Arduino\arduimo_project\hardware\esp32\hardware\esp32\2.0.7\libraries\BluetoothSerial\src/BluetoothSerial.cpp:271: undefined reference to `esp_spp_start_srv' d:/yl/documents/arduino/arduimo_project/hardware/esp32/tools/xtensa-esp32s3-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: D:\YL\Documents\Arduino\arduimo_project\hardware\esp32\hardware\esp32\2.0.7\libraries\BluetoothSerial\src/BluetoothSerial.cpp:284: undefined reference to `esp_spp_disconnect' d:/yl/documents/arduino/arduimo_project/hardware/esp32/tools/xtensa-esp32s3-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: D:\YL\Documents\Arduino\arduimo_project\hardware\esp32\hardware\esp32\2.0.7\libraries\BluetoothSerial\src/BluetoothSerial.cpp:364: undefined reference to `esp_spp_connect' d:/yl/documents/arduino/arduimo_project/hardware/esp32/tools/xtensa-esp32s3-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: D:\YL\Documents\Arduino\arduimo_project\hardware\esp32\hardware\esp32\2.0.7\libraries\BluetoothSerial\src/BluetoothSerial.cpp:388: undefined reference to `esp_spp_disconnect' d:/yl/documents/arduino/arduimo_project/hardware/esp32/tools/xtensa-esp32s3-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: C:\Users\YL\AppData\Local\arduino\sketches\F636E5A98FDBB535A1CB89E56A45F6EF\libraries\BluetoothSerial\BluetoothSerial.cpp.o: in function `esp_bt_gap_cb(esp_bt_gap_cb_event_t, esp_bt_gap_cb_param_t*)': D:\YL\Documents\Arduino\arduimo_project\hardware\esp32\hardware\esp32\2.0.7\libraries\BluetoothSerial\src/BluetoothSerial.cpp:128: undefined reference to `esp_bt_gap_resolve_eir_data' d:/yl/documents/arduino/arduimo_project/hardware/esp32/tools/xtensa-esp32s3-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: C:\Users\YL\AppData\Local\arduino\sketches\F636E5A98FDBB535A1CB89E56A45F6EF\libraries\BluetoothSerial\BluetoothSerial.cpp.o: in function `get_name_from_eir': D:\YL\Documents\Arduino\arduimo_project\hardware\esp32\hardware\esp32\2.0.7\libraries\BluetoothSerial\src/BluetoothSerial.cpp:130: undefined reference to `esp_bt_gap_resolve_eir_data' d:/yl/documents/arduino/arduimo_project/hardware/esp32/tools/xtensa-esp32s3-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: C:\Users\YL\AppData\Local\arduino\sketches\F636E5A98FDBB535A1CB89E56A45F6EF\libraries\BluetoothSerial\BluetoothSerial.cpp.o: in function `esp_bt_gap_cb(esp_bt_gap_cb_event_t, esp_bt_gap_cb_param_t*)': D:\YL\Documents\Arduino\arduimo_project\hardware\esp32\hardware\esp32\2.0.7\libraries\BluetoothSerial\src/BluetoothSerial.cpp:457: undefined reference to `esp_bt_gap_cancel_discovery' d:/yl/documents/arduino/arduimo_project/hardware/esp32/tools/xtensa-esp32s3-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: D:\YL\Documents\Arduino\arduimo_project\hardware\esp32\hardware\esp32\2.0.7\libraries\BluetoothSerial\src/BluetoothSerial.cpp:458: undefined reference to `esp_spp_start_discovery' d:/yl/documents/arduino/arduimo_project/hardware/esp32/tools/xtensa-esp32s3-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: D:\YL\Documents\Arduino\arduimo_project\hardware\esp32\hardware\esp32\2.0.7\libraries\BluetoothSerial\src/BluetoothSerial.cpp:547: undefined reference to `esp_bt_gap_pin_reply' d:/yl/documents/arduino/arduimo_project/hardware/esp32/tools/xtensa-esp32s3-elf-gcc/esp-2021r2-patch5-8.4.0/bin/../lib/gcc/xtensa-esp32s3-elf/8.4.0/../../../../xtensa-esp32s3-elf/bin/ld.exe: D:\YL\Documents\Arduino\arduimo_project\hardware\esp32\hardware\esp32\2.0.7\libraries\BluetoothSerial\src/BluetoothSerial.cpp:558: undefined reference to `esp_bt_gap_ssp_confirm_reply' collect2.exe: error: ld returned 1 exit status exit status 1 Compilation error: exit status 1是什么意思?
最新发布
11-15
main.c: In function ‘main’: main.c:27:9: warning: implicit declaration of function ‘start_multi_thread_server’ [-Wimplicit-function-declaration] start_multi_thread_server(PORT); ^ main.c:29:9: warning: implicit declaration of function ‘start_io_multiplexing_server’ [-Wimplicit-function-declaration] start_io_multiplexing_server(PORT); ^ gcc -Wall -Wextra -g -c process.c -o process.o gcc -Wall -Wextra -g -c thread.c -o thread.o gcc -Wall -Wextra -g -c io.c -o io.o gcc -Wall -Wextra -g main.o process.o thread.o io.o -o server -pthread process.o: In function `main': /home/user/code/web_process 1/process.c:81: multiple definition of `main' main.o:/home/user/code/web_process 1/main.c:17: first defined here thread.o: In function `send_response': /home/user/code/web_process 1/thread.c:17: multiple definition of `send_response' process.o:/home/user/code/web_process 1/process.c:14: first defined here thread.o: In function `handle_request': /home/user/code/web_process 1/thread.c:31: multiple definition of `handle_request' process.o:/home/user/code/web_process 1/process.c:28: first defined here thread.o: In function `main': /home/user/code/web_process 1/thread.c:84: multiple definition of `main' main.o:/home/user/code/web_process 1/main.c:17: first defined here io.o: In function `main': /home/user/code/web_process 1/io.c:21: multiple definition of `main' main.o:/home/user/code/web_process 1/main.c:17: first defined here io.o: In function `handle_request': /home/user/code/web_process 1/io.c:112: multiple definition of `handle_request' process.o:/home/user/code/web_process 1/process.c:28: first defined here io.o: In function `send_response': /home/user/code/web_process 1/io.c:98: multiple definition of `send_response' process.o:/home/user/code/web_process 1/process.c:14: first defined here main.o: In function `main': /home/user/code/web_process 1/main.c:27: undefined reference to `start_multi_thread_server' /home/user/code/web_process 1/main.c:29: undefined reference to `start_io_multiplexing_server' collect2: error: ld returned 1 exit status makefile:10: recipe for target 'server' failed make: *** [server] Error 1报错了
08-15
评论 2
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值