C Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming LanguagesC Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old January 4th, 2003, 03:50 PM
nate nate is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Posts: 3 nate User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to nate
Declaration syntax error when compiling

I am compiling a program for the Palm pilot using CodeWarrior v8, and writing the code in C. However: when I try to include header files with C++ "class" definitionsit gives me errors galore. I'm sure it's a simple #include statement or an #ifndef statement that I am missing, but trying those has done nothing. Here is some sample code that causes an error.

Filename: platform.h

#if !defined(__PLATFORM_H_INCLUDED)
#define __PLATFORM_H_INCLUDED

#include <PalmOS.h>
#include <FloatMgr.h>
//this files contains all data type declarations depending on the platform

#define DALP_EXPORT __declspec(dllexport)
#define DALP_IMPORT __declspec(dllimport)

// palm os platform
#define Dint Int32
#define Duint unsigned Int32
#define Dlong long
#define Ddouble FlpDouble
#define Dvoid void
#define Dchar char //Single byte character
#define Dbyte unsigned char
#define Dfalse false
#define Dtrue true
#define Dbool bool
#define Ddword unsigned long
#define Dnull NULL
#define NULL_LENGTH ((unsigned long) ~0)

// some macros that support other functions

#define lec2uint(A) (Dint) (((Dint) ((Dbyte) (A)[0])) +\
(((Dint) ((Dbyte) (A)[1])) << 8))

#define lec3uint(A) (Dint) (((Dint) ((Dbyte) (A)[0])) +\
(((Dint) ((Dbyte) (A)[1])) << 8) +\
(((Dint) ((Dbyte) (A)[2])) << 16))

#define lec4uint(A) (Dint) (((Dint) ((Dbyte) (A)[0])) +\
(((Dint) ((Dbyte) (A)[1])) << 8) +\
(((Dint) ((Dbyte) (A)[2])) << 16) +\
(((Dint) ((Dbyte) (A)[3])) << 24))

#define int2lec(T,A) { Duint def_temp= (Duint) (A) ;\
*((Dbyte*) (T))= (Dbyte)(def_temp); \
*((Dbyte*) (T+1))=(Dbyte)((def_temp >> 8)); }
#define int3lec(T,A) { \
*((T))=(Dbyte) ((A));\
*((T)+1)=(Dbyte) (((A) >> 8));\
*((T)+2)=(Dbyte) (((A) >> 16)); \
}
#define int4lec(T,A) { *(T)=(Dbyte) ((A));\
*((T)+1)=(Dbyte) (((A) >> 8));\
*((T)+2)=(Dbyte) (((A) >> 16));\
*((T)+3)=(Dbyte) (((A) >> 24)); }

//global functions
void fnGetExternalErrorMessageText(Dchar* pErrorMessage, Dchar* pszFunctionName);

class DalpMemStrRoutines{
public:
static Dchar* StringCopy( Dchar* pszDestination, const Dchar* pszSource);
static Dint StringLength(const Dchar *pszString);
static Dvoid* MemoryCopy(Dvoid* pDest, const Dvoid* pSrc, Dint nCount);
static Dvoid* MemorySet(Dvoid* pDest, Dint nChar, Dint nCount);};


#define DALP_D_ITOD(X) (_d_itod(X))
#define DALP_D_DTOI(X) (_d_dtoi(X))
#define DALP_D_DIV(X,Y) (_d_div(X,Y))
#define DALP_D_MUL(X,Y) (_d_mul(X,Y))

#define ASSERT(X) \
do {if (Dnull == X) ErrDisplayFileLineMsg(__FILE__, (UInt16) __LINE__, "Null Pointer passed as parameter");} while (0)

#define SOCKET_ERROR (-1)

#endif



The error that it gives upon compiling, when I #include platform.h in my source file is:
"Error: declaration syntax error
platform.h line 91 class DalpMemStrRoutines "

This is only the first of many errors, all of which seem to be a part of C++ (eg: it'll also complain about the next line after this error where "public:" is used)

Am I doing something obviously wrong?

Thank you for your help,
Nathan
(nbluvol@uwo.ca)

Reply With Quote
  #2  
Old January 4th, 2003, 07:30 PM
nate nate is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Posts: 3 nate User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to nate
Cool

Turns out that it was the stupidest error ever! All the errors were because my files were with the ".c" extension and not ".cpp" (or whatever C++ extension tickles your fancy). As soon as I changed the files names: Voila! and it worked.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesC Programming > Declaration syntax error when compiling

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap