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. Linking Error / outportb [modified]

Linking Error / outportb [modified]

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
3 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.
  • C Offline
    C Offline
    cahit23
    wrote on last edited by
    #1

    Hello everyone, Thank you for your suggestions in my previous message.It's working.As next step, i want to send my uint8 values here to serial port.For that i added two lines into my code (bold) but i receive this error, [Linker Error] Unresolved external '_outportb' referenced from H:\INTERFACE\INTERFACE.OBJ (Interface is the name of my file in which i saved my code and files) I didnt get the cause of problem,what's wrong?. If anyone has an idea, would be pleased! #include #include #include #include // system() int transmit (double x); int i; system(); outportb(int port, unsigned int); int transmit (double x) { union ifas { double d; unsigned char u8value[8]; }; union ifas member; member.d = x; printf("\nmember.d=%d\n",member.d); for ( i=0 ; i<8 ; i++) { printf("\nmember.u8value[%d]=%f\n",i,member.u8value[i]); outportb(port,member.u8value[i]); } return 0; } int main(int argc, char* argv[]) //Console { double var; scanf("%lf",&var); transmit(var); system("pause"); return 0; } Regards, Cahit -- modified at 11:37 Thursday 17th August, 2006

    S K 2 Replies Last reply
    0
    • C cahit23

      Hello everyone, Thank you for your suggestions in my previous message.It's working.As next step, i want to send my uint8 values here to serial port.For that i added two lines into my code (bold) but i receive this error, [Linker Error] Unresolved external '_outportb' referenced from H:\INTERFACE\INTERFACE.OBJ (Interface is the name of my file in which i saved my code and files) I didnt get the cause of problem,what's wrong?. If anyone has an idea, would be pleased! #include #include #include #include // system() int transmit (double x); int i; system(); outportb(int port, unsigned int); int transmit (double x) { union ifas { double d; unsigned char u8value[8]; }; union ifas member; member.d = x; printf("\nmember.d=%d\n",member.d); for ( i=0 ; i<8 ; i++) { printf("\nmember.u8value[%d]=%f\n",i,member.u8value[i]); outportb(port,member.u8value[i]); } return 0; } int main(int argc, char* argv[]) //Console { double var; scanf("%lf",&var); transmit(var); system("pause"); return 0; } Regards, Cahit -- modified at 11:37 Thursday 17th August, 2006

      S Offline
      S Offline
      Steen Krogsgaard
      wrote on last edited by
      #2

      %d format specifier is signed decimal integer. For your double, use %f. For your unsigned ints, use %u -- modified at 8:35 Thursday 17th August, 2006 Well, actually, since you have chars in your union you should use %c instead of %u.

      Cheers Steen. "Are you gonna check your makeup when you're done whining?" John Simmons, 05/31/2006

      1 Reply Last reply
      0
      • C cahit23

        Hello everyone, Thank you for your suggestions in my previous message.It's working.As next step, i want to send my uint8 values here to serial port.For that i added two lines into my code (bold) but i receive this error, [Linker Error] Unresolved external '_outportb' referenced from H:\INTERFACE\INTERFACE.OBJ (Interface is the name of my file in which i saved my code and files) I didnt get the cause of problem,what's wrong?. If anyone has an idea, would be pleased! #include #include #include #include // system() int transmit (double x); int i; system(); outportb(int port, unsigned int); int transmit (double x) { union ifas { double d; unsigned char u8value[8]; }; union ifas member; member.d = x; printf("\nmember.d=%d\n",member.d); for ( i=0 ; i<8 ; i++) { printf("\nmember.u8value[%d]=%f\n",i,member.u8value[i]); outportb(port,member.u8value[i]); } return 0; } int main(int argc, char* argv[]) //Console { double var; scanf("%lf",&var); transmit(var); system("pause"); return 0; } Regards, Cahit -- modified at 11:37 Thursday 17th August, 2006

        K Offline
        K Offline
        kakan
        wrote on last edited by
        #3

        cahit23 wrote:

        union ifas { double d; char u8value[8]; //?????????????? };

        Use unsigned char for u8value

        Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson

        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