Just contact Codeblocks in the fedora9 under the configuration of the environment, copied the book a piece of thread application code. Encounter two confusing problems. Not resolved.
1. Start compiling, prompting pthread_create undefined (use: res = pthread_create (&thread[no), NULL, Thrd_func, (void*) No).
Internet reason: Problem reason: Pthread Library is not the default library of Linux system, the connection needs to use static library libpthread.a, so create a thread using Pthread_create (), and call Pthread_atfork () function to establish a fork handler, you need to link the library.
You then add LIBPTHREAD.A to the Codeblocks linker settings item to find the file in/usr/bin/lib (note that different environmental paths may vary).
2. Compile again. Undefined questions were solved, but then a larger problem came.
Debug information:
/USR/LIB/LIBPTHREAD.A (PTHREAD_CREATE.O) | | In function ' Pthread_create ': |
(. text+0xa2f) | | Undefined reference to ' _dl_stack_flags ' |
/USR/LIB/LIBPTHREAD.A (PTHREAD_CREATE.O) | | In function ' Pthread_create ': |
(. Text+0xbe5) | | Undefined reference to ' _dl_stack_flags ' |
/USR/LIB/LIBPTHREAD.A (PTW-PAUSE.O) | | In function ' __pause_nocancel ': |
(. text+0x18) | | Undefined reference to ' __syscall_error ' |
/USR/LIB/LIBPTHREAD.A (PTW-PAUSE.O) | | In function ' __pause_nocancel ': |
(. text+0x3b) | | Undefined reference to ' __syscall_error ' |
/USR/LIB/LIBPTHREAD.A (INIT.O) | | In function ' __pthread_initialize_minimal ': |
(. text+0x1c) | | Undefined reference to ' __libc_setup_tls ' |
/USR/LIB/LIBPTHREAD.A (INIT.O) | | In function ' __pthread_initialize_minimal ': |
(. text+0x236) | | Undefined reference to ' _dl_init_static_tls ' |
/USR/LIB/LIBPTHREAD.A (INIT.O) | | In function ' __pthread_initialize_minimal ': |
(. text+0x240) | | Undefined reference to ' _dl_wait_lookup_done ' |
/USR/LIB/LIBPTHREAD.A (PTW-READ.O) | | In function ' __read_nocancel ': |
(. text+0x26) | | Undefined reference to ' __syscall_error ' |
/USR/LIB/LIBPTHREAD.A (PTW-READ.O) | | In function ' __read_nocancel ': |
(. text+0x56) | | Undefined reference to ' __syscall_error ' |
/USR/LIB/LIBPTHREAD.A (PTW-OPEN.O) | | In function ' __open_nocancel ': |
(. text+0x26) | | Undefined reference to ' __syscall_error ' |
/USR/LIB/LIBPTHREAD.A (PTW-OPEN.O) | | In function ' __open_nocancel ': |
(. text+0x56) | | Undefined reference to ' __syscall_error ' |
/USR/LIB/LIBPTHREAD.A (SIGACTION.O) | | In function ' __libc_sigaction ': |
(. text+0x46) | | Undefined reference to ' _DL_SYSINFO_DSO ' |
|| = = = Completed Build: 12 errors, 0 warnings ===|
It's a faint dish to see this. The predecessor was able to guide the maze. Thank.
Documents are scheduled #include <pthread.h>