Thread: weird CString problem

  1. #1
    Registered User
    Join Date
    Dec 2004
    Posts
    205

    weird CString problem

    Hi,
    I have just encountered a problem that is confusing. I have used Cstring before in mfc applications and it has never given me any issue but in a new project I am getting this error:

    error C2440: 'initializing' : cannot convert from 'const char [10]' to 'ATL::CStringT<BaseType,StringTraits>'

    Code:
    CString address = "127.0.0.1";
    I have used this in another program and the compiler does not give me any issue:
    Code:
    CString error = "Value entered is invalid. Please choose a number between 1 and ";
    It's weird. Thanks for any answer
    Amish

  2. #2
    Registered User
    Join Date
    Dec 2004
    Posts
    205
    The problem was that when creating the program in ms vs 2005, the unicode libraries were used instead of regular ones . In that case Cstring would become CstringA.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Weird Problem With Pointer
    By DarkDot in forum C++ Programming
    Replies: 3
    Last Post: 05-07-2007, 07:50 PM
  2. CString problem
    By vijlak in forum C++ Programming
    Replies: 4
    Last Post: 10-28-2006, 08:54 AM
  3. Replies: 6
    Last Post: 05-12-2005, 03:39 AM
  4. Weird problem
    By khpuce in forum Tech Board
    Replies: 0
    Last Post: 04-29-2004, 08:29 AM
  5. Weird class problem!
    By aker_y3k in forum C++ Programming
    Replies: 2
    Last Post: 09-25-2002, 06:12 AM