Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How can I tell the compiler that should compile only VC6 ?

How can I tell the compiler that should compile only VC6 ?

Scheduled Pinned Locked Moved C / C++ / MFC
questionlinux
7 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • _ Offline
    _ Offline
    _Flaviu
    wrote on last edited by
    #1

    Hi . How can I tell the compiler that should compile only VC6 code ? I have the follow code :

    BOOL CMainFrame::ShowNotifyBaloon(PTSTR szBalloonTitle, PTSTR szBalloonMsg, DWORD dwIcon , UINT nTimeOut)
    {
    VERIFY((nTimeOut *= 1000) >= 10000);
    ASSERT (dwIcon == NIIF_WARNING || dwIcon == NIIF_ERROR || dwIcon == NIIF_INFO || dwIcon == NIIF_NONE);

    m\_NID.dwInfoFlags	= dwIcon;
    m\_NID.uFlags	   |= NIF\_INFO;
    m\_NID.uTimeout		= nTimeOut;
    ::strcpy(m\_NID.szInfoTitle,szBalloonTitle);
    ::strcpy(m\_NID.szInfo,szBalloonMsg);
    
    return ::Shell\_NotifyIcon(NIM\_MODIFY,&m\_NID);
    

    }

    that is not recognize in VC6 , but is in VC7 .... does exist some an compiler directive to compile only VC6 code and not VC7 code ?

    N 1 Reply Last reply
    0
    • _ _Flaviu

      Hi . How can I tell the compiler that should compile only VC6 code ? I have the follow code :

      BOOL CMainFrame::ShowNotifyBaloon(PTSTR szBalloonTitle, PTSTR szBalloonMsg, DWORD dwIcon , UINT nTimeOut)
      {
      VERIFY((nTimeOut *= 1000) >= 10000);
      ASSERT (dwIcon == NIIF_WARNING || dwIcon == NIIF_ERROR || dwIcon == NIIF_INFO || dwIcon == NIIF_NONE);

      m\_NID.dwInfoFlags	= dwIcon;
      m\_NID.uFlags	   |= NIF\_INFO;
      m\_NID.uTimeout		= nTimeOut;
      ::strcpy(m\_NID.szInfoTitle,szBalloonTitle);
      ::strcpy(m\_NID.szInfo,szBalloonMsg);
      
      return ::Shell\_NotifyIcon(NIM\_MODIFY,&m\_NID);
      

      }

      that is not recognize in VC6 , but is in VC7 .... does exist some an compiler directive to compile only VC6 code and not VC7 code ?

      N Offline
      N Offline
      Niklas L
      wrote on last edited by
      #2

      There are a number of things you can look for. Open your stdafx.h and check WINVER,_WIN32_WINNT,_WIN32_WINDOWS,_WIN32_IE,_MSC_VER They define SDK and compiler version. You can use these in #if directives in your code to make it conditional.

      home

      _ 1 Reply Last reply
      0
      • N Niklas L

        There are a number of things you can look for. Open your stdafx.h and check WINVER,_WIN32_WINNT,_WIN32_WINDOWS,_WIN32_IE,_MSC_VER They define SDK and compiler version. You can use these in #if directives in your code to make it conditional.

        home

        _ Offline
        _ Offline
        _Flaviu
        wrote on last edited by
        #3

        Here is my stdafx.h

        #if !defined(AFX_STDAFX_H__B5537D0B_2DD5_11E0_8FF9_0050BF29759A__INCLUDED_)
        #define AFX_STDAFX_H__B5537D0B_2DD5_11E0_8FF9_0050BF29759A__INCLUDED_

        #if _MSC_VER > 1000
        #pragma once
        #endif // _MSC_VER > 1000

        #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers

        #include // MFC core and standard components
        #include // MFC extensions
        #include // MFC Automation classes
        #include // MFC support for Internet Explorer 4 Common Controls
        #ifndef _AFX_NO_AFXCMN_SUPPORT
        #include // MFC support for Windows Common Controls
        #endif // _AFX_NO_AFXCMN_SUPPORT

        and it's about _MSC_VER ? And which version is it ?

        N O 2 Replies Last reply
        0
        • _ _Flaviu

          Here is my stdafx.h

          #if !defined(AFX_STDAFX_H__B5537D0B_2DD5_11E0_8FF9_0050BF29759A__INCLUDED_)
          #define AFX_STDAFX_H__B5537D0B_2DD5_11E0_8FF9_0050BF29759A__INCLUDED_

          #if _MSC_VER > 1000
          #pragma once
          #endif // _MSC_VER > 1000

          #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers

          #include // MFC core and standard components
          #include // MFC extensions
          #include // MFC Automation classes
          #include // MFC support for Internet Explorer 4 Common Controls
          #ifndef _AFX_NO_AFXCMN_SUPPORT
          #include // MFC support for Windows Common Controls
          #endif // _AFX_NO_AFXCMN_SUPPORT

          and it's about _MSC_VER ? And which version is it ?

          N Offline
          N Offline
          Niklas L
          wrote on last edited by
          #4

          According to MSDN, if you type cl /? at the command line, you will see the full version for the compiler you are using. Just make sure you know the difference between SDK version and compiler version before you proceed. You might be able to download a later SDK for your old compiler and make it work.

          home

          1 Reply Last reply
          0
          • _ _Flaviu

            Here is my stdafx.h

            #if !defined(AFX_STDAFX_H__B5537D0B_2DD5_11E0_8FF9_0050BF29759A__INCLUDED_)
            #define AFX_STDAFX_H__B5537D0B_2DD5_11E0_8FF9_0050BF29759A__INCLUDED_

            #if _MSC_VER > 1000
            #pragma once
            #endif // _MSC_VER > 1000

            #define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers

            #include // MFC core and standard components
            #include // MFC extensions
            #include // MFC Automation classes
            #include // MFC support for Internet Explorer 4 Common Controls
            #ifndef _AFX_NO_AFXCMN_SUPPORT
            #include // MFC support for Windows Common Controls
            #endif // _AFX_NO_AFXCMN_SUPPORT

            and it's about _MSC_VER ? And which version is it ?

            O Offline
            O Offline
            Ozer Karaagac
            wrote on last edited by
            #5

            It should be 1200 for VC6.

            _ 1 Reply Last reply
            0
            • O Ozer Karaagac

              It should be 1200 for VC6.

              _ Offline
              _ Offline
              _Flaviu
              wrote on last edited by
              #6

              Yes , it's 1200 , because if I write > 1200 won't compile VC7 code , but if I wrote >= 1200 compile VC7 code ,and , of course give error . Thanks !

              O 1 Reply Last reply
              0
              • _ _Flaviu

                Yes , it's 1200 , because if I write > 1200 won't compile VC7 code , but if I wrote >= 1200 compile VC7 code ,and , of course give error . Thanks !

                O Offline
                O Offline
                Ozer Karaagac
                wrote on last edited by
                #7

                I couldn't understand what you want to achieve exactly.

                Flaviu 2 wrote:

                How can I tell the compiler that should compile only VC6 code ?

                If you don't want to compile some codes in later releases than VC6. You can use this guard.

                #if _MSC_VER <= 1200
                ...
                #endif

                But, your problem seems to be related with SDK version rather than compiler version. If so, (that is, a new feature which is not exist older vers,) you should use other macros such as WINVER, _WIN32_WINNT, _WIN32_WINDOWS, _WIN32_IE or _MFC_VER depending on your feature. Or you can use newer SDK as indicated by Niklas. Or may be, you just need to define target platform or similar appropriately on top of stdafx.h.

                #define _WIN32_WINDOWS 0x0600

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups