Unicode compiling
-
I have a app that needs to read and write stuff to the reg, I have my custom Reg functions in a seperate CPP file "RegHelpers.cpp" along with a header file "RegHelpers.h". If I uncomment these 2 lines it gives a "unresolved external symbol" error for the functions in "RegHelpers.h" //#define _UNICODE //#define UNICODE #include #include #include "resource.h" #include "RegHelpers.h" I can not figure out what the problem is!!! To make my program fully Unicode don't I need to change some Preprocessor settings? Also, I used to use strings like this all the time: LPSTR String = new char[256]; then I learnt about unicode, so I started doing them this way: PTCHAR String = new TCHAR[256]; Do I need to do "new TCHAR[256 * sizeof(TCHAR)];"? Also should I change them from PTCHAR to LPTSTR? Do I really need to use the new operator on my strings? Haha I'm really starting to hate data types. wWw.KruncherInc.cOm
-
I have a app that needs to read and write stuff to the reg, I have my custom Reg functions in a seperate CPP file "RegHelpers.cpp" along with a header file "RegHelpers.h". If I uncomment these 2 lines it gives a "unresolved external symbol" error for the functions in "RegHelpers.h" //#define _UNICODE //#define UNICODE #include #include #include "resource.h" #include "RegHelpers.h" I can not figure out what the problem is!!! To make my program fully Unicode don't I need to change some Preprocessor settings? Also, I used to use strings like this all the time: LPSTR String = new char[256]; then I learnt about unicode, so I started doing them this way: PTCHAR String = new TCHAR[256]; Do I need to do "new TCHAR[256 * sizeof(TCHAR)];"? Also should I change them from PTCHAR to LPTSTR? Do I really need to use the new operator on my strings? Haha I'm really starting to hate data types. wWw.KruncherInc.cOm
-
Yeah I was going to do that, but I couldn't find where to do it at. wWw.KruncherInc.cOm
-
I have a app that needs to read and write stuff to the reg, I have my custom Reg functions in a seperate CPP file "RegHelpers.cpp" along with a header file "RegHelpers.h". If I uncomment these 2 lines it gives a "unresolved external symbol" error for the functions in "RegHelpers.h" //#define _UNICODE //#define UNICODE #include #include #include "resource.h" #include "RegHelpers.h" I can not figure out what the problem is!!! To make my program fully Unicode don't I need to change some Preprocessor settings? Also, I used to use strings like this all the time: LPSTR String = new char[256]; then I learnt about unicode, so I started doing them this way: PTCHAR String = new TCHAR[256]; Do I need to do "new TCHAR[256 * sizeof(TCHAR)];"? Also should I change them from PTCHAR to LPTSTR? Do I really need to use the new operator on my strings? Haha I'm really starting to hate data types. wWw.KruncherInc.cOm
KingKruncher wrote: If I uncomment these 2 lines it gives a "unresolved external symbol" error for the functions in "RegHelpers.h" You haven't really given enough information, but... Is RegHelpers.cpp compiled into a library? And if so, was the library also compiled for Unicode? If not, you'll get these errors. If it's not a library, does the header file use
TCHAR
and the cpp file usechar
? This will also cause these linker errors only for Unicode builds. Other than that, you'll have to give a bit more information. KingKruncher wrote: Do I need to do "new TCHAR[256 * sizeof(TCHAR)];"? No. The [] verison of new allocates multiples of the data size, sonew TCHAR[256]
allocates 256 bytes for non-unicode builds and 512 bytes for unicode builds. KingKruncher wrote: Also should I change them from PTCHAR to LPTSTR? It doesn't really matter - they are defined the same. Personally, I usePTCHAR
for variables that are intended to point to a single character, andLPTSTR
for variables that are a string, as that is what the names suggest. KingKruncher wrote: Do I really need to use the new operator on my strings? You could allocate them on the stack like any other array, but if you need them to persist beyond a single function, then usenew
.Ryan
"Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"