User forums > Help

compiler flags issue

(1/1)

suxotova:
Hi, i am having problems when compiling in CB, my program is using threads so i need to use -lpthread as last compiler flag, but CB puts this option

need this: g++ -Wall -pedantic -std=c++11 main.cpp -o main -lpthread
have this:


--- Code: ----------------- Build: Debug in osy (compiler: GNU GCC Compiler)---------------

g++ -lpthread -pedantic -std=c++11 -Wall -g -Wall -fexceptions -lpthread -pedantic -std=c++11 -Wall  -c /home/samuel/Desktop/osy/main.cpp -o obj/Debug/main.o
g++  -o bin/Debug/osy obj/Debug/main.o   [url]https://sexcams.fans/[/url]
obj/Debug/main.o: In function `prodArbitrageFunc(Info&)': [url]https://freelivesexcams.me/[/url] , [url]https://freecams.name/[/url]
/home/samuel/Desktop/osy/main.cpp:118: undefined reference to `sem_wait'
/home/samuel/Desktop/osy/main.cpp:124: undefined reference to `sem_post'
--- End code ---

i am using pultiple -lpthread flag above because i tried to put it everywhere i could  :)

https://sexcams.fans/
https://freelivesexcams.me/ , https://freecams.name/

stahta01:
Did you try putting the library in the library list in your CB project?

https://wiki.codeblocks.org/index.php/FAQ-Compiling_(general)#Q:_I_would_like_to_compile_a_project_using_some_non-standard_libraries._How_can_I_indicate_to_CodeBlocks_that_these_libraries_and_include_files_exist.3F

Tim S.

osdt:
Compilation (source file) and linking (executable) are two separate steps.

You'll need to set -pthread within 'Compiler options' and -lpthread within 'Linker options'.

Navigation

[0] Message Index

Go to full version