Help!!!!! Error

Started by
5 comments, last by Gabe 16 years, 4 months ago
I Use Visual C++ 2008 and I Compiled a window and I got an Error, but I don't know what it means! Here it is: error C2440: '=' : cannot convert from 'const wchar_t [13]' to 'LPCSTR' Please Respond as soon as possible!!!!!!!!
Advertisement
Calm down. Easy on those exclamation marks :)

The first thing you do on these kinds of errors is double click on it, and VC will point you to the line in your code where the error is.
Then, you copy and paste a bunch of lines from that general area into your post, so we can better analyse what's going on.

The error has *something* to do with you mismatching wide and narrow strings. Once you post the actual code, I might be able to come up with an actual solution.
Sorry about the Exclamation marks I am just new and want to learn alot. I found out what it was from a guy named Chris. He told me it was because I had L's in front of my output text. I have another problem now though(seems I'm always having Problems). I have an include file from the directx sdk 2007 that I used and it won't let me compile because it says it can't find the file directory or something. Please help!
The header was d3dx9.h, but I was able to load all the other headers except this one. It is in the SDK, but it won't load it!
You are using "wide" characters in your project. Try surrounding the string with _T( )
You can go another way with this as well.

My guess is that you're probably copying and pasting code from the DirectX SDK, and discovering that it doesn't compile right out of the box.

That's because they've defined their project to use Unicode chars, and by default, you probably haven't. If you want to get the Unicode chars out of there and just go with standard old C chars (not the most portable solution), dropping the "L's" as you did will take care of it for the most part.

If, on the other hand, you do want to use the wide chars (which you'll be happy you did if you intend to localize your game later on), open the Properties window (in VS2005, at least), and under General->Character Set, select "Use Unicode Character Set". That should get you on your feet.
Quote:Original post by Gabe
I have an include file from the directx sdk 2007 that I used and it won't let me compile because it says it can't find the file directory or something.

'Or something'?

If the linker can't find find an input file, it will tell you all the details. Only you are in a position to find out why it's not being found and to point the linker in the right direction. If you're still stuck, paste us the error, tell us where the file is and how you've told the IDE of its whereabouts and we'll be in a much better position to help.
Ring3 Circus - Diary of a programmer, journal of a hacker.
Yeah I found the problem thanks for the help though!

This topic is closed to new replies.

Advertisement