目录
异常弹窗
- 且有时弹窗后点击中止,程序并不会停止运行
问题定位
- 打断点debug缩小范围,然后发现是一句调用spdlog库生成log文件的代码引发:
- 百度得到了一些解析,这个问题是因为对象在析构时不正确的释放内存导致,且该问题只在使用了动态库才会有
解决办法
- 但spdlog内的代码显然不好去碰,而且这个问题是因为我们链接了spdlog的动态库才会有,那么我们可以使用它的header-only,也就是仅头文件,直接静态编译进入我们的程序,不使用它的动态库了。
- 由于我的项目是用cmake构建,在CMakeLists.txt中,将原来的 spdlog::spdlog 改为 spdlog::spdlog_header_only 即可。
- 然后就发现fmt也来这个问题,我真是吐了
- 那就再加一句,fmt::fmt-header-only 也使用静态编译的方式引入fmt库
最后
- 回顾这个问题,百度上也有博客说应当注意,编译生成动态库应尽量使用 /MD 和 /MDd,避免/MT和/MTd。动态库中避免函数传入参数或返回值使用 std::string 类型,应当使用 std::string& 或 [const] char*。
- 其次,这个问题和编译时的选项有关
- 如果程序和动态库都使用 /MD 编译,则不会有问题
- 如果动态库使用/MT编译,则程序和动态库各自有一个堆,假设我们的程序调用了一个动态库中的一个函数 std::string get(); 而这个string的内存是由动态库分配,但我们的程序并不能区分这个内存是程序的还是动态库的,当对象生命周期结束,就会由程序调用析构函数去释放内存,因此出错。
- 因此解决办法还可以是避免我们的程序去析构动态库返回的string。比如动态库中的函数返回全局变量。
수원출장샵
영등포안마살롱
Good post. I absolutely love this website. Continue the
good work!
Hey! This is kind of off topic but I need some help from an established blog.
Is it hard to set up your own blog? I’m not very techincal but I can figure things out pretty quick.
I’m thinking about setting up my own but I’m not sure where to begin. Do you
have any tips or suggestions? Many thanks
excellent issues altogether, you just gained a new reader.
What could you recommend in regards to your put up that you simply made some days ago?
Any certain?
https://arlstory.com/cheonan-intersection/
https://dnolife.net/software/evernote/
My relatives every time say that I am wasting my time here at
net, however I know I am getting familiarity every day by reading such pleasant content.
We are a group of volunteers and opening a new scheme in our community.
Your site offered us with valuable info to work on. You have performed an impressive activity and our entire neighborhood shall be thankful to you.
I’m impressed, I must say. Seldom do I come across a blog that’s both educative and engaging, and without a doubt, you have hit the
nail on the head. The problem is an issue that too few people are speaking intelligently about.
Now i’m very happy I came across this in my search for something
relating to this.
fantastic publish, very informative. I ponder why the other specialists of this sector don’t
understand this. You should proceed your writing.
I’m sure, you have a huge readers’ base already!
Wow that was unusual. I just wrote an very long comment but after I clicked submit my comment didn’t
show up. Grrrr… well I’m not writing all that
over again. Anyhow, just wanted to say great blog!
https://gorgopage.com/리볼빙-뜻-해지-이자-일부결제금액이월약정리볼빙-100/
Write more, thats all I have to say. Literally, it seems as
though you relied on the video to make your
point. You definitely know what youre talking about, why waste your
intelligence on just posting videos to your blog when you could be giving us something informative
to read?
Undeniably consider that which you said. Your favourite reason appeared
to be at the net the simplest thing to keep in mind of.
I say to you, I certainly get irked while people consider issues that they
plainly don’t know about. You managed to hit the nail upon the
highest and defined out the entire thing without having side
effect , other folks can take a signal. Will likely
be again to get more. Thanks
Hello there, I discovered your website via Google even as searching for a related matter,
your site came up, it seems to be great. I have bookmarked it in my google bookmarks.
Hello there, simply became aware of your weblog thru Google, and found that it is really
informative. I am gonna be careful for brussels.
I will be grateful in case you continue this in future.
Many people will be benefited out of your writing. Cheers!
BWER is Iraq’s premier provider of industrial weighbridges, offering robust solutions to enhance efficiency, reduce downtime, and meet the evolving demands of modern industries.
Hi! I know this is sort of off-topic however I had to ask. Does
operating a well-established website such as yours require a large amount
of work? I’m brand new to blogging however I do write
in my diary on a daily basis. I’d like to start a blog so I
can share my experience and feelings online. Please let me know if you have any recommendations or tips for new aspiring
bloggers. Thankyou!
Have you ever thought about including a little bit more than just your articles?
I mean, what you say is fundamental and everything.
But just imagine if you added some great graphics
or videos to give your posts more, “pop”! Your content is excellent but with pics and clips,
this blog could definitely be one of the best in its field.
Wonderful blog!
You have made some good points there. I checked on the web to
learn more about the issue and found most individuals will go along with
your views on this web site.
It’s a shame you don’t have a donate button! I’d without a
doubt donate to this superb blog! I suppose for now i’ll
settle for bookmarking and adding your RSS feed to
my Google account. I look forward to fresh updates
and will share this site with my Facebook group. Talk soon!
이태원게이바
Hmm is anyone else experiencing problems with the images on this blog loading?
I’m trying to find out if its a problem on my end or if it’s the blog.
Any feed-back would be greatly appreciated.
Everything is very open with a clear explanation of the
issues. It was really informative. Your site is extremely helpful.
Thanks for sharing!
You’re so interesting! I do not think I have read something like that before.
So nice to discover somebody with some unique thoughts on this
topic. Really.. thanks for starting this up.
This website is one thing that is required on the internet, someone with a little originality!
WOW just what I was searching for. Came here by searching for c/c++
Wonderful, what a blog it is! This web site provides helpful data to us, keep
it up.
Hi there very cool blog!! Man .. Beautiful ..
Superb .. I’ll bookmark your web site and take the feeds additionally?
I’m glad to seek out numerous helpful information right here
within the submit, we need develop extra techniques on this regard, thank you for sharing.
. . . . .
It’s actually a nice and useful piece of information. I’m glad that you just shared this useful info with us.
Please stay us up to date like this. Thanks for sharing.
Really when someone doesn’t know after that its up to other viewers that
they will assist, so here it happens.
Fabulous, what a webpage it is! This web site gives helpful information to us, keep it
up.
What’s up, yup this piece of writing is really good and I have learned lot of things from it on the topic of blogging.
thanks.
Fastidious respond in return of this matter with real arguments and describing all about
that.
I always spent my half an hour to read this blog’s posts everyday along with a cup of coffee.
Hi, always i used to check blog posts here early in the dawn, as i enjoy to gain knowledge of more and more.
We’re a group of volunteers and opening a new scheme
in our community. Your website offered us with helpful info to work on. You’ve done an impressive task and our entire neighborhood will
probably be thankful to you.
This is very interesting, You’re a very skilled blogger.
I’ve joined your rss feed and look forward to seeking more of your wonderful post.
Also, I have shared your web site in my social networks!
Hi! Do you use Twitter? I’d like to follow you if that would be okay.
I’m undoubtedly enjoying your blog and look forward to new updates.
Why users still make use of to read news papers when in this technological globe the
whole thing is existing on net?
I really like your blog.. very nice colors & theme.
Did you make this website yourself or did you hire someone to do it for you?
Plz reply as I’m looking to create my own blog and would like to know where
u got this from. thanks a lot
Hello there, just became alert to your blog through Google,
and found that it is really informative. I am gonna watch out for brussels.
I’ll be grateful if you continue this in future. Many people will be benefited from your writing.
Cheers!
When I originally commented I seem to have clicked on the -Notify me when new comments
are added- checkbox and now every time a comment is added I receive four
emails with the exact same comment. Perhaps there is
a means you can remove me from that service?
Many thanks!
Hello! Would you mind if I share your blog
with my facebook group? There’s a lot of people that
I think would really enjoy your content. Please let me know.
Cheers
I’m not sure why but this web site is loading incredibly
slow for me. Is anyone else having this problem or is it a
problem on my end? I’ll check back later and see if the problem still exists.
gluco6 reviews : https://gluco6reviews.usaloves.com/
Wonderful, what a web site it is! This webpage gives valuable facts
to us, keep it up.
I need to to thank you for this good read!!
I absolutely enjoyed every bit of it. I have got you book marked to look at new
stuff you post…
Sweet blog! I found it while surfing around on Yahoo News.
Do you have any suggestions on how to get listed in Yahoo News?
I’ve been trying for a while but I never seem to get there!
Cheers
Very nice article, exactly what I wanted to find.
What’s Happening i’m new to this, I stumbled upon this I’ve found It positively
useful and it has helped me out loads. I am hoping to contribute
& assist other users like its aided me. Good job.