Upgrading to 2005

This is a discussion on Upgrading to 2005 within the C++ Programming forums, part of the General Programming Boards category; Hello, it's me again! A few days I upgraded from Visual C++ 6.0 to Visual 2005 or 8.0, and did ...

  1. #1
    Registered User
    Join Date
    May 2005
    Location
    Texas
    Posts
    103

    Upgrading to 2005

    Hello, it's me again! A few days I upgraded from Visual C++ 6.0 to Visual 2005 or 8.0, and did some tests, and came with the an error with a code that my old compiler would normally compile with without any errors, I made it simplistic so it only focuses on the problem:
    Code:
    #include <iostream>
    #include <windows.h>
    
    using namespace std;
    
    int main()
    {
    	SetConsoleTitle("This is the Title!");
    	system("PAUSE");
    	return 0;
    }
    and these are the errors that come up:
    Code:
    ------ Build started: Project: Title, Configuration: Debug Win32 ------
    Compiling...
    Code.cpp
    c:\documents and settings\george\desktop\c++\title\title\code.cpp(8) : error C2664: 'SetConsoleTitleW' : cannot convert parameter 1 from 'const char [19]' to 'LPCWSTR'
            Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
    Build log was saved at "file://c:\Documents and Settings\George\Desktop\C++\Title\Title\Debug\BuildLog.htm"
    Title - 1 error(s), 0 warning(s)
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
    Please help, and thanks in advance!

    Can anyone help me? Why is it doing this, as it became even more strict?
    Be easy on me...only 14

  2. #2
    carry on JaWiB's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    1,972
    Sounds like you're compiling with unicode enabled. This should work:
    Code:
    #include <iostream>
    #include <windows.h>
    
    using namespace std;
    
    int main()
    {
    	SetConsoleTitle(TEXT("This is the Title!"));
    	system("PAUSE");
    	return 0;
    }
    Alternatively, you could disable unicode
    "Think not but that I know these things; or think
    I know them not: not therefore am I short
    Of knowing what I ought."
    -John Milton, Paradise Regained (1671)

    "Work hard and it might happen."
    -XSquared

  3. #3
    Registered User
    Join Date
    May 2005
    Location
    Texas
    Posts
    103
    Thanks, yet what is a unicode anyway, how can you disable it?
    Be easy on me...only 14

  4. #4
    carry on JaWiB's Avatar
    Join Date
    Feb 2003
    Location
    Seattle, WA
    Posts
    1,972
    A couple links:
    http://msdn.microsoft.com/library/de...icode_9i79.asp
    http://cprogramming.com/tutorial/unicode.html

    As for disabling it, I'm not entirely sure for 2005, but I might guess UNICODE appears under preprocessor definitions in your project options, in which case you could just remove it. Or you could put #undef UNICODE before any includes
    "Think not but that I know these things; or think
    I know them not: not therefore am I short
    Of knowing what I ought."
    -John Milton, Paradise Regained (1671)

    "Work hard and it might happen."
    -XSquared

  5. #5
    Registered User
    Join Date
    May 2005
    Location
    Texas
    Posts
    103
    oh. Thankyou!
    Be easy on me...only 14

  6. #6
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,484
    > yet what is a unicode anyway, how can you disable it?
    Or get used to it - it isn't going to go away, and more and more stuff will use it in preference to ASCII (or whatever).
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. SQL Server 2005 using C
    By dunxton in forum C Programming
    Replies: 0
    Last Post: 02-22-2009, 09:57 PM
  2. If you must port to .NET 2005, read this thread.
    By VirtualAce in forum A Brief History of Cprogramming.com
    Replies: 3
    Last Post: 10-22-2007, 06:51 AM
  3. Warning to all those wishing to port to .NET 2005
    By VirtualAce in forum A Brief History of Cprogramming.com
    Replies: 6
    Last Post: 05-07-2006, 09:29 PM
  4. Using Visual C++ 2005 w/o touching C++/CLI
    By VirtualAce in forum Windows Programming
    Replies: 1
    Last Post: 05-07-2006, 06:19 PM
  5. Really basic string operation
    By bobthebullet990 in forum C Programming
    Replies: 6
    Last Post: 11-28-2005, 04:18 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21