Author Topic: compiler flags issue  (Read 1866 times)

suxotova

  • Guest
compiler flags issue
« on: March 11, 2022, 04:11:40 am »
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'

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/
« Last Edit: June 21, 2022, 06:33:30 am by suxotova »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7588
    • My Best Post
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline osdt

  • Multiple posting newcomer
  • *
  • Posts: 63
Re: compiler flags issue
« Reply #2 on: March 11, 2022, 05:52:17 am »
Compilation (source file) and linking (executable) are two separate steps.

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