#include <string> Won't compile in DEBUG mode

The Partridge Family were neither partridges nor a family. Discuss.
Post Reply
User avatar
Asimov
Posts: 814
Joined: May 19th, 2012, 11:38 pm

#include <string> Won't compile in DEBUG mode

Post by Asimov » July 7th, 2012, 2:30 am

Hi Chilli,

I am totally stuck on this. Well not on the program. I am doing well with that, but what I am stuck on is why it won't compile in DEBUG mode.

I am actually working on my new font routine. This one differs from yours in the fact that it does NON fixed width fonts. I will eventually add the other option too.

Anyway my program is coming on well. It does what it says on the tin. It puts my text on the screen. It's not quite finished yet.

Now the problem is this. It compiles in RELEASE mode but not in DEBUG mode. I like debug mode because it is the best when I need to DEBUG LOL.

I only have to add these three lines and it will not compile

#include <string>
using namespace std;
string text("Chilli");

That is just an example, but I will attach my code for you to see.
I put the include and the namespace in FontLoader.h and the string functions are in Fontloader.cpp.

I hope you can see why it won't compile cos it is damn annoying LOL.

Asimov
Attachments
Font.zip
(2.64 MiB) Downloaded 144 times
----> Asimov
"You know no matter how much I think I have learnt. I always end up hitting brick walls"
http://www.asimoventerprises.co.uk

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: #include <string> Won't compile in DEBUG mode

Post by chili » July 7th, 2012, 4:20 am

Both compile fine for me bro. ;)

Try compiling debug from your cleaned version.
Chili

User avatar
Asimov
Posts: 814
Joined: May 19th, 2012, 11:38 pm

Re: #include <string> Won't compile in DEBUG mode

Post by Asimov » July 7th, 2012, 9:55 am

Hi Chilli,

Everytime I try to compile in DEBUG mode I get the following error

1>libcpmtd.lib(stdthrow.obj) : error LNK2019: unresolved external symbol __CrtDbgReportW referenced in function "void __cdecl std::_Debug_message(wchar_t const *,wchar_t const *,unsigned int)" (?_Debug_message@std@@YAXPB_W0I@Z)
1>C:\Users\Thomas R Williams\Desktop\Font\Debug\Chili DirectX Framework.exe : fatal error LNK1120: 1 unresolved externals
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:08.86
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

I didn't post the error last night as I was sure you would get the same error. I am going mad as I can see nothing wrong with my code, and it works in RELEASE mode

I also did as you suggested and tried to compile in DEBUG after cleaning the files as well.

Asimov
----> Asimov
"You know no matter how much I think I have learnt. I always end up hitting brick walls"
http://www.asimoventerprises.co.uk

User avatar
Asimov
Posts: 814
Joined: May 19th, 2012, 11:38 pm

Re: #include <string> Won't compile in DEBUG mode

Post by Asimov » July 7th, 2012, 10:15 am

Hi Chilli,

I solved the problem by changing the linker settings, which is strange.

In both the RELEASE version and the DEBUG version the runtime library was set to
Multithreaded (/MT)

Anyway in the DEBUG version I changed this to Multithreaded (/Mtd) and then it compiled fine.

I am afraid the linker and all the stuff in there is a bit of a mystery to me. I just changed it on the offchance and it worked.

I wonder why my file worked for you though. I thought the stuff in properties was dependant on the file loaded in.

Asimov
----> Asimov
"You know no matter how much I think I have learnt. I always end up hitting brick walls"
http://www.asimoventerprises.co.uk

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: #include <string> Won't compile in DEBUG mode

Post by chili » July 7th, 2012, 11:55 am

I was thinking the same thing. First I thought you might have different linker/code generation setting for debug and release. But then I thought that if that were the case, it shouldn't work for me either. Strange stuff, but at least you're settled now. ;)
Chili

Post Reply