News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

compiler flags issue

Started by suxotova, March 11, 2022, 04:11:40 AM

Previous topic - Next topic

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:

-------------- 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'


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

C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

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'.