英文:
c++ boost.thread executable not running
问题
抱歉,以下是您要翻译的内容:
"I'm new to c++ (but not from programing), and I wanted to create a program with thread. I installed boost (https://gist.github.com/zrsmithson/0b72e0cb58d0cb946fc48b5c88511da8) on my computer (windows), but when I run the executable the program just stop (no errors).
The program is the helloworld.cpp program inside the folder example. I think the issue is the lib (-lboost_thread-mgw63-mt-x32-1_66 -lboost_system-mgw63-mt-x32-1_66 -lboost_chrono-mgw63-mt-x32-1_66) or the compiler (MinGW).
The code:
#include <boost/thread/thread.hpp>
#include <iostream>
void helloworld()
{
std::cout << "Hello World!" << std::endl;
}
int main()
{
boost::thread thrd(&helloworld);
thrd.join();
}
Excuse me for my English.
Thank you in advance for your help,
Flayme"
英文:
I'm new to c++ (but not from programing), and I wanted to create a program with thread. I installed boost (https://gist.github.com/zrsmithson/0b72e0cb58d0cb946fc48b5c88511da8) on my computer (windows), but when I run the executable the program just stop (no errors).
The program is the helloworld.cpp program inside the folder example. I think the issue is the lib (-lboost_thread-mgw63-mt-x32-1_66 -lboost_system-mgw63-mt-x32-1_66 -lboost_chrono-mgw63-mt-x32-1_66) or the compiler (MinGW).
The code:
#include <boost/thread/thread.hpp>
#include <iostream>
void helloworld()
{
std::cout << "Hello World!" << std::endl;
}
int main()
{
boost::thread thrd(&helloworld);
thrd.join();
}
Excuse me for my English.
Thank you in advance for your help,
Flayme
答案1
得分: 0
我通过将库放置在编译目录中,并将-L"\MinGW\lib"
更改为-L
来解决了这个问题。
英文:
I resolved the issue by putting the library inside the folder where I compile, and then changed -L"\MinGW\lib"
to -L
.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论