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. Wierd warning

Wierd warning

Scheduled Pinned Locked Moved C / C++ / MFC
question
5 Posts 5 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.
  • B Offline
    B Offline
    BeakX
    wrote on last edited by
    #1

    i recieved this warning : warning C4133: 'function' : incompatible types - from 'char [5]' to 'const unsigned short *' for the first line of the code below hCOM1 = CreateFile("COM1", GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); I copied the code below from an older program, but i did not get that warning when i tried to compile it. Is there something i am doing wrong ?

    Steve EcholsS S S D 4 Replies Last reply
    0
    • B BeakX

      i recieved this warning : warning C4133: 'function' : incompatible types - from 'char [5]' to 'const unsigned short *' for the first line of the code below hCOM1 = CreateFile("COM1", GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); I copied the code below from an older program, but i did not get that warning when i tried to compile it. Is there something i am doing wrong ?

      Steve EcholsS Offline
      Steve EcholsS Offline
      Steve Echols
      wrote on last edited by
      #2

      Definitely a problem with the "COM1" parameter. Possibly a Unicode problem? Don't have much experience with Unicode, sorry, but might try CreateFile(_T("COM1"), .... Someone else will know for sure... delete this; * poof! *

      • S
        50 cups of coffee and you know it's on!
        Code, follow, or get out of the way.
      1 Reply Last reply
      0
      • B BeakX

        i recieved this warning : warning C4133: 'function' : incompatible types - from 'char [5]' to 'const unsigned short *' for the first line of the code below hCOM1 = CreateFile("COM1", GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); I copied the code below from an older program, but i did not get that warning when i tried to compile it. Is there something i am doing wrong ?

        S Offline
        S Offline
        sunit5
        wrote on last edited by
        #3

        Otherwise remove the unicode option from settings never say die

        1 Reply Last reply
        0
        • B BeakX

          i recieved this warning : warning C4133: 'function' : incompatible types - from 'char [5]' to 'const unsigned short *' for the first line of the code below hCOM1 = CreateFile("COM1", GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); I copied the code below from an older program, but i did not get that warning when i tried to compile it. Is there something i am doing wrong ?

          S Offline
          S Offline
          Stephen Hewitt
          wrote on last edited by
          #4

          It's a Unicode issue. I'd wager the old project was ANSI but now it's Unicode. Try making the following change:

          hCOM1 = CreateFile(
               _T("COM1"),
               GENERIC_READ | GENERIC_WRITE,
               0,
               0,
               OPEN_EXISTING,
               FILE_ATTRIBUTE_NORMAL,
               0);
          

          Make sure you include <tchar.h> Steve

          1 Reply Last reply
          0
          • B BeakX

            i recieved this warning : warning C4133: 'function' : incompatible types - from 'char [5]' to 'const unsigned short *' for the first line of the code below hCOM1 = CreateFile("COM1", GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0); I copied the code below from an older program, but i did not get that warning when i tried to compile it. Is there something i am doing wrong ?

            D Offline
            D Offline
            David Crow
            wrote on last edited by
            #5

            While it has nothing to do with warning C4133, that first argument will need to be changed to "\\\\.\\COM1" in order to open a serial port.


            "Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain

            "There is no death, only a change of worlds." - Native American Proverb

            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