Skip to content

Errors when compiling with C++ #95

@ntmchau2202

Description

@ntmchau2202

I've found your threadpool incredible and am using it for my C++ project. However, when I built it with g++ and c++11 library (option -std=c++11 ), i got into this issue:

thpool.c:68:3: error: changes meaning of ‘jobqueue’ from ‘typedef struct jobqueue jobqueue’ [-fpermissive] } jobqueue;

I've searched for solution and found out that princessannabelle had issued this on 2017. However, the problems may not lie in the worker function, but in some structure names that you've defined in thpool.cpp. Some of them are the same as some of your varriables, so that g++ got confused and raised errors, which may not happen with gcc due to differences in privacy of the 2 compilers.

I tried to change all the duplicated names and things works fine.

So, i opened this issue and suggest some modifications so that both C and C++ users can enjoy your work with more convenient. Here are my changes on your code that flow fine.

Thanks for your consideration

Screenshot_648
Screenshot_649
Screenshot_650
Screenshot_651
Screenshot_652

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions