CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    Join Date
    Jul 2008
    Posts
    63

    Thumbs up Fatal error C1047

    Hi
    i am creating an application in MFC using VS 2008 using third party SDK. i am compling this
    application in Debug mode it work fine. But when i am compiling this application in release mode
    i get this linking error.

    fatal error C1047: The object or library file '../lib/SIPEvent.lib' was created with an older compiler than other objects; rebuild old objects and libraries
    thanks.

  2. #2
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    Re: Fatal error C1047

    It means the release version of that SIPEvent.lib was not built with VS 2008. In order for your app to work properly, you need to get a new build for it, with VS 2008.
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

  3. #3
    Join Date
    Jul 2008
    Posts
    63

    Re: Fatal error C1047

    Quote Originally Posted by cilu View Post
    It means the release version of that SIPEvent.lib was not built with VS 2008. In order for your app to work properly, you need to get a new build for it, with VS 2008.
    Thanks.
    Actually i have Lib file and Dlls but not source code. so how i can get a new build in VS2008.
    because i am new one in this.

  4. #4
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    Re: Fatal error C1047

    Since you don't have the source code, you cannot build it of course.
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

  5. #5
    Join Date
    Jul 2008
    Posts
    63

    Smile Re: Fatal error C1047

    Quote Originally Posted by cilu View Post
    Since you don't have the source code, you cannot build it of course.
    Thanks Cilu

  6. #6
    Join Date
    Sep 2009
    Posts
    6

    Re: Fatal error C1047

    Hi Cilu,

    I have the same issue where I got an SDK lib (no DLL) from MSVC 2005 Professional,
    and I have to link this lib statically with my code to create a ABC.DLL
    under MSVC 2008 Professional.

    ...and one website suggested that
    to change settings on:
    C/C++ > Optimization > "Whole Program Optimization" from "/GL" to "No".

    Then, it compiled and built properly.

    Then, I have an ABCTest.exe program that links with this ABC.DLL.
    It first asked for msvcr90.dll, and msvc*90.dll.
    I provided all of those, and it ended up a runtime error.

    Any idea ?

    Best,
    Oscar

  7. #7
    Join Date
    Sep 2009
    Posts
    6

    Re: Fatal error C1047

    A few more info:
    After changing from "\GL" to "No", the MSVC 2008 gives a whole bunch of:
    "warning LNK4099: PDB 'vc80.pdb' was not found"

    Also, when running ABCTest.exe, it gives:
    "MSVC++ Runtime Library" error as follow...
    "Program: ABCTest.exe

    R6034
    An applicaiton has made an attempt to load C runtime library incorrectly.
    Please contact the application's support team for more information."

    Thanks,
    Oscar

  8. #8
    Join Date
    Mar 2003
    Location
    India {Mumbai};
    Posts
    3,871

    Re: Fatal error C1047

    Quote Originally Posted by Warning C1047
    C1047 is caused when object files or libraries built with /LTCG are linked together, but where those object files or libraries are built with different versions of the Visual C++ toolset.
    Try removing /LTGC.
    My latest article: Explicating the new C++ standard (C++0x)

    Do rate the posts you find useful.

  9. #9
    Join Date
    Sep 2009
    Posts
    6

    Re: Fatal error C1047

    Removing \LTCG in MSVC 2005 SDK.lib build ?
    I don't have the source code for it.

    -Oscar

  10. #10
    Join Date
    Mar 2003
    Location
    India {Mumbai};
    Posts
    3,871

    Re: Fatal error C1047

    You do not need to same version .LIB to use in your application.
    Assume for example, you have DLL and LIB file which was built using VC8 (or say VC6). You still can use it in VC8, VC9, CV10.

    You have also mentioned that you can successfully build in Debug, but not in Release. That means, there must be problem with compiler/linker optimization. In Project properties, try removing 'Link time code generation', and then rebuild.

    Also, you did not mention if .LIB is static library, or the DLL is with it.
    My latest article: Explicating the new C++ standard (C++0x)

    Do rate the posts you find useful.

  11. #11
    Join Date
    Sep 2009
    Posts
    6

    Re: Fatal error C1047

    Hello,

    My case is a little bit different from the first person who posted this.

    My SDK.lib (MSVC 2005) is a static lib, and there is NO SDK.dll come with it.

    Under MSVC 2008, I was able to build ABC.dll in both debug and release
    if I have:
    C/C++ > Optimization > "Whole Program Optimization" set to "No".


    Thanks,
    Oscar

  12. #12
    Join Date
    Mar 2003
    Location
    India {Mumbai};
    Posts
    3,871

    Re: Fatal error C1047

    C/C++ > Optimization > "Whole Program Optimization" set to "No".
    That does not remove /LTCG. In General look at the last option named 'Whole Program Optimization.
    My latest article: Explicating the new C++ standard (C++0x)

    Do rate the posts you find useful.

  13. #13
    Join Date
    Mar 2003
    Location
    India {Mumbai};
    Posts
    3,871

    Re: Fatal error C1047

    I am confused!
    • '../lib/SIPEvent.lib'
    • SDK.LIB, SDK.DLL
    • ABC.DL
    Please explain! which of these are Static libs?
    My latest article: Explicating the new C++ standard (C++0x)

    Do rate the posts you find useful.

  14. #14
    Join Date
    Sep 2009
    Posts
    6

    Re: Fatal error C1047

    Sorry, you just need to read from Sept 8th, and ignore all post before Sept 8th.

    1) ../lib/SIPEvent.lib is from someone else's post. (not mine !!!)

    2) SDK.LIB (SDK.DLL never exists)
    I don't have source code for this. Built from MSVC 2005.

    3) ABC.DLL that statically links with SDK.LIB
    (Built from MSVC 2008, and I have source code)

    4) ABCTest.exe that links with ABC.LIB and runs with ABC.DLL
    (Built from MSVC 2008, and I have source code)

  15. #15
    Join Date
    Mar 2003
    Location
    India {Mumbai};
    Posts
    3,871

    Re: Fatal error C1047

    I infer from your reply:
    • EXE links to ABC.LIB only, and no other libs.
    • ABC.DLL statically links with SDK.LIB
    • ../lib/SIPEvent.lib' - linked in ABC.DLL or the EXE? Or Both??
    Don't fiddle with VC runtime library settings. Restore them!

    • Is your DLL generated successfully?
    • Are all .LIBs Release Builds?
    • No service pack issues of VC8 with ABC.DLL and your EXE?
    • Did not fiddle with Manifest settings?
    My latest article: Explicating the new C++ standard (C++0x)

    Do rate the posts you find useful.

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured