473,721 Members | 2,403 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 5768
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
4749
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
1644
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
8004
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
1727
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
7245
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
5297
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
2219
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
2191
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
4278
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
8736
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9373
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
9227
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...
0
9074
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...
1
6676
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4491
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...
0
4761
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2584
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2137
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.