Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6169367
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T22:50:46+00:00 2026-05-23T22:50:46+00:00

Any comment is appreciated for the compile error below. Although my question is similar

  • 0

Any comment is appreciated for the compile error below.
Although my question is similar to other thread: pthread function from a class, I still haven’t been able to solve my problem. I am still not that familliar with pointer, and thread programming in C & C++.

Error

../src/Main.cpp: In function ‘int main(int, char**)’:
../src/Main.cpp:22: error: invalid conversion from ‘unsigned int* (*)(void*)’ to ‘void* (*)(void*)’
../src/Main.cpp:22: error:   initializing argument 3 of ‘int pthread_create(pthread_t*, const pthread_attr_t*, void* (*)(void*), void*)’
make: *** [src/Main.o] Error 1

Main.cpp

#include <process.h>
#include "ThreadInstance.hpp"
#include <iostream>
#include <fstream>
using namespace std;

int main(int argc, char** argv)
{
    pthread_mutex_t mutex;
    int ht1;
    pthread_t threadId1;
    pthread_attr_t attr1;

    pthread_mutex_init(&mutex, NULL);
    pthread_attr_init(&attr1);
    pthread_attr_setdetachstate(&attr1, PTHREAD_CREATE_DETACHED);

    ht1 = pthread_create(&threadId1,
            &attr1,
            &ThreadInstance::ThreadEntryPoint,
            //(void *)readThread);
            NULL);

    unsigned long rc = 0;
    rc = pthread_join(ht1, NULL);

    return 0;
}

ThreadInstance.hpp

#ifndef _SCENE_CLASSIFY_THREAD_H
#define _SCENE_CLASSIFY_THREAD_H

#ifndef STDCALL
#define STDCALL __attribute__((stdcall))
#endif

using namespace std;

class ThreadInstance
{
    public:
        ThreadInstance();
        ThreadInstance(int camNum);

        void startUp();

        static unsigned STDCALL* ThreadEntryPoint(void* pThis)
        {
            //static unsigned __stdcall ThreadEntryPoint(void* pThis) {
            ThreadInstance *ptr = (ThreadInstance*) pThis;
            ptr->startUp();
            //return 1; // Returns error "invalid conversion from ‘int’ to ‘unsigned int*’" when the function is declared as pointer.
                            // Since returning either 1 or 0, 
                            // compile error still occurs. 
                            // So this return value should not be the cause.

            return 0; 
        }
        ~ThreadInstance();
};
#endif

Note: Only necessary part is shown

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T22:50:47+00:00Added an answer on May 23, 2026 at 10:50 pm

    Your ThreadEntryPoint must return void*.

    The error indicates the type that is expected, and that is the function pointer type that you are required to use.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

As title Welcome any comment Thanks interdev
a while ago i could comment any code in php with netbeans like this:
The code below worked fine until I added the regex line. When I comment
This is my first question here. I have been searching Stack Overflow and other
I want to compile and use Xapian with xcode on iOS, is there any
Found two libraries Rebex ( www.rebex.net ) and QuikSoft ( www.quiksoft.com ) any comments
I have a source of python program which doesn't have any documentation or comments.
Is there any way to automatically wrap comments at the 80-column boundary as you
Is there any freeware library (controls) for ASP MVC implementing posting and displaying comments?
I read this answer and its comments and I'm curious: Are there any reasons

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.