473,938 Members | 14,832 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

error C2665 :none of the number1 overloads can convert parameter number2 from type 'type'

Hi, I have a multithread problem like the following lines, when I compile
this code I caught a "error C2665", the error description is : none of the
number1 overloads can convert parameter number2 from type 'type'

//-----------------------------
UINT ReadDatFile(int i_thread)
{
AfxMessageBox(i _thread);
return 0;
}

// CReadDatFilesVi ew ÏûÏ¢´¦Àí³ÌÐò

void CReadDatFilesVi ew::OnBnClicked Readfile()
{
// TODO: ÔÚ´ËÌí¼Ó¿Ø¼þꬅ ª´¦Àí³ÌÐò´úÂë
UpdateData();
int i_threadnum;
for(i_threadnum =1;i_threadnum< =m_maxthreadnum ;i_threadnum++)
{
AfxBeginThread( ReadDatFile(i_t hreadnum),GetSa feHwnd(),THREAD _PRIORITY_NORMA L);
}
}
//------------------------------
Could anybody tell me why? Thanks in advance!

Joseph
Jul 17 '06 #1
2 5800
First of all, when posting questions like this, you should identify the
exact line that triggers the error, and the complete error message.
Otherwise we have to read through all of the code, trying to figure out
which line it might be.
Hi, I have a multithread problem like the following lines, when I compile
this code I caught a "error C2665", the error description is : none of
the number1 overloads can convert parameter number2 from type 'type'

//-----------------------------
UINT ReadDatFile(int i_thread)
{
AfxMessageBox(i _thread);
return 0;
}
This is not the correct function signature for a thread function.
Check MSDN.
>
// CReadDatFilesVi ew ÏûÏ¢´¦Àí³ÌÐò

void CReadDatFilesVi ew::OnBnClicked Readfile()
{
// TODO: ÔÚ´ËÌí¼Ó¿Ø¼þꬅ ª´¦Àí³ÌÐò´úÂë
UpdateData();
int i_threadnum;
for(i_threadnum =1;i_threadnum< =m_maxthreadnum ;i_threadnum++)
{

AfxBeginThread( ReadDatFile(i_t hreadnum),GetSa feHwnd(),THREAD _PRIORITY_NORMA L);
}
}
You supply the wrong arguments.
The first parameter should be the function pointer only.
You try to supply a function pointer together with the function argument.

If your function has the correct signature, it will receive the 2nd
parameter of AfxBeginThread as a parameter when it is executed.
Read the documentation for AfxBeginThread for more information.

--

Kind regards,
Bruno van Dooren
br************* *********@hotma il.com
Remove only "_nos_pam"
Jul 17 '06 #2
>
//-----------------------------
UINT ReadDatFile(int i_thread)
{
AfxMessageBox(i _thread);
^---- This should be a resource ID or a text
--
Kind regards, Michael Buechel

while(!sleep())
sheeps++;

"Bruno van Dooren [MVP VC++]" <br************ **********@hotm ail.comschrieb
im Newsbeitrag news:eZ******** ******@TK2MSFTN GP04.phx.gbl...
First of all, when posting questions like this, you should identify the
exact line that triggers the error, and the complete error message.
Otherwise we have to read through all of the code, trying to figure out
which line it might be.
>Hi, I have a multithread problem like the following lines, when I compile
this code I caught a "error C2665", the error description is : none of
the number1 overloads can convert parameter number2 from type 'type'

//-----------------------------
UINT ReadDatFile(int i_thread)
{
AfxMessageBox( i_thread);
return 0;
}

This is not the correct function signature for a thread function.
Check MSDN.
>>
// CReadDatFilesVi ew ÏûÏ¢´¦Àí³ÌÐò

void CReadDatFilesVi ew::OnBnClicked Readfile()
{
// TODO: ÔÚ´ËÌí¼Ó¿Ø¼þꬅ ª´¦Àí³ÌÐò´úÂë
UpdateData() ;
int i_threadnum;
for(i_threadnu m=1;i_threadnum <=m_maxthreadnu m;i_threadnum++ )
{

AfxBeginThread (ReadDatFile(i_ threadnum),GetS afeHwnd(),THREA D_PRIORITY_NORM AL);
}
}

You supply the wrong arguments.
The first parameter should be the function pointer only.
You try to supply a function pointer together with the function argument.

If your function has the correct signature, it will receive the 2nd
parameter of AfxBeginThread as a parameter when it is executed.
Read the documentation for AfxBeginThread for more information.

--

Kind regards,
Bruno van Dooren
br************* *********@hotma il.com
Remove only "_nos_pam"

Jul 17 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
4778
by: Peter Frost | last post by:
Please help I don't know if this is possible but what I would really like to do is to use On Error Goto to capture the code that is being executed when an error occurs. Any help would be much appreciated. Thanks in advance
2
1654
by: Hendrik Schober | last post by:
Hi, I have some expression template code that I want to get to work. I had a typo in it and just spent two hours to find it, because VC7.1 gave a really weird error message for it. This is the code: template< typename T1, typename TExpr, typename T2> inline
5
8021
by: Gang Zhang | last post by:
Hi, I have 2 overloaded functions as below: myfunc(byval val as Decimal) as string myfunc(byval val as String) as string When calling the function with a single like: dim num1 as single = ...
2
1738
by: JRamirez | last post by:
Need help cannot figure out where I made the error. -------------------------------------------------------------------------------- Can someone view what I have, I need help I cannot figure out where I went wrong. Thanks /* Jose N. Ramirez CS151
2
7268
by: Angus | last post by:
Hello I have some classes defined in shapes.h and use them like this: const IShape* rectangle = new Rectangle(10.0, 20.0); // width, height cout << rectangle->calculateArea() << endl; delete rectangle; // causes error C2665 error
2
5306
Schwack
by: Schwack | last post by:
I've just started learning C++ (got bored at work) and I'm using VC++ to compile some simple code but I get a compile error in test.cpp when using "getline". I've searched the internet and this forum but can't find an answer. I hope that someone can help :-) test.h: #include <iostream> #include <fstream> #include <string> using namespace std; class ReadFile
8
2229
by: Kid Programmer | last post by:
Hello guys. I am trying to create a calculator program in a GUI window. When I compile the code I get the following errors: Severity and Description Path Resource Location Creation Time Id The local variable add is never read CalculatorProgram/src/Calculator Calculator.java line 19 1211809496146 548 The local variable contentPane is never read CalculatorProgram/src/Calculator Calculator.java line 17 1211809496146 545 The local variable...
10
2217
kiseitai2
by: kiseitai2 | last post by:
Hi everyone. My problem is tha Dev-C++ compiles perfectly fine but it fails in the linking process. I receive the linker error "multiple definitions of"; howerver, I modified the names of the functions in three of the files, checked my code to make sure I wasn't redefining my functions, changed code back and forth from .cpp to .h, and even excluded some files from the project and included them manually. Also, I even recopied the lines of code...
6
4293
by: Ahmedhussain | last post by:
Hi there, I m doing work on a gridview and Im getting an error: A potentially dangerous Request.Form value was detected from the client (ctl00$Content$GridView1$ctl03$TextBox1="<span class='txtColo...") Im using an access database. and when ever I try to update this it doesnt work. <%@ Page Language="C#" MasterPageFile="Mysite.master" Title="Untitled Page" %> <script runat = "server"> protected void Page_Load(object sender,...
0
10126
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
11515
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
11099
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
11282
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10652
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9854
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
7377
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
6072
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4900
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.