On Thu, 2008-04-24 at 11:26 +0300, Bogdan Cristea wrote:
I use semaphores in a C++ class, but I get errors when linking my programs. Below is the output when compiling and linking the programs. It seems that the functions related to semaphores are not found by the linker. Could you advise please?
g++ -c -ansi -pedantic -Werror -Wall -O3 -W -Wconversion -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -fshort-enums -fno-common use_cb.cpp -o use_cb.o g++ -c -ansi -pedantic -Werror -Wall -O3 -W -Wconversion -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -fshort-enums -fno-common CB.cpp -o CB.o g++ use_cb.o CB.o -o use_cb CB.o: In function `CB::reset()': CB.cpp:(.text+0x1e5): undefined reference to `sem_destroy' CB.cpp:(.text+0x200): undefined reference to `sem_init' CB.o: In function `CB::create(int const&)': CB.cpp:(.text+0x266): undefined reference to `sem_init' CB.o: In function `CB::write(char const*, int const&)': CB.cpp:(.text+0x35f): undefined reference to `sem_post' CB.o: In function `CB::read(char*, int const&)': CB.cpp:(.text+0x3e7): undefined reference to `sem_wait' CB.o: In function `CB::clear()': CB.cpp:(.text+0x565): undefined reference to `sem_destroy' CB.cpp:(.text+0x580): undefined reference to `sem_init' CB.o: In function `CB::release()': CB.cpp:(.text+0x5dc): undefined reference to `sem_destroy' CB.cpp:(.text+0x5f7): undefined reference to `sem_init' CB.cpp:(.text+0x62f): undefined reference to `sem_destroy' collect2: ld returned 1 exit status make: *** [use_cb] Error 1
#include
-- Bogdan Cristea -- Roger Oberholtzer
OPQ Systems / Ramböll RST Ramböll Sverige AB Kapellgränd 7 P.O. Box 4205 SE-102 65 Stockholm, Sweden Office: Int +46 8-615 60 20 Mobile: Int +46 70-815 1696 -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org