473,395 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

pointer to class in VC++ 6

Hi all,

I am attempting to convert IJG's JPEG code from C to C++ so that I can use it in an MFC windows program, and have come across a confusing problem.

The original code uses a series of structures to mimic the class, property, method layout of C++ programs. I am converting these structures into true C++ classes, and have had good success most of the time. However, the system IJG used has one class that includes pointer member variables to three other classes (an error manager, a memory manager, and a progress monitor).

Each of these classes have several methods that accept pointers to the aforementioned class as a parameter. I use a typedef in the class's ".h" file to create a "common_ptr" type. I.e. "typedef CCommon* common_ptr;".

When I try to compile this though, having made sure to include "common.h", I get the following errors:

MemMgr.h(166) : error C2143: syntax error : missing ';' before '*'
MemMgr.h(166) : error C2501: 'common_ptr' : missing storage-class or type specifiers
MemMgr.h(175) : error C2061: syntax error : identifier 'common_ptr'

The third error is at the function prototype that accepts common_ptr as a parameter.

If I remove the #include for "MemMgr.h" from the "Common.h" file, these errors go away ... but I get the same errors in "Common.h" (for good reason, because the class definitions it needs are no longer available to it).

How do I resolve these errors and still keep the pointer parameters that some of CMemMgr's methods require in order to work?

Thanks for your help.
Nov 17 '05 #1
0 834

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Smeckler | last post by:
I can't find any references to this in google's archive, but I'm sure it must be an old chestnut... The declaration MyClass* p(NULL); is fine under gcc, but not VC6. I suspect VC6 thinks...
9
by: Connell Gauld | last post by:
Hi, I have come across a problem with a slightly complicated section to a program I am writing. I have a class (let's call it ClassA) which has, in its public area, a variable (which happens to...
6
by: Itay_k | last post by:
Hello, I want a member in my class that will save pointer to pointer to System::Drawing::Image class. When I write on my class code: System::Drawing::Image **bmp; I get this error message:...
6
by: marco_segurini | last post by:
Hi, the following sample code shows a compiler error I get trying to build some old code with the last CL compiler (vers 13.10.3077): //----- begin #include <iostream> namespace ns {
0
by: DotNetJunkies User | last post by:
Background: I am creating a VC++ .NET wrapper for a C++ DLL; the aim is to use this wrapper in C# as shown below: Range r = new Range( 2, 2 ); r = new Cell( “Hello Mum” ); Range is a...
6
by: Felix I. Wyss | last post by:
It appears that VC++2003 has a code generator bug related to template parameters that are a pointer-to-member type: If the actual template argument is a virtual method, VC generates code that...
10
by: Peter Oliphant | last post by:
Is there a way of defining a method in a base class such that derived classes will call their own version, EVEN if the derived instance is referred to by a pointer to the base class? Note that the...
19
by: fungus | last post by:
I mentioned earlier to day that I was moving some code from VC++6 to VC++2005 and having trouble with the new iterators. There's all sorts of problems cropping up in the code thanks to this...
1
by: autumn | last post by:
Hi everybody, I'm having problem passing pointer to member object as template argument, seems VC 2005 does not allow 'pointer to base member' to 'pointer to derived member' conversion in template...
7
by: WaterWalk | last post by:
Hello. I thought I understood member function pointers, but in fact I don't. Consider the following example: class Base { public: virtual ~Base() {} }; class Derived : public Base {
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.