VC++ a POS

This is a discussion on VC++ a POS within the Windows Programming forums, part of the Platform Specific Boards category; So I downloaded MS VC++ 2005 express today and tried to compile my code that I wrote in bloodshed dev ...

  1. #1
    Registered User Welder's Avatar
    Join Date
    Oct 2007
    Location
    Washington
    Posts
    100

    VC++ a POS

    So I downloaded MS VC++ 2005 express today and tried to compile my code that I wrote in bloodshed dev C++ and spent hours fixing error after error after error, downloading new files like psdk and others, fixing more errors, sifting through a bunch of bull.........., fixing more errors (errors that shouldn't even be errors in the first place!).

    And finally, I gave up.

    What the hell is up with MS VC++? Why doesn't it compile code that compiles seamlessly on other compilers?

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    What are those problems?

    There is a #define that you can use to force the compiler to not say "This function is unsafe, please use X instead".

    In general, I find that VC++ compiles most code straight away.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Registered User Welder's Avatar
    Join Date
    Oct 2007
    Location
    Washington
    Posts
    100
    I just get so many errors I don't know where to begin.

    Even simple stuff like syntax errors on defining a class.

  4. #4
    Registered User Welder's Avatar
    Join Date
    Oct 2007
    Location
    Washington
    Posts
    100
    I used "namespace std" to get my file errors fixed on some code I d/l from the net. But once it started linking I got these errors:

    ------ Build started: Project: gifview, Configuration: Debug Win32 ------
    Compiling...
    winimage.cpp
    c:\documents and settings\damon\desktop\gifview\winimage.cpp(772) : warning C4244: '=' : conversion from 'long' to 'short', possible loss of data
    Compiling manifest to resources...
    Linking...
    gifview.obj : error LNK2019: unresolved external symbol __imp__DispatchMessageA@4 referenced in function _WinMain@16
    gifview.obj : error LNK2019: unresolved external symbol __imp__TranslateMessage@4 referenced in function _WinMain@16
    gifview.obj : error LNK2019: unresolved external symbol __imp__GetMessageA@16 referenced in function _WinMain@16
    gifview.obj : error LNK2019: unresolved external symbol __imp__UpdateWindow@4 referenced in function _WinMain@16
    gifview.obj : error LNK2019: unresolved external symbol __imp__ShowWindow@8 referenced in function _WinMain@16
    winimage.obj : error LNK2001: unresolved external symbol __imp__ShowWindow@8
    gifview.obj : error LNK2019: unresolved external symbol __imp__CreateWindowExA@48 referenced in function _WinMain@16
    winimage.obj : error LNK2001: unresolved external symbol __imp__CreateWindowExA@48
    gifview.obj : error LNK2019: unresolved external symbol __imp__RegisterClassExA@4 referenced in function _WinMain@16
    gifview.obj : error LNK2019: unresolved external symbol __imp__LoadCursorA@8 referenced in function _WinMain@16
    winimage.obj : error LNK2001: unresolved external symbol __imp__LoadCursorA@8
    gifview.obj : error LNK2019: unresolved external symbol __imp__LoadIconA@8 referenced in function _WinMain@16
    gifview.obj : error LNK2019: unresolved external symbol __imp__DefWindowProcA@16 referenced in function "long __stdcall WndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WndProc@@YGJPAUHWND__@@IIJ@Z)
    winimage.obj : error LNK2001: unresolved external symbol __imp__DefWindowProcA@16
    gifview.obj : error LNK2019: unresolved external symbol __imp__PostQuitMessage@4 referenced in function "long __stdcall WndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WndProc@@YGJPAUHWND__@@IIJ@Z)
    gifview.obj : error LNK2019: unresolved external symbol __imp__EndPaint@8 referenced in function "long __stdcall WndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WndProc@@YGJPAUHWND__@@IIJ@Z)
    winimage.obj : error LNK2001: unresolved external symbol __imp__EndPaint@8
    gifview.obj : error LNK2019: unresolved external symbol __imp__BeginPaint@8 referenced in function "long __stdcall WndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WndProc@@YGJPAUHWND__@@IIJ@Z)
    winimage.obj : error LNK2001: unresolved external symbol __imp__BeginPaint@8
    winimage.obj : error LNK2019: unresolved external symbol __imp__SetDIBitsToDevice@48 referenced in function "public: int __thiscall C_Image::GDIPaint(struct HDC__ *,int,int)" (?GDIPaint@C_Image@@QAEHPAUHDC__@@HH@Z)
    winimage.obj : error LNK2019: unresolved external symbol __imp__GetWindowLongA@8 referenced in function "public: static long __stdcall C_AnimationWindow::WndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WndProc@C_AnimationWindow@@SGJPAUHWND__@@IIJ@Z)
    winimage.obj : error LNK2019: unresolved external symbol __imp__SetWindowLongA@12 referenced in function "public: static long __stdcall C_AnimationWindow::WndProc(struct HWND__ *,unsigned int,unsigned int,long)" (?WndProc@C_AnimationWindow@@SGJPAUHWND__@@IIJ@Z)
    winimage.obj : error LNK2019: unresolved external symbol __imp__InvalidateRect@12 referenced in function "public: static unsigned long __stdcall C_AnimationWindow::fnThread(void *)" (?fnThread@C_AnimationWindow@@SGKPAX@Z)
    winimage.obj : error LNK2019: unresolved external symbol __imp__RegisterClassA@4 referenced in function "public: struct HWND__ * __thiscall C_AnimationWindow::Create(struct HWND__ *,struct HMENU__ *,class C_ImageSet *,unsigned long,char *)" (?Create@C_AnimationWindow@@QAEPAUHWND__@@PAU2@PAU HMENU__@@PAVC_ImageSet@@KPAD@Z)
    winimage.obj : error LNK2019: unresolved external symbol __imp__GetClassInfoA@12 referenced in function "public: struct HWND__ * __thiscall C_AnimationWindow::Create(struct HWND__ *,struct HMENU__ *,class C_ImageSet *,unsigned long,char *)" (?Create@C_AnimationWindow@@QAEPAUHWND__@@PAU2@PAU HMENU__@@PAVC_ImageSet@@KPAD@Z)
    winimage.obj : error LNK2019: unresolved external symbol __imp__MoveWindow@24 referenced in function "public: int __thiscall C_AnimationWindow:isplay(int,int)" (?Display@C_AnimationWindow@@QAEHHH@Z)
    .\Debug/gifview.exe : fatal error LNK1120: 20 unresolved externals
    Build log was saved at "file://c:\Documents and Settings\Damon\Desktop\gifview\Debug\BuildLog.htm"
    gifview - 27 error(s), 1 warning(s)
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

  5. #5
    Registered User Welder's Avatar
    Join Date
    Oct 2007
    Location
    Washington
    Posts
    100
    Ok, I fixed that part by adding some libraries to the project linker settings.

    But my other projects still don't compile.

    LPSTR isn't known for one.

  6. #6
    Registered User Welder's Avatar
    Join Date
    Oct 2007
    Location
    Washington
    Posts
    100
    MAX_PATH isn't found either nor is #include <afxres.h>

    And it isn't finding functions in my code when linking.... If I add the functions to the same file they are called from it works but I really don't want to group 20,000 lines of code in one source file....

    Animator.obj : error LNK2019: unresolved external symbol "struct framelist * __cdecl AppendNode(struct framelist * *,int,int,int,int,char *,char *)" (?AppendNode@@YAPAUframelist@@PAPAU1@HHHHPAD1@Z) referenced in function "int __stdcall DlgProc2(struct HWND__ *,unsigned int,unsigned int,long)" (?DlgProc2@@YGHPAUHWND__@@IIJ@Z)



    Annnnnd....


    Animator.obj : error LNK2019: unresolved external symbol __imp__SHGetMalloc@4 referenced in function "int __stdcall DlgProc2(struct HWND__ *,unsigned int,unsigned int,long)" (?DlgProc2@@YGHPAUHWND__@@IIJ@Z)

    When when I looked up SHGetMalloc, I found it needed Ceshell.lib. When I add Ceshell.lib it says Ceshell.lib cannot be found.


    I am hating microsoft more and more. The stupid commercial software written by one of the biggest corporations on the planet can't figure out what .lib files to add on it's own but all the freeware programs can?
    Last edited by Welder; 11-06-2007 at 11:39 AM.

  7. #7
    Registered User
    Join Date
    Mar 2007
    Posts
    416
    I typically dont like the express version, i tried it and it had problems with compiling resource files that compiled fine in codeblocks and devcpp. The school I'm at has the full version, and it works just as good as codeblocks/devcpp without anything too annoying, but I found the express version very... cheap.

  8. #8
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    nor is #include <afxres.h>
    MFC is not supplied with the Express version. If the file was generated by a resource editor and you don't actually use MFC, change the include to windows.h.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  9. #9
    Registered User Welder's Avatar
    Join Date
    Oct 2007
    Location
    Washington
    Posts
    100
    Does anybody else have problems with Express?

  10. #10
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,189
    VC++ is a commercial quality tool. As such it may require more explicit use of some features. Its not that VC++ is a POS, its that your code was sloppy and that your previous compiler didnt complain as much. VC++ also doesnt auto-recast pointers, which causes most of the problems when porting code that was written in C++ using 'C' style. Of course without actual code, I cant say for sure exactly what the problem is, but I dont find any problems porting my code between VC++ and Bloddshed, so its obviously a coding style issue.

    If you can give specific exeamples of code and what error they raise, perhaps we coudl help you understand how to fix the problem.


    Ops sorry fro the late post, I started it before going to lunch and just hit submit when I got back. Seems the OP had a link time issue with MFC, see my tag below.

    Quote Originally Posted by Welder View Post
    Does anybody else have problems with Express?
    I wasnt really fond of express. It didnt include a Win32 application template when I first got it, so I bougth a copy of VS 6.0 enterprise. I have a copy of 2005 at work, and Im beginnig to like some of its features. Its definately a long term goal to switch to 2005, but we have too much code in 6.0 that needs to be maintained to comletely stop using it. If you want ot write commercial applications, you will need to make the jump to 64 bit in the next 5-10 years, so you will have to learn either 2005 or use GCC.
    Last edited by abachler; 11-06-2007 at 01:36 PM.
    Until you can build a working general purpose reprogrammable computer out of basic components from radio shack, you are not fit to call yourself a programmer in my presence. This is cwhizard, signing off.

  11. #11
    Registered User Welder's Avatar
    Join Date
    Oct 2007
    Location
    Washington
    Posts
    100
    abachler, is this your definition of a Commercial Quality Tool?

    error C2061: syntax error : identifier 'bool'

    I have used commercial quality development tools for years. I have owned almost every version of CodeWarrior ever made.

    And that MFC error was one of the hundreds of thousands that I have run into today compiling every last project I can find on the internet made for VC++.

  12. #12
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,189
    The problem isnt with VC++, its with the user not including the appropriate libraries. Take any application and not include a required library and it will give you those errors.

    I dont seem to have any problems using bool or BOOL. Perhaps you need to post the relevant code rather than just ranting that it gave you such and such an error.

    Compiler Error C2061
    syntax error : identifier 'identifier'

    The compiler found identifier where it was not expected. This error can be caused by enclosing an initializer in parentheses. The error can be avoided by enclosing the declarator in parentheses or making it a typedef. The following example causes this error and shows two fixes:

    class X {};
    class Y {};
    class Z {};
    class W : public X, public Y, public Z {};

    void func ( W* pW )
    {
    X* pX ( pW ); // Error: unexpected identifier 'pW'

    Y ( *pY ) ( pW ); // OK, declarator in parentheses

    typedef Z *pZ_t;
    pZ_t pZ ( pW ); // OK, typedef used for Z
    }
    Last edited by abachler; 11-06-2007 at 01:41 PM.
    Until you can build a working general purpose reprogrammable computer out of basic components from radio shack, you are not fit to call yourself a programmer in my presence. This is cwhizard, signing off.

  13. #13
    Registered User Welder's Avatar
    Join Date
    Oct 2007
    Location
    Washington
    Posts
    100
    There are so many errors and so much code I don't even know where to start or else I would. I added every library needed.


    Look a this error. When I try to add any other libraries that popen and pclose require it starts giving even more errors of multiple definitions in the libraries.

    xform.obj : error LNK2019: unresolved external symbol _pclose referenced in function _pipe_color_transformer
    xform.obj : error LNK2019: unresolved external symbol _popen referenced in function _pipe_color_transformer

    wtf?

    There is issue after issue after issue and it doesn't stop. I can't even call up a function from another source file without the linker blowing up in my face and throwing errors at me left and right!
    Last edited by Welder; 11-06-2007 at 01:45 PM.

  14. #14
    Malum in se abachler's Avatar
    Join Date
    Apr 2007
    Posts
    3,189
    link errors are always caused by failure to include the appropriate library. In this case you arent linking against LIBC.LIB or LIBCMT.LIB

    Yo could also have a problem with the function name itself, since MS uses _popen() not popen() or some such non-sense.

    The easy fix is to just add the line -
    Code:
    #define popen _popen
    and hope it doesnt object
    Last edited by abachler; 11-06-2007 at 01:47 PM.
    Until you can build a working general purpose reprogrammable computer out of basic components from radio shack, you are not fit to call yourself a programmer in my presence. This is cwhizard, signing off.

  15. #15
    Registered User Welder's Avatar
    Join Date
    Oct 2007
    Location
    Washington
    Posts
    100
    Quote Originally Posted by abachler View Post
    link errors are always caused by failure to include the appropriate library. In this case you arent linking against LIBC.LIB or LIBCMT.LIB

    Yo could also have a problem with the function name itself, since MS uses _popen() not popen() or some such non-sense.

    The easy fix is to just add the line -
    Code:
    #define popen _popen
    and hope it doesnt object
    That line is already added.

    I have these libraries included
    kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib

    Also, I am getting link errors from my internal functions that are not supposed to be external libraries. I have the appropriate header files included, and functions defined. It compiles in other compilers just fine.

Page 1 of 3 123 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. file i/o dilemma
    By adramalech in forum C Programming
    Replies: 27
    Last Post: 11-11-2008, 12:30 AM
  2. seperate and add pos and neg numbers
    By Chris630 in forum C++ Programming
    Replies: 2
    Last Post: 03-27-2007, 07:14 PM
  3. makefile exported by vc 6.0 doesn't work
    By wow in forum Windows Programming
    Replies: 7
    Last Post: 03-24-2006, 04:20 PM
  4. Debug help needed
    By Achy in forum C Programming
    Replies: 3
    Last Post: 11-16-2005, 03:27 PM
  5. determine if input pos or neg ?
    By bluenoser in forum C Programming
    Replies: 2
    Last Post: 10-20-2002, 09:49 PM

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