Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Unicode compiling

Unicode compiling

Scheduled Pinned Locked Moved C / C++ / MFC
helpc++comquestionlearning
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Timothy Grabrian
    wrote on last edited by
    #1

    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

    L R 2 Replies Last reply
    0
    • T Timothy Grabrian

      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

      L Offline
      L Offline
      l a u r e n
      wrote on last edited by
      #2

      have u changed the program entry point in the project settings?


      "there is no spoon"
      biz stuff about me

      T 1 Reply Last reply
      0
      • L l a u r e n

        have u changed the program entry point in the project settings?


        "there is no spoon"
        biz stuff about me

        T Offline
        T Offline
        Timothy Grabrian
        wrote on last edited by
        #3

        Yeah I was going to do that, but I couldn't find where to do it at. wWw.KruncherInc.cOm

        1 Reply Last reply
        0
        • T Timothy Grabrian

          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

          R Offline
          R Offline
          Ryan Binns
          wrote on last edited by
          #4

          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 use char? 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, so new 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 use PTCHAR for variables that are intended to point to a single character, and LPTSTR 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 use new.

          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"

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups