Click here to Skip to main content
15,789,698 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

I need to write a data in the parallel port in the computer, so I make use of
outportb(0x378,0xAA); in C language but I get the below error,

error LNK2019: unresolved external symbol _outportb referenced in function _main

I had included dos.h, whether any header file has to include or any settings has to change.

Please help me with this issue.

Thanks & Regards
Updated 25-Mar-11 5:26am
Dalek Dave 25-Mar-11 10:26am    
Edited for Readability.

You can use Inpout32.dll available here[^] to write and read to the parallel port. Also, Here[^] is an example using Inpout32.dll with VC++.
Share this answer
Dalek Dave 25-Mar-11 10:27am    
Good Links
Rick Shaub 25-Mar-11 12:15pm    
The error is at LINK time. Your program compiled OK, but you need to include the library that contains outportb when you build the exe. Just what that library is called depends on your build tools. Be warned that if you are using Vista or Windows 7, your program will not work.

Good luck,
If you like the answer, vote for it and mark it accepted.
Share this answer
Dalek Dave 25-Mar-11 10:27am    
Good Answer
If you are trying to do this on a Windows XP platform, it won't work. Even if you found a compiler and library that would compile the program, Windows XP will not let a user program access hardware directly including writing to I/O ports with outportb. You would get a run-time error.
Share this answer
Peter_in_2780 25-Mar-11 3:53am    
NOT SO! XP is the last version of Windows that WILL let you access raw I/O ports.
LaxmikantYadav 25-Mar-11 4:28am    
Dear Peter, Accroding we can not use outportb() with Xp directly, The best way to know it try to run the program on XP...
Peter_in_2780 25-Mar-11 7:37am    
Sorry, but I've got 50+ clients who will tell you otherwise. If you run a 16-bit DOS program under XP, the "DOS box" in XP will do the port I/O for you.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900