CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Hybrid View

  1. #1
    Join Date
    Jan 2010

    [RESOLVED] #pragma comment (compiler)


    The documentation says that
    #pragma comment (compiler)
    places the name and version number of the compiler in object file. Is there a way to retrieve this information programmatically from my own program?

  2. #2
    Join Date
    Feb 2003
    Iasi - Romania

    Re: #pragma comment (compiler)

    As stated in MSDN, #pragma comment(compiler) places the name and version number of the compiler in the object file (.obj). Further, this comment record is ignored by the linker.
    So, it cannot be found in the exe/dll file, then it's not possible to retrieve it at run-time.

    Alternatively, you can use _MSC_VER predefined macro to get the compiler version. For example, in the compiler from Visual C++ 6.0 _MSC_VER has a value of 1200, while in Visual C++ 2005, _MSC_VER is 1400.

    Fore more info see:
    "When in Rome, do as Romans do."
    My latest articles: http://codexpert.ro/blog/author/ovidiu-cucu/

  3. #3
    Join Date
    Jan 2010

    Re: #pragma comment (compiler)

    Thanks ovidiucucu (could not login for two days!). _MSC_VER is the way to go. Not really important but what's the point of this pragma compiler directive anyway...

Tags for this Thread

Posting Permissions

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

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.