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. ATL / WTL / STL
  4. CString in static library for both MFC and non-MFC projects

CString in static library for both MFC and non-MFC projects

Scheduled Pinned Locked Moved ATL / WTL / STL
c++question
2 Posts 2 Posters 8 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.
  • P Offline
    P Offline
    peterchen
    wrote on last edited by
    #1

    As much as I understand: Non-MFC projects / Projects with ATL support use CString via atlstr.h MFC projects use CString via cstringt.h They are source-code compatible, bbut not link time compatible; so if I have a static library that does use CString and that I want to use in both an MFC and a non-MFC project, I have to build the library in two configurations - with / without MFC support. Is there any sane way to build the library and link it to both MFC and non-MFC projects?

    A 1 Reply Last reply
    0
    • P peterchen

      As much as I understand: Non-MFC projects / Projects with ATL support use CString via atlstr.h MFC projects use CString via cstringt.h They are source-code compatible, bbut not link time compatible; so if I have a static library that does use CString and that I want to use in both an MFC and a non-MFC project, I have to build the library in two configurations - with / without MFC support. Is there any sane way to build the library and link it to both MFC and non-MFC projects?

      A Offline
      A Offline
      Albert Holguin
      wrote on last edited by
      #2

      Remove the CString dependency (i.e. use std::string or something else)... as easy CString is to use, they sure jumbled things up by essentially including it in two places (which is what I assume the link time portion means). Now, I am assuming that's what they mean by "not being link-time compatible" means. You can verify by using a tools to look for the CString symbols in either library (in linux you'd use the "nm" utility, there must be a Windows equivalent but not sure of the name).

      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