Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > C and C++ don't mix, Something wrong with my header?

Reply
Thread Tools

C and C++ don't mix, Something wrong with my header?

 
 
ssndk123@gmail.com
Guest
Posts: n/a
 
      04-16-2008
Hi,

I'm trying to include some C functions from IOPort.h/cpp to my C++
program.. i placed the IOPort.h into stdafx, but when I try to
compile i get the errors like: ioport.h( : error C2065: 'UINT' :
undeclared identifier. So, the Visual Studio 2005 compiler doesn't
know what UNIT is?

Am I doing something wrong? I attached my code below.

I'd appreciate any help..

Thanks,
Soren

-------------------------------------------------
stdafx.h:
-------------------------------------------------
#pragma once

#ifndef _WIN32_WINNT // Allow use of features specific to Windows XP
or later.
#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to
target other versions of Windows.
#endif

#include <stdio.h>
#include <tchar.h>
#include "IOPort.h"

-----------------------------------------------
IOPort.h:
------------------------------------------------
#ifndef IOPORTH
#define IOPORTH

#ifdef __cplusplus
extern "C" {
#endif

void outport(UINT portid, UINT value);
void outportb(UINT portid, BYTE value);
BYTE inportb(UINT portid);
UINT inport(UINT portid);
BOOL StartUpIoPorts(UINT PortToAccess, BOOL bShowMessageBox, HWND
hParentWnd);

#ifdef __cplusplus
}
#endif

#endif

---------------------------------------------------
testmain:
----------------------------------------------------
#include "stdafx.h"
#include <iostream>

using namespace std;

int main()
{
char i;
cout << "Hello World!!";
cin >> i;
return 0;
}

 
Reply With Quote
 
 
 
 
Noah Roberts
Guest
Posts: n/a
 
      04-16-2008
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> Hi,
>
> I'm trying to include some C functions from IOPort.h/cpp to my C++
> program.. i placed the IOPort.h into stdafx, but when I try to
> compile i get the errors like: ioport.h( : error C2065: 'UINT' :
> undeclared identifier. So, the Visual Studio 2005 compiler doesn't
> know what UNIT is?


That's because it's declared in the windows.h header, or one that it
includes. Pretty sure anyway.

Make sure ioport.h is included after this. That will fix your immediate
problem. Then as was said, ask vc specific questions in a vc newsgroup.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
XPath query for <?define something="something" ?> Pekka Järvinen XML 2 04-29-2008 08:12 PM
How to find and replace something that is nested inside something else? alainfri@gmail.com Perl Misc 4 05-31-2007 11:50 PM
XSL: I'm doing something wrong, and I can't see it! Simon Brooke XML 5 02-27-2007 08:34 AM
var Something= new Something() What does it mean ? pamelafluente@libero.it Javascript 9 10-05-2006 02:43 PM
umm... something... template(s)... something else... pointer(s)... and such... 0.o yah, I'm hopeless and clueless o.0 C++ 4 10-13-2004 10:34 PM



Advertisments