VC++ Express Edition and .dsp/.dsw files

This is a discussion on VC++ Express Edition and .dsp/.dsw files within the Tech Board forums, part of the Community Boards category; I came across some code recently and would like to compile it. There's a .cpp file, along with a .dsp ...

  1. #1
    Registered User
    Join Date
    Jun 2006
    Posts
    23

    VC++ Express Edition and .dsp/.dsw files

    I came across some code recently and would like to compile it. There's a .cpp file, along with a .dsp and .dsw file and they all have the same name. I use Visual C++ 2005 Express Edition and loaded them all into the same project. A number of errors were generated. I've also tried to compile the code with Dev-C++ but it also generates a load of errors.

    Can I compile this with the software that I have or do I need a different compiler? I looked into the .dsw and .dsp files and I saw "Microsoft Developer Studio Project" - must I use this for compilation?

  2. #2
    erstwhile
    Join Date
    Jan 2002
    Posts
    2,227
    Compiler configuration question; Moved to Tech.

    It should be possible to do what you've done but in practice it's not that straightforward. It's probably best just to create a new project with msvc-express, add the source and configure the project settings to match the critical ones for the sample project you're trying to build.

    This thread contains useful information which should be of some use.

    edit: The 'dsw' and 'dsp' are project files used by earlier versions of msvc.
    CProgramming FAQ
    Caution: this person may be a carrier of the misinformation virus.

  3. #3
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,452
    > A number of errors were generated.
    Well that's USEFUL
    What errors?
    Compiler errors?
    Linker errors?
    IDE errors?
    Runtime errors?
    PEBKAC errors?
    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.

  4. #4
    Registered User
    Join Date
    Jun 2006
    Posts
    23
    Salem - these are the errors generated when I tried to compile the code:

    ------ Build started: Project: ProjectName, Configuration: Debug Win32 ------
    Compiling...
    Listing.cpp
    c:\documents and settings\XXXXXX\desktop\Listing.cpp(55) : error C2664: 'RegOpenKeyExW' : cannot convert parameter 2 from 'const char [45]' to 'LPCWSTR'
    Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
    c:\documents and settings\XXXXXX\desktop\Listing.cpp(57) : error C2664: 'RegQueryValueExW' : cannot convert parameter 2 from 'const char [17]' to 'LPCWSTR'
    Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
    c:\documents and settings\XXXXXX\desktop\Listing.cpp(62) : error C2065: 'i' : undeclared identifier
    c:\documents and settings\XXXXXX\desktop\Listing.cpp(76) : error C2664: 'lstrcatW' : cannot convert parameter 1 from 'char *' to 'LPWSTR'
    Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
    c:\documents and settings\XXXXXX\desktop\Listing.cpp(77) : error C2664: 'wsprintfW' : cannot convert parameter 1 from 'char *' to 'LPWSTR'
    Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
    c:\documents and settings\XXXXXX\desktop\Listing.cpp(78) : error C2664: 'lstrcatW' : cannot convert parameter 1 from 'char *' to 'LPWSTR'
    Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
    Build log was saved at "file://c:\RestOfFilePathAndName"
    Listing - 6 error(s), 0 warning(s)
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

    I don't know if this helps. I'll check out the thread that Ken has provided.

  5. #5
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,452
    > c:\documents and settings\XXXXXX\desktop\Listing.cpp(55) : error C2664: 'RegOpenKeyExW' :
    > cannot convert parameter 2 from 'const char [45]' to 'LPCWSTR'
    I think the new compilers default to UNICODE enabled, which means everything expects wide strings.
    #undef UNICODE
    right at the start of the code may work, though there's probably better ways of doing it.

    To make the problem go away for sure, make use of the TEXT() macro which changes in response to the UNICODE setting, and use TCHAR (check spelling) as the type for all your strings.

    > error C2065: 'i' : undeclared identifier
    Check your for loops.
    In old C++, this was valid
    Code:
    for ( int i = 0 ; i < 10 ; i++ ) {
    }
    // in new C++, i is no longer in scope
    for ( i = 0 ; i < 10 ; i++ ) {
    }
    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.

  6. #6
    Registered User
    Join Date
    Jun 2006
    Posts
    23
    Thank you Salem. I'll make the modification that you have suggested and will look into the other areas that you have mentioned.

Popular pages Recent additions subscribe to a feed

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