locked
staticlibrary.vcxproj

    Question

  • Hello,I get this output after building my project in visual studio 11 but when i try compiling the project it gives me an error "unable to start program 'C:\William\Thesis Dupicate_MVS\W.Banahene\DFHBF_v4_March2012_Younis\MFCstaticlibraryGeoidQGeoid\Release\EGMmodel.lib'".Can anyone help me out please.

    1>------ Rebuild All started: Project: staticlibrary, Configuration: Release Win32 ------
    1>  StdAfx.cpp
    1>  egmcalculate.cpp
    1>  staticlibrary.vcxproj -> C:\William\Thesis Dupicate_MVS\W.Banahene\DFHBF_v4_March2012_Younis\MFCstaticlibraryGeoidQGeoid\Release\EGMmodel.lib
    ========== Rebuild All: 1 succeeded, 0 failed, 0 skipped ==========

    

    Friday, June 15, 2012 8:01 AM

Answers

  • You can't debug a static lib, it doesn't generate an exe. You'll have to link the static lib file with some other project that produces an exe, such as the Blank App project. Then you'll be able to start the exe and debug into the static lib code.

    The static library is just a bundle of object code (.obj files). Only an executable can be started under a debugger.

    Wednesday, June 20, 2012 12:55 AM
    Moderator

All replies

  • Can you list the exact steps you take to generate the error? Compiling should not generate an error of that type.

    Thanks!


    David Lamb

    Friday, June 15, 2012 5:25 PM
    Moderator
  • I checked the old build of VS Beta on the Windows 8 Consumer Preview and I think that is what you were using to generate the above message. If you tried to start debugging this type of project you receive that message which wasn't too explanatory. The latest build of VS RC release on Windows 8 Release Preview gives you a much better explanation of why you can't attempt launching a static library project on it's own.

    Let me know if this isn't what you were doing.

    Thanks!


    David Lamb

    Friday, June 15, 2012 6:19 PM
    Moderator
  • Thanks David. I first build the project in Visual studio 11  beta edition running on windows 7 ultimate then i debug->Start Debugging and i get the ouput below.


    Saturday, June 16, 2012 5:50 AM
  • You can't debug a static lib, it doesn't generate an exe. You'll have to link the static lib file with some other project that produces an exe, such as the Blank App project. Then you'll be able to start the exe and debug into the static lib code.

    The static library is just a bundle of object code (.obj files). Only an executable can be started under a debugger.

    Wednesday, June 20, 2012 12:55 AM
    Moderator
  • Thanks a lot steve .Yeah I checked the release folder and noticed the .obj files.Yes I have a project which I have to link to the static library to generate an exe.Thanks again for your reply am very grateful.

    wob

    Wednesday, June 20, 2012 1:30 PM