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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Unicode/Ansi conversion macros in '.c' files

Unicode/Ansi conversion macros in '.c' files

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpquestion
2 Posts 2 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.
  • C Offline
    C Offline
    Chris Vischer
    wrote on last edited by
    #1

    Hi all, how can i use the unicode/ansi conversion macros like T2A( ) in an c-file. The macros are defined in the afxpriv.h, but if i include this headerfile i get the error that my file has no 'cpp' extension. -> #error MFC requires C++ compilation (use a .cpp suffix) Can anybody help with a solution or a workaround? TIA, Chris

    S 1 Reply Last reply
    0
    • C Chris Vischer

      Hi all, how can i use the unicode/ansi conversion macros like T2A( ) in an c-file. The macros are defined in the afxpriv.h, but if i include this headerfile i get the error that my file has no 'cpp' extension. -> #error MFC requires C++ compilation (use a .cpp suffix) Can anybody help with a solution or a workaround? TIA, Chris

      S Offline
      S Offline
      Stober
      wrote on last edited by
      #2

      The "work abound" is to change the extension of your file from .c to .cpp. Then if you want the functions in your new .cpp to be callable from other .c file functions, wrap your functions like this: #ifdef __cplusplus extern "C" { #endif int foo(); #ifdef __cplusplus } #endif

      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