Thread: compile once, compile twice ...error

  1. #1
    Registered User
    Join Date
    Nov 2003
    Posts
    161

    compile once, compile twice ...error

    I saved my projected and compiled it to test it out. I don't know what happened but my computer almost froze from an infinite loop. I press CTRL+ALT+DEL to end my program and my computer freeezes. I restart go back to my project and change the setscrollpos and getscrollpos to set/getscrollinfo. For the WM_VSCROLL message and fixed the infinite loop, all located in the windowproc. I compile to test. Error! I got errors dealing with strings and char pointers. all my errors are is "cannot convert char[number] to this" The errors are located when createing a window using WNDCLASSEX. It compiled with no errors before why do I get errors now? is this a bug in MSVC++ 6?

    Thanx in advance!

  2. #2
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    Post the relevant code and the specific error messages and we'll try to help.
    "...the results are undefined, and we all know what "undefined" means: it means it works during development, it works during testing, and it blows up in your most important customers' faces." --Scott Meyers

  3. #3
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    >> why do I get errors now?
    The source file being compiled most likely changed.

    >> is this a bug in MSVC++ 6?
    Nope.

    gg

  4. #4
    Registered User
    Join Date
    Nov 2003
    Posts
    161
    this is where I get one of the errors. All of the errors are related to this. If I can fix this then I will be able to fix the others.

    WNDCLASSEX wClass;
    wClass.lpszClassName = "CCodeCTRL0\0";

    and I get this error
    cannot convert from 'char *' to 'const unsigned short *'

  5. #5
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    You are using UNICODE Win32 APIs and structures - that means that most all your strings will need to be wide charater strings (wchat_t).
    You can tell the compiler to use wide characters for string literals by putting an L in front of the the openning quote.

    >> wClass.lpszClassName = L"CCodeCTRL0\0"; \\ "\0" not needed btw

    Or, you could not use UNICODE APIs and structures by not defining "_UNICODE" when you compile your application.

    gg

  6. #6
    Registered User
    Join Date
    Nov 2003
    Posts
    161
    Thanx very much, that fixed all my errors.

  7. #7
    Grammar Police HybridM's Avatar
    Join Date
    Jan 2003
    Posts
    355
    I always assume a bug lies with me and not the compiler. Mainly because it always does.
    Thor's self help tip:
    Maybe a neighbor is tossing leaf clippings on your lawn, looking at your woman, or harboring desires regarding your longboat. You enslave his children, set his house on fire. He shall not bother you again.

    OS: Windows XP
    Compiler: MSVC

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Beginner Needs help in Dev-C++
    By Korrupt Lawz in forum C++ Programming
    Replies: 20
    Last Post: 09-28-2010, 01:17 AM
  2. An error is driving me nuts!
    By ulillillia in forum C Programming
    Replies: 5
    Last Post: 04-04-2009, 09:15 PM
  3. DX - CreateDevice - D3DERR_INVALIDCALL
    By Tonto in forum Game Programming
    Replies: 3
    Last Post: 12-01-2006, 07:17 PM
  4. error: template with C linkage
    By michaels-r in forum C++ Programming
    Replies: 3
    Last Post: 05-17-2006, 08:11 AM
  5. Problem with Visual C++ Object-Oriented Programming Book.
    By GameGenie in forum C++ Programming
    Replies: 9
    Last Post: 08-29-2005, 11:21 PM