Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/162.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Win32 DLL项目中的Boost线程运行时错误 我正在使用一个C++ DLL项目。我试着在那里使用简单的boost线程。这是源代码。此运行时异常位于uploadThread=boost::thread(uploadFileThread)行。有什么想法吗_C++_Visual C++_Boost Thread - Fatal编程技术网

Win32 DLL项目中的Boost线程运行时错误 我正在使用一个C++ DLL项目。我试着在那里使用简单的boost线程。这是源代码。此运行时异常位于uploadThread=boost::thread(uploadFileThread)行。有什么想法吗

Win32 DLL项目中的Boost线程运行时错误 我正在使用一个C++ DLL项目。我试着在那里使用简单的boost线程。这是源代码。此运行时异常位于uploadThread=boost::thread(uploadFileThread)行。有什么想法吗,c++,visual-c++,boost-thread,C++,Visual C++,Boost Thread,Win32 DLL项目中的Boost线程运行时错误 我正在使用一个C++ DLL项目。我试着在那里使用简单的boost线程。这是源代码。此运行时异常位于uploadThread=boost::thread(uploadFileThread)行。有什么想法吗 Unhandled exception at 0x6fa1bd89 (Controller.dll) in UserInterfaces.exe: 0xC0000005: Access violation reading location 0

Win32 DLL项目中的Boost线程运行时错误 <>我正在使用一个C++ DLL项目。我试着在那里使用简单的boost线程。这是源代码。此运行时异常位于
uploadThread=boost::thread(uploadFileThread)行。有什么想法吗

Unhandled exception at 0x6fa1bd89 (Controller.dll) in UserInterfaces.exe: 0xC0000005: Access violation reading location 0xbaadf05d.
控制器.h Controller.cpp main.cpp
很难说您发布的代码到底出了什么问题,但您使用的是未初始化的内存。当附加调试器时,Win32堆将用
0xBAADF00D
填充新分配的内存。@JamesMcNellis-谢谢,我无法高兴地理解你说的第二句话是什么意思。请您详细解释一下。在Windows上,如果调试器连接到进程,则新分配的内存将填充字节模式
0xBAADF00D
,以帮助您识别未初始化内存的使用情况。(Win32
HeapAlloc
函数执行此填充)。您引用的异常消息报告在尝试访问地址为
0xbaadf05d
的内存时发生访问冲突。此地址的上三个字节几乎肯定是未初始化的内存。该代码不会编译-您声明一个类
CController
,但定义一个类型为
Controller
的变量,缺少分号,缺少using指令或命名空间说明符等。Main应该返回int,而不是void。您的类定义缺少
StartFileUpload
等的声明。请给我们一个真实代码的例子,这样我们就能知道真正的问题是什么。@ArneMertz-谢谢。修正了主要方法。StartFileUpload故意声明为非成员函数。
namespace controller{
class  CController {
public: 
boost::thread uploadThread;
}
}
namespace controller{
static void uploadFileThread(){}
void CController::StartFileUpload(){        
        uploadThread = boost::thread(uploadFileThread);
        uploadThread.join();
}
}
int main(){
controller::CController my_Controller;
my_Controller.StartFileUpload();
return 0;
}