Example on C++ data member aligment - c++

I have tried to implement Stack Overflow question C++ Data Member Alignment and Array Packing. Here is the code:
#include <stdio.h>
#include <stddef.h>
typedef struct {
unsigned char a;
unsigned char b;
unsigned char c;
}foo;
typedef struct{
unsigned short i;
unsigned char a;
unsigned char b;
unsigned char c;
} Bar;
typedef struct {foo f[5];} f_b;
typedef struct {Bar[5];} b_f;
#define ALIGNMENT_OF(t) offsetof( struct { char x; t test; }, test )
int main(void){
printf("Foo:: Size: %d; Alignment: %d\n", sizeof(foo), ALIGNMENT_OF(foo));
printf("Bar:: Size: %d; Alignment: %d\n", sizeof(Bar), ALIGNMENT_OF(Bar));
printf("F_B:: Size: %d; Alignment: %d\n", sizeof(f_b), ALIGNMENT_OF(f_B));
printf("B_F:: Size: %d; Alignment: %d\n", sizeof(b_f), ALIGNMENT_OF(b_f));
return 0;
}
But here are the mistakes:
1>c:\users\david\documents\visual studio 2010\projects\data_packing\data_packing.cpp(16): error C2059: syntax error : '['
1>c:\users\david\documents\visual studio 2010\projects\data_packing\data_packing.cpp(16): error C2238: unexpected token(s) preceding ';'
1>c:\users\david\documents\visual studio 2010\projects\data_packing\data_packing.cpp(19): error C2332: 'struct' : missing tag name
1>c:\users\david\documents\visual studio 2010\projects\data_packing\data_packing.cpp(19): error C2143: syntax error : missing ')' before '{'
1>c:\users\david\documents\visual studio 2010\projects\data_packing\data_packing.cpp(19): error C2143: syntax error : missing ')' before '{'
1>c:\users\david\documents\visual studio 2010\projects\data_packing\data_packing.cpp(19): error C2059: syntax error : ')'
1>c:\users\david\documents\visual studio 2010\projects\data_packing\data_packing.cpp(19): error C2143: syntax error : missing '(' before ')'
1>c:\users\david\documents\visual studio 2010\projects\data_packing\data_packing.cpp(19): error C2143: syntax error : missing ')' before '{'
1>c:\users\david\documents\visual studio 2010\projects\data_packing\data_packing.cpp(19): error C2143: syntax error : missing ')' before '{'
1>c:\users\david\documents\visual studio 2010\projects\data_packing\data_packing.cpp(19): error C2143: syntax error : missing ')' before '{'
1>c:\users\david\documents\visual studio 2010\projects\data_packing\data_packing.cpp(19): error C2143: syntax error : missing ';' before '{'
1>c:\users\david\documents\visual studio 2010\projects\data_packing\data_packing.cpp(19): error C2059: syntax error : ')'
1>c:\users\david\documents\visual studio 2010\projects\data_packing\data_packing.cpp(19): error C2059: syntax error : ')'
1>c:\users\david\documents\visual studio 2010\projects\data_packing\data_packing.cpp(19): error C2227: left of '->test' must point to class/struct/union/generic type
1> type is 'int'
1>c:\users\david\documents\visual studio 2010\projects\data_packing\data_packing.cpp(19): error C2059: syntax error : ')'
1>c:\users\david\documents\visual studio 2010\projects\data_packing\data_packing.cpp(19): error C2059: syntax error : ')'
1>c:\users\david\documents\visual studio 2010\projects\data_packing\data_packing.cpp(19): error C2059: syntax error : ')'
1>c:\users\david\documents\visual studio 2010\projects\data_packing\data_packing.cpp(20): error C2332: 'struct' : missing tag name
1>c:\users\david\documents\visual studio 2010\projects\data_packing\data_packing.cpp(20): error C2143: syntax error : missing ')' before '{'
1>c:\users\david\documents\visual studio 2010\projects\data_packing\data_packing.cpp(20): error C2143: syntax error : missing ')' before '{'
1>c:\users\david\documents\visual studio 2010\projects\data_packing\data_packing.cpp(20): error C2059: syntax error : ')'
1>c:\users\david\documents\visual studio 2010\projects\data_packing\data_packing.cpp(20): error C2143: syntax error : missing '(' before ')'
1>c:\users\david\documents\visual studio 2010\projects\data_packing\data_packing.cpp(20): error C2143: syntax error : missing ')' before '{'
1>c:\users\david\documents\visual studio 2010\projects\data_packing\data_packing.cpp(20): error C2143: syntax error : missing ')' before '{'
1>c:\users\david\documents\visual studio 2010\projects\data_packing\data_packing.cpp(20): error C2143: syntax error : missing ')' before '{'
1>c:\users\david\documents\visual studio 2010\projects\data_packing\data_packing.cpp(20): error C2143: syntax error : missing ';' before '{'
1>c:\users\david\documents\visual studio 2010\projects\data_packing\data_packing.cpp(20): error C2059: syntax error : ')'
1>c:\users\david\documents\visual studio 2010\projects\data_packing\data_packing.cpp(20): error C2059: syntax error : ')'
1>c:\users\david\documents\visual studio 2010\projects\data_packing\data_packing.cpp(20): error C2227: left of '->test' must point to class/struct/union/generic type
1> type is 'int'
1>c:\users\david\documents\visual studio 2010\projects\data_packing\data_packing.cpp(20): error C2059: syntax error : ')'
1>c:\users\david\documents\visual studio 2010\projects\data_packing\data_packing.cpp(20): error C2059: syntax error : ')'
1>c:\users\david\documents\visual studio 2010\projects\data_packing\data_packing.cpp(20): error C2059: syntax error : ')'
1>c:\users\david\documents\visual studio 2010\projects\data_packing\data_packing.cpp(21): error C2332: 'struct' : missing tag name
1>c:\users\david\documents\visual studio 2010\projects\data_packing\data_packing.cpp(21): error C2143: syntax error : missing ')' before '{'
1>c:\users\david\documents\visual studio 2010\projects\data_packing\data_packing.cpp(21): error C2143: syntax error : missing ')' before '{'
1>c:\users\david\documents\visual studio 2010\projects\data_packing\data_packing.cpp(21): error C2059: syntax error : ')'
1>c:\users\david\documents\visual studio 2010\projects\data_packing\data_packing.cpp(21): error C2143: syntax error : missing '(' before ')'
1>c:\users\david\documents\visual studio 2010\projects\data_packing\data_packing.cpp(21): error C2143: syntax error : missing ')' before '{'
1>c:\users\david\documents\visual studio 2010\projects\data_packing\data_packing.cpp(21): error C2143: syntax error : missing ')' before '{'
1>c:\users\david\documents\visual studio 2010\projects\data_packing\data_packing.cpp(21): error C2143: syntax error : missing ')' before '{'
1>c:\users\david\documents\visual studio 2010\projects\data_packing\data_packing.cpp(21): error C2143: syntax error : missing ';' before '{'
1>c:\users\david\documents\visual studio 2010\projects\data_packing\data_packing.cpp(21): error C2065: 'f_B' : undeclared identifier
1>c:\users\david\documents\visual studio 2010\projects\data_packing\data_packing.cpp(21): error C2146: syntax error : missing ';' before identifier 'test'
1>c:\users\david\documents\visual studio 2010\projects\data_packing\data_packing.cpp(21): error C2059: syntax error : ')'
1>c:\users\david\documents\visual studio 2010\projects\data_packing\data_packing.cpp(21): error C2059: syntax error : ')'
1>c:\users\david\documents\visual studio 2010\projects\data_packing\data_packing.cpp(21): error C2227: left of '->test' must point to class/struct/union/generic type
1> type is 'int'
1>c:\users\david\documents\visual studio 2010\projects\data_packing\data_packing.cpp(21): error C2059: syntax error : ')'
1>c:\users\david\documents\visual studio 2010\projects\data_packing\data_packing.cpp(21): error C2059: syntax error : ')'
1>c:\users\david\documents\visual studio 2010\projects\data_packing\data_packing.cpp(21): error C2059: syntax error : ')'
1>c:\users\david\documents\visual studio 2010\projects\data_packing\data_packing.cpp(22): error C2332: 'struct' : missing tag name
1>c:\users\david\documents\visual studio 2010\projects\data_packing\data_packing.cpp(22): error C2143: syntax error : missing ')' before '{'
1>c:\users\david\documents\visual studio 2010\projects\data_packing\data_packing.cpp(22): error C2143: syntax error : missing ')' before '{'
1>c:\users\david\documents\visual studio 2010\projects\data_packing\data_packing.cpp(22): error C2059: syntax error : ')'
1>c:\users\david\documents\visual studio 2010\projects\data_packing\data_packing.cpp(22): error C2143: syntax error : missing '(' before ')'
1>c:\users\david\documents\visual studio 2010\projects\data_packing\data_packing.cpp(22): error C2143: syntax error : missing ')' before '{'
1>c:\users\david\documents\visual studio 2010\projects\data_packing\data_packing.cpp(22): error C2143: syntax error : missing ')' before '{'
1>c:\users\david\documents\visual studio 2010\projects\data_packing\data_packing.cpp(22): error C2143: syntax error : missing ')' before '{'
1>c:\users\david\documents\visual studio 2010\projects\data_packing\data_packing.cpp(22): error C2143: syntax error : missing ';' before '{'
1>c:\users\david\documents\visual studio 2010\projects\data_packing\data_packing.cpp(22): error C2059: syntax error : ')'
1>c:\users\david\documents\visual studio 2010\projects\data_packing\data_packing.cpp(22): error C2059: syntax error : ')'
1>c:\users\david\documents\visual studio 2010\projects\data_packing\data_packing.cpp(22): error C2227: left of '->test' must point to class/struct/union/generic type
1> type is 'int'
1>c:\users\david\documents\visual studio 2010\projects\data_packing\data_packing.cpp(22): error C2059: syntax error : ')'
1>c:\users\david\documents\visual studio 2010\projects\data_packing\data_packing.cpp(22): error C2059: syntax error : ')'
1>c:\users\david\documents\visual studio 2010\projects\data_packing\data_packing.cpp(22): error C2059: syntax error : ')'
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
But in code it does not show me a red line which indicates an error. How do I fix this problem?

See where it says \data_packing.cpp(16):? That 16 in parentheses is a line number.

In the struct b_f, you created an array of Bar without a name. Also, in C++, you don't need all that typedef stuff.

For starters
Bar[5]
is not valid code. It should be something like
Bar f[5]
Furthermore, that macro doesn't make sense. You might try this instead:
template< class T >
struct testStruct{ char x; T test; };
#define ALIGNMENT_OF(t) offsetof( testStruct< t >, test )
And finally there's a typo:
ALIGNMENT_OF(f_B) //should be f_b

The pragma pack and pop might be helpful. The example below will align each member on one byte boundaries. In VS this can also be set on a project level by changing the project setting C++/CodeGeneration/StructMemberAlignment.
#pragma pack(push, 1)
struct test {
int a;
char b[3];
double c;
};
#pragma pack(pop)

Related

Anonymous struct inside loop

The code below compiles fine with g++
#include <iostream>
using namespace std;
int main()
{
for (struct { int i; double j; } x = {0,0}; x.i < 10; ++x.i, x.j+=.1)
{
std::cout << x.i << " " << x.j << '\n';
}
}
But with MSVC2005 I get errors
error C2332: 'struct' : missing tag name
error C2143: syntax error : missing ')' before '{'
warning C4094: untagged 'struct' declared no symbols
error C2059: syntax error : 'empty declaration'
error C2143: syntax error : missing ';' before ')'
error C2143: syntax error : missing ';' before ')'
error C2065: 'x' : undeclared identifier
error C2059: syntax error : '{'
error C2143: syntax error : missing ';' before '{'
error C2143: syntax error : missing ';' before '}'
error C2228: left of '.i' must have class/struct/union
1> type is ''unknown-type''
error C2228: left of '.i' must have class/struct/union
1> type is ''unknown-type''
error C2228: left of '.j' must have class/struct/union
1> type is ''unknown-type''
error C2059: syntax error : ')'
error C2143: syntax error : missing ';' before '{'
error C2228: left of '.i' must have class/struct/union
1> type is ''unknown-type''
error C2228: left of '.j' must have class/struct/union
1> type is ''unknown-type''
I want to know if anonymous struct inside loops are an "extension" or a language feature and MSC2005 is missing it?
It's a bug in msvc. Unfortunately, it is not high in their priority list.

C2653: 'GUI' : is not a class or namespace

Seriously getting on my nerves. This code was working just fine earlier, I restarted the IDE (Visual Studio 2010) and now suddenly the code goes bonkers on me. The error log is huge, and I have no idea what's causing it as the code seems to be pretty much correct.
1>ClCompile:
1> uicont.cpp
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\include\mage\gui\uicontext.h(21): error C2653: 'GUI' : is not a class or namespace name
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\include\mage\gui\uicontext.h(21): error C2143: syntax error : missing ';' before '*'
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\include\mage\gui\uicontext.h(21): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\include\mage\gui\uicontext.h(21): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
Many more, but I assume this is what's causing the error. Here is the source code for the files that are having the most problems.
Mage/GUI/UIContext.h
#include <OGRE/OgreString.h>
#include <OGRE/OgreOverlay.h>
#include <OGRE/OgreOverlayManager.h>
#include <vector>
#include <Mage/GUI/Frame.h>
#ifndef __H_MAGE_UICONTEXT
#define __H_MAGE_UICONTEXT
namespace Mage {
class UIContext {
public:
UIContext();
~UIContext();
GUI::Frame* createFrame(Ogre::String, Ogre::Vector2, double, double);
void attachFrame(Ogre::OverlayContainer*);
private:
Ogre::Overlay* m_Overlay;
std::vector<GUI::Frame*> m_Frames;
};
}
#endif // __H_MAGE_UICONTEXT
Mage/GUI/Frame.h
#include <OGRE/OgreVector2.h>
#include <OGRE/OgreOverlayContainer.h>
#include <OGRE/OgreOverlayManager.h>
#include <OGRE/OgreString.h>
#include <Mage/GUI/UIContext.h>
#ifndef __H_MAGE_GUI_FRAME
#define __H_MAGE_GUI_FRAME
namespace Mage {
namespace GUI {
class Frame {
public:
Frame(Mage::UIContext*, Ogre::String, Ogre::Vector2, double, double);
private:
Ogre::OverlayContainer* m_Panel;
};
}
}
#endif // __H_MAGE_GUI_FRAME
I also included the WHOLE error log, but that just seems to be everything going down the gutter as this part fails. I haven't even touched that code and it has always compiled fine. Would it be needed to solve the problem, I'll include that as well; those are huge files though.
1>------ Build started: Project: Mage3D, Configuration: Debug Win32 ------
1>Build started 17/08/2012 19:43:22.
1>InitializeBuildStatus:
1> Touching "Debug\Mage3D.unsuccessfulbuild".
1>ClCompile:
1> uicont.cpp
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\include\mage\gui\uicontext.h(21): error C2653: 'GUI' : is not a class or namespace name
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\include\mage\gui\uicontext.h(21): error C2143: syntax error : missing ';' before '*'
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\include\mage\gui\uicontext.h(21): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\include\mage\gui\uicontext.h(21): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\include\mage\gui\uicontext.h(21): warning C4183: 'createFrame': missing return type; assumed to be a member function returning 'int'
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\include\mage\gui\uicontext.h(26): error C2653: 'GUI' : is not a class or namespace name
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\include\mage\gui\uicontext.h(26): error C2065: 'Frame' : undeclared identifier
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\include\mage\gui\uicontext.h(26): error C2059: syntax error : '>'
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\include\mage\gui\uicontext.h(27): error C2143: syntax error : missing ';' before '}'
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\include\mage\gui\uicontext.h(28): error C2143: syntax error : missing ';' before '}'
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\include\mage\gui\frame.h(14): error C2143: syntax error : missing ';' before '{'
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\include\mage\gui\frame.h(15): error C2143: syntax error : missing ';' before '{'
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\include\mage\gui\frame.h(16): error C2143: syntax error : missing ';' before '{'
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\include\mage\gui\frame.h(18): error C2143: syntax error : missing ',' before ')'
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\include\mage\gui\frame.h(23): error C2143: syntax error : missing ';' before '}'
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\include\mage\gui\frame.h(24): error C2143: syntax error : missing ';' before '}'
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\include\mage\gui\frame.h(25): error C2143: syntax error : missing ';' before '}'
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\include\mage\gui\uicontroller.h(16): error C2143: syntax error : missing ';' before '{'
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\include\mage\gui\uicontroller.h(18): error C2143: syntax error : missing ';' before '}'
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\include\mage\gui\uicontroller.h(19): error C2039: 'UIController' : is not a member of 'Mage'
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\include\mage\gui\uicontroller.h(19): error C2065: 'UIController' : undeclared identifier
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\include\mage\gui\uicontroller.h(19): error C2990: 'Ogre::Singleton' : non-class template has already been declared as a class template
1> c:\users\jesse\documents\visual studio 2010\projects\mage3d\ogre3d\include\ogre\ogresingleton.h(65) : see declaration of 'Ogre::Singleton'
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\include\mage\gui\uicontroller.h(22): error C2143: syntax error : missing ';' before '{'
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\include\mage\gui\uicontroller.h(23): error C3413: 'Mage::UIContext::UIController' : invalid explicit instantiation
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\include\mage\gui\uicontroller.h(37): error C2143: syntax error : missing ';' before '{'
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\include\mage\gui\uicontroller.h(38): error C2143: syntax error : missing ';' before '}'
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\gui\uicont.cpp(4): error C2039: 'UIController' : is not a member of 'Mage'
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\gui\uicont.cpp(4): error C2039: 'UIController' : is not a member of 'Mage'
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\gui\uicont.cpp(4): error C2065: 'UIController' : undeclared identifier
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\gui\uicont.cpp(4): error C2955: 'Ogre::Singleton' : use of class template requires template argument list
1> c:\users\jesse\documents\visual studio 2010\projects\mage3d\ogre3d\include\ogre\ogresingleton.h(65) : see declaration of 'Ogre::Singleton'
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\gui\uicont.cpp(6): error C2143: syntax error : missing ';' before '{'
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\gui\uicont.cpp(7): error C2653: 'UIController' : is not a class or namespace name
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\gui\uicont.cpp(7): error C2143: syntax error : missing ';' before '{'
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\gui\uicont.cpp(10): error C2143: syntax error : missing ';' before '}'
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\gui\uicont.cpp(12): error C2653: 'UIController' : is not a class or namespace name
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\gui\uicont.cpp(12): error C2143: syntax error : missing ';' before '{'
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\gui\uicont.cpp(13): error C2143: syntax error : missing ',' before ')'
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\gui\uicont.cpp(15): error C2143: syntax error : missing ';' before '}'
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\gui\uicont.cpp(17): error C2653: 'UIController' : is not a class or namespace name
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\gui\uicont.cpp(17): error C2143: syntax error : missing ';' before '{'
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\gui\uicont.cpp(19): error C2143: syntax error : missing ';' before '}'
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\gui\uicont.cpp(21): error C2653: 'UIController' : is not a class or namespace name
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\gui\uicont.cpp(21): error C2143: syntax error : missing ';' before '{'
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\gui\uicont.cpp(24): error C2143: syntax error : missing ';' before '}'
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\gui\uicont.cpp(26): error C2653: 'UIController' : is not a class or namespace name
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\gui\uicont.cpp(26): error C2143: syntax error : missing ';' before '{'
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\gui\uicont.cpp(37): error C2143: syntax error : missing ';' before '}'
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\gui\uicont.cpp(39): error C2653: 'UIController' : is not a class or namespace name
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\gui\uicont.cpp(39): error C2143: syntax error : missing ';' before '{'
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\gui\uicont.cpp(55): error C2143: syntax error : missing ',' before ')'
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\gui\uicont.cpp(67): error C2143: syntax error : missing ',' before ')'
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\gui\uicont.cpp(73): error C2143: syntax error : missing ';' before '}'
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\gui\uicont.cpp(74): error C2143: syntax error : missing ';' before '}'
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\gui\uicont.cpp(75): error C2143: syntax error : missing ';' before '}'
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\gui\uicont.cpp(75): fatal error C1004: unexpected end-of-file found
1> luagui.cpp
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\include\mage\gui\frame.h(18): error C2039: 'UIContext' : is not a member of 'Mage'
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\include\mage\gui\frame.h(18): error C2039: 'UIContext' : is not a member of 'Mage'
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\include\mage\gui\frame.h(18): error C2061: syntax error : identifier 'UIContext'
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\gui\luagui.cpp(76): warning C4244: 'argument' : conversion from 'lua_Number' to 'const Ogre::Real', possible loss of data
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\gui\luagui.cpp(76): warning C4244: 'argument' : conversion from 'lua_Number' to 'const Ogre::Real', possible loss of data
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\gui\luagui.cpp(77): error C2661: 'Mage::GUI::Frame::Frame' : no overloaded function takes 4 arguments
1> frame.cpp
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\include\mage\gui\frame.h(18): error C2039: 'UIContext' : is not a member of 'Mage'
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\include\mage\gui\frame.h(18): error C2039: 'UIContext' : is not a member of 'Mage'
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\include\mage\gui\frame.h(18): error C2061: syntax error : identifier 'UIContext'
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\gui\frame.cpp(4): error C2511: 'Mage::GUI::Frame::Frame(Mage::UIContext *,Ogre::String,Ogre::Vector2,double,double)' : overloaded member function not found in 'Mage::GUI::Frame'
1> c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\include\mage\gui\frame.h(16) : see declaration of 'Mage::GUI::Frame'
1> context.cpp
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\include\mage\gui\uicontext.h(21): error C2653: 'GUI' : is not a class or namespace name
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\include\mage\gui\uicontext.h(21): error C2143: syntax error : missing ';' before '*'
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\include\mage\gui\uicontext.h(21): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\include\mage\gui\uicontext.h(21): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\include\mage\gui\uicontext.h(21): warning C4183: 'createFrame': missing return type; assumed to be a member function returning 'int'
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\include\mage\gui\uicontext.h(26): error C2653: 'GUI' : is not a class or namespace name
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\include\mage\gui\uicontext.h(26): error C2065: 'Frame' : undeclared identifier
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\include\mage\gui\uicontext.h(26): error C2059: syntax error : '>'
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\include\mage\gui\uicontext.h(27): error C2143: syntax error : missing ';' before '}'
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\include\mage\gui\uicontext.h(28): error C2143: syntax error : missing ';' before '}'
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\include\mage\gui\frame.h(14): error C2143: syntax error : missing ';' before '{'
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\include\mage\gui\frame.h(15): error C2143: syntax error : missing ';' before '{'
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\include\mage\gui\frame.h(16): error C2143: syntax error : missing ';' before '{'
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\include\mage\gui\frame.h(18): error C2143: syntax error : missing ',' before ')'
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\include\mage\gui\frame.h(23): error C2143: syntax error : missing ';' before '}'
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\include\mage\gui\frame.h(24): error C2143: syntax error : missing ';' before '}'
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\mage3d\include\mage\gui\frame.h(25): error C2143: syntax error : missing ';' before '}'
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\ogre3d\include\ogre\ogrepixelformat.h(34): error C2143: syntax error : missing ';' before '{'
1>c:\users\jesse\documents\visual studio 2010\projects\mage3d\ogre3d\include\ogre\ogrepixelformat.h(43): error C2143: syntax error : missing ';' before '{'
... snip, just more of these errors ...
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:11.44
========== Build: 0 succeeded, 1 failed, 3 up-to-date, 0 skipped ==========
Well I don't know anymore. Hopefully you guys at StackOverflow can help me out as you always do. You people see everything I swear, and that's why I love you so.
In Mage/GUI/UIContext.h you included "Mage/GUI/Frame.h" and after that in Mage/GUI/Frame.h you included "Mage/GUI/UIContext.h".
This is the reason why you get those errors.You should at least change one of those includes and it should be fine.
Answering my own question: a method of UIContext was looking for the class Mage::GUI::Frame, which did not exist. The constructor for the Frame class was looking for UIContext, which didn't exist either. Adding a prototype of the class before including the headers resolved that.

SDL_mixer 2 compilation broken in windows using visual studio express with SDL2

Im trying to compile SDL_mixer 2 with SDL2 checked out the latest code from :
http://hg.libsdl.org/SDL_mixer
also compiled with no problem SDL2 and SDL_image.
when compiling SDL_mixer im getting the compilation errors :
1>Compiling...
1>dynamic_mp3.c
1>d:\cpp\2d\sdl2.0\sdl-2.0\sdl_mixer\visualc\external\include\mpegfilter.h(39) : error C2143: syntax error : missing ')' before '*'
1>d:\cpp\2d\sdl2.0\sdl-2.0\sdl_mixer\visualc\external\include\mpegfilter.h(39) : error C2143: syntax error : missing '{' before '*'
1>d:\cpp\2d\sdl2.0\sdl-2.0\sdl_mixer\visualc\external\include\mpegfilter.h(39) : error C2143: syntax error : missing ';' before '*'
1>d:\cpp\2d\sdl2.0\sdl-2.0\sdl_mixer\visualc\external\include\mpegfilter.h(39) : error C2371: 'SDL_Rect' : redefinition; different basic types
1> d:\cpp\2d\love\lov8\lib\sdl\include\sdl_rect.h(69) : see declaration of 'SDL_Rect'
1>d:\cpp\2d\sdl2.0\sdl-2.0\sdl_mixer\visualc\external\include\mpegfilter.h(39) : error C2143: syntax error : missing ';' before '*'
1>d:\cpp\2d\sdl2.0\sdl-2.0\sdl_mixer\visualc\external\include\mpegfilter.h(39) : error C2371: 'SMPEG_FilterInfo' : redefinition; different basic types
1> d:\cpp\2d\sdl2.0\sdl-2.0\sdl_mixer\visualc\external\include\mpegfilter.h(33) : see declaration of 'SMPEG_FilterInfo'
1>d:\cpp\2d\sdl2.0\sdl-2.0\sdl_mixer\visualc\external\include\mpegfilter.h(39) : error C2143: syntax error : missing ';' before '*'
1>d:\cpp\2d\sdl2.0\sdl-2.0\sdl_mixer\visualc\external\include\mpegfilter.h(39) : error C2059: syntax error : 'type'
1>d:\cpp\2d\sdl2.0\sdl-2.0\sdl_mixer\visualc\external\include\mpegfilter.h(39) : error C2059: syntax error : ')'
1>d:\cpp\2d\sdl2.0\sdl-2.0\sdl_mixer\visualc\external\include\mpegfilter.h(46) : error C2061: syntax error : identifier 'SMPEG_FilterCallback'
1>d:\cpp\2d\sdl2.0\sdl-2.0\sdl_mixer\visualc\external\include\mpegfilter.h(48) : error C2059: syntax error : '}'
1>d:\cpp\2d\sdl2.0\sdl-2.0\sdl_mixer\visualc\external\include\mpegfilter.h(56) : error C2143: syntax error : missing '{' before '*'
1>d:\cpp\2d\sdl2.0\sdl-2.0\sdl_mixer\visualc\external\include\mpegfilter.h(59) : error C2143: syntax error : missing '{' before '*'
1>d:\cpp\2d\sdl2.0\sdl-2.0\sdl_mixer\visualc\external\include\mpegfilter.h(62) : error C2143: syntax error : missing '{' before '*'
1>d:\cpp\2d\sdl2.0\sdl-2.0\sdl_mixer\visualc\external\include\smpeg.h(180) : error C2143: syntax error : missing '{' before '*'
1>d:\cpp\2d\sdl2.0\sdl-2.0\sdl_mixer\visualc\external\include\smpeg.h(180) : error C2143: syntax error : missing ')' before '*'
1>d:\cpp\2d\sdl2.0\sdl-2.0\sdl_mixer\visualc\external\include\smpeg.h(180) : error C2081: 'SMPEG_Filter' : name in formal parameter list illegal
1>d:\cpp\2d\sdl2.0\sdl-2.0\sdl_mixer\visualc\external\include\smpeg.h(180) : error C2143: syntax error : missing '{' before '*'
1>d:\cpp\2d\sdl2.0\sdl-2.0\sdl_mixer\visualc\external\include\smpeg.h(180) : error C2059: syntax error : ')'
1>mixer.c
1>d:\cpp\2d\sdl2.0\sdl-2.0\sdl_mixer\visualc\external\include\mpegfilter.h(39) : error C2143: syntax error : missing ')' before '*'
1>d:\cpp\2d\sdl2.0\sdl-2.0\sdl_mixer\visualc\external\include\mpegfilter.h(39) : error C2143: syntax error : missing '{' before '*'
1>d:\cpp\2d\sdl2.0\sdl-2.0\sdl_mixer\visualc\external\include\mpegfilter.h(39) : error C2143: syntax error : missing ';' before '*'
1>d:\cpp\2d\sdl2.0\sdl-2.0\sdl_mixer\visualc\external\include\mpegfilter.h(39) : error C2371: 'SDL_Rect' : redefinition; different basic types
1> d:\cpp\2d\love\lov8\lib\sdl\include\sdl_rect.h(69) : see declaration of 'SDL_Rect'
1>d:\cpp\2d\sdl2.0\sdl-2.0\sdl_mixer\visualc\external\include\mpegfilter.h(39) : error C2143: syntax error : missing ';' before '*'
1>d:\cpp\2d\sdl2.0\sdl-2.0\sdl_mixer\visualc\external\include\mpegfilter.h(39) : error C2371: 'SMPEG_FilterInfo' : redefinition; different basic types
1> d:\cpp\2d\sdl2.0\sdl-2.0\sdl_mixer\visualc\external\include\mpegfilter.h(33) : see declaration of 'SMPEG_FilterInfo'
1>d:\cpp\2d\sdl2.0\sdl-2.0\sdl_mixer\visualc\external\include\mpegfilter.h(39) : error C2143: syntax error : missing ';' before '*'
1>d:\cpp\2d\sdl2.0\sdl-2.0\sdl_mixer\visualc\external\include\mpegfilter.h(39) : error C2059: syntax error : 'type'
1>d:\cpp\2d\sdl2.0\sdl-2.0\sdl_mixer\visualc\external\include\mpegfilter.h(39) : error C2059: syntax error : ')'
1>d:\cpp\2d\sdl2.0\sdl-2.0\sdl_mixer\visualc\external\include\mpegfilter.h(46) : error C2061: syntax error : identifier 'SMPEG_FilterCallback'
1>d:\cpp\2d\sdl2.0\sdl-2.0\sdl_mixer\visualc\external\include\mpegfilter.h(48) : error C2059: syntax error : '}'
1>d:\cpp\2d\sdl2.0\sdl-2.0\sdl_mixer\visualc\external\include\mpegfilter.h(56) : error C2143: syntax error : missing '{' before '*'
1>d:\cpp\2d\sdl2.0\sdl-2.0\sdl_mixer\visualc\external\include\mpegfilter.h(59) : error C2143: syntax error : missing '{' before '*'
1>d:\cpp\2d\sdl2.0\sdl-2.0\sdl_mixer\visualc\external\include\mpegfilter.h(62) : error C2143: syntax error : missing '{' before '*'
1>d:\cpp\2d\sdl2.0\sdl-2.0\sdl_mixer\visualc\external\include\smpeg.h(180) : error C2143: syntax error : missing '{' before '*'
1>d:\cpp\2d\sdl2.0\sdl-2.0\sdl_mixer\visualc\external\include\smpeg.h(180) : error C2143: syntax error : missing ')' before '*'
1>d:\cpp\2d\sdl2.0\sdl-2.0\sdl_mixer\visualc\external\include\smpeg.h(180) : error C2081: 'SMPEG_Filter' : name in formal parameter list illegal
1>d:\cpp\2d\sdl2.0\sdl-2.0\sdl_mixer\visualc\external\include\smpeg.h(180) : error C2143: syntax error : missing '{' before '*'
1>d:\cpp\2d\sdl2.0\sdl-2.0\sdl_mixer\visualc\external\include\smpeg.h(180) : error C2059: syntax error : ')'
1>d:\cpp\2d\sdl2.0\sdl-2.0\sdl_mixer\mixer.c(129) : warning C4090: 'function' : different 'const' qualifiers
1>d:\cpp\2d\sdl2.0\sdl-2.0\sdl_mixer\mixer.c(1145) : warning C4090: 'function' : different 'const' qualifiers
1>music.c
1>d:\cpp\2d\sdl2.0\sdl-2.0\sdl_mixer\visualc\external\include\mpegfilter.h(39) : error C2143: syntax error : missing ')' before '*'
1>d:\cpp\2d\sdl2.0\sdl-2.0\sdl_mixer\visualc\external\include\mpegfilter.h(39) : error C2143: syntax error : missing '{' before '*'
1>d:\cpp\2d\sdl2.0\sdl-2.0\sdl_mixer\visualc\external\include\mpegfilter.h(39) : error C2143: syntax error : missing ';' before '*'
1>d:\cpp\2d\sdl2.0\sdl-2.0\sdl_mixer\visualc\external\include\mpegfilter.h(39) : error C2371: 'SDL_Rect' : redefinition; different basic types
1> d:\cpp\2d\love\lov8\lib\sdl\include\sdl_rect.h(69) : see declaration of 'SDL_Rect'
1>d:\cpp\2d\sdl2.0\sdl-2.0\sdl_mixer\visualc\external\include\mpegfilter.h(39) : error C2143: syntax error : missing ';' before '*'
1>d:\cpp\2d\sdl2.0\sdl-2.0\sdl_mixer\visualc\external\include\mpegfilter.h(39) : error C2371: 'SMPEG_FilterInfo' : redefinition; different basic types
1> d:\cpp\2d\sdl2.0\sdl-2.0\sdl_mixer\visualc\external\include\mpegfilter.h(33) : see declaration of 'SMPEG_FilterInfo'
1>d:\cpp\2d\sdl2.0\sdl-2.0\sdl_mixer\visualc\external\include\mpegfilter.h(39) : error C2143: syntax error : missing ';' before '*'
1>d:\cpp\2d\sdl2.0\sdl-2.0\sdl_mixer\visualc\external\include\mpegfilter.h(39) : error C2059: syntax error : 'type'
1>d:\cpp\2d\sdl2.0\sdl-2.0\sdl_mixer\visualc\external\include\mpegfilter.h(39) : error C2059: syntax error : ')'
1>d:\cpp\2d\sdl2.0\sdl-2.0\sdl_mixer\visualc\external\include\mpegfilter.h(46) : error C2061: syntax error : identifier 'SMPEG_FilterCallback'
1>d:\cpp\2d\sdl2.0\sdl-2.0\sdl_mixer\visualc\external\include\mpegfilter.h(48) : error C2059: syntax error : '}'
1>d:\cpp\2d\sdl2.0\sdl-2.0\sdl_mixer\visualc\external\include\mpegfilter.h(56) : error C2143: syntax error : missing '{' before '*'
1>d:\cpp\2d\sdl2.0\sdl-2.0\sdl_mixer\visualc\external\include\mpegfilter.h(59) : error C2143: syntax error : missing '{' before '*'
1>d:\cpp\2d\sdl2.0\sdl-2.0\sdl_mixer\visualc\external\include\mpegfilter.h(62) : error C2143: syntax error : missing '{' before '*'
1>d:\cpp\2d\sdl2.0\sdl-2.0\sdl_mixer\visualc\external\include\smpeg.h(180) : error C2143: syntax error : missing '{' before '*'
1>d:\cpp\2d\sdl2.0\sdl-2.0\sdl_mixer\visualc\external\include\smpeg.h(180) : error C2143: syntax error : missing ')' before '*'
1>d:\cpp\2d\sdl2.0\sdl-2.0\sdl_mixer\visualc\external\include\smpeg.h(180) : error C2081: 'SMPEG_Filter' : name in formal parameter list illegal
1>d:\cpp\2d\sdl2.0\sdl-2.0\sdl_mixer\visualc\external\include\smpeg.h(180) : error C2143: syntax error : missing '{' before '*'
1>d:\cpp\2d\sdl2.0\sdl-2.0\sdl_mixer\visualc\external\include\smpeg.h(180) : error C2059: syntax error : ')'
1>d:\cpp\2d\sdl2.0\sdl-2.0\sdl_mixer\music.c(166) : warning C4090: 'function' : different 'const' qualifiers
1>d:\cpp\2d\sdl2.0\sdl-2.0\sdl_mixer\music.c(625) : warning C4047: 'return' : 'Mix_Music *' differs in levels of indirection from 'int'
1>d:\cpp\2d\sdl2.0\sdl-2.0\sdl_mixer\music.c(1529) : warning C4090: 'function' : different 'const' qualifiers
any one has any idea ?
I think you can remove the MP3_MUSIC preprocessor macro or include smpeg in you search path.
Take a look at the PreProcessor Definitions.
Remove these
MOD_MUSIC
MOD_DYNAMIC=\"libmikmod-2.dll\"
OGG_MUSIC
OGG_DYNAMIC=\"libvorbisfile-3.dll\"
FLAC_MUSIC
FLAC_DYNAMIC=\"libFLAC-8.dll\"
MP3_MUSIC
MP3_DYNAMIC=\"smpeg.dll\"
If you want to use any of those file types in your audio, you need to get those .dll files as well. I would recommend compiling those libraries statically instead of dynamically to make thing more cross-platform compatible.

How to track down the cause of "syntax error: missing ')' before identifier" and others? [closed]

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.
Closed 11 years ago.
Im writing a project in C with visual studio that contains these files:
multiThreadServer.cpp
myLib.cpp
myLib.h
The 1st (multiThreadServer.cpp) includes these
#include <WinSock2.h>
#include <Windows.h>
#include <stdio.h>
#include "myLib.h"
2nd (myLib.cpp) these
#include <WinSock2.h>
#include <stdio.h>
#include "myLib.h"
3nd (myLib.h) includes nothing
In .h file i have these functions defined:
// Starts up the server.
INT start_server(const unsigned short port);
// Accept Connections.
BOOL accept_connections();
// Accept Client.
BOOL AcceptClient(PCLIENT current_client);
// Receiver Function for the thread.
DWORD WINAPI Receiver(LPVOID lpParam);
// Receive data from client.
BOOL recv_data(PCLIENT current_client, char *buffer, int size);
// End server.
VOID end_server();
// Send data.
BOOL send_data(PCLIENT current_client, char *buffer, int size);
// Disconnect Client.
VOID disconnect_client(PCLIENT current_client);
// Send Data to all clients.
BOOL send_data_to_all(char *message);
Here is part of myLib.cpp:
typedef struct _client{
SOCKADDR_IN address; // internal data structure regarding this client
SOCKET socket; // this clients socket
BOOL connected; // is this client connected
char IP[20]; // this clients IP address
int address_length; // internal data structure regarding this client
} CLIENT, *PCLIENT;
Now, when im going to compile the whole project these annoying syntax errors returned:
1> myLib.cpp
\mylib.h(8): error C2146: syntax error : missing ')' before identifier 'current_client'
\mylib.h(8): error C2061: syntax error : identifier 'current_client'
\mylib.h(8): error C2059: syntax error : ';'
\mylib.h(8): error C2059: syntax error : ')'
\mylib.h(14): error C2146: syntax error : missing ')' before identifier 'current_client'
\mylib.h(14): error C2061: syntax error : identifier 'current_client'
\mylib.h(14): error C2059: syntax error : ';'
\mylib.h(14): error C2059: syntax error : ','
\mylib.h(14): error C2059: syntax error : ')'
\mylib.h(20): error C2146: syntax error : missing ')' before identifier 'current_client'
\mylib.h(20): error C2061: syntax error : identifier 'current_client'
\mylib.h(20): error C2059: syntax error : ';'
\mylib.h(20): error C2059: syntax error : ','
\mylib.h(20): error C2059: syntax error : ')'
\mylib.h(23): error C2146: syntax error : missing ')' before identifier 'current_client'
\mylib.h(23): error C2061: syntax error : identifier 'current_client'
\mylib.h(23): error C2059: syntax error : ';'
\mylib.h(23): error C2059: syntax error : ')'
\mylib.cpp(103): warning C4013: 'AcceptClient' undefined; assuming extern returning int
\mylib.cpp(168): warning C4013: 'recv_data' undefined; assuming extern returning int
\mylib.cpp(188): warning C4013: 'send_data' undefined; assuming extern returning int
\mylib.cpp(189): warning C4013: 'disconnect_client' undefined; assuming extern returning int
\mylib.cpp(270): error C2371: 'disconnect_client' : redefinition; different basic types
1> multiThreadServer.cpp
\mylib.h(8): error C2146: syntax error : missing ')' before identifier 'current_client'
1\mylib.h(8): error C2061: syntax error : identifier 'current_client'
\mylib.h(8): error C2059: syntax error : ';'
\mylib.h(8): error C2059: syntax error : ')'
\mylib.h(14): error C2146: syntax error : missing ')' before identifier 'current_client'
\mylib.h(14): error C2061: syntax error : identifier 'current_client'
\mylib.h(14): error C2059: syntax error : ';'
\mylib.h(14): error C2059: syntax error : ','
\mylib.h(14): error C2059: syntax error : ')'
\mylib.h(20): error C2146: syntax error : missing ')' before identifier 'current_client'
\mylib.h(20): error C2061: syntax error : identifier 'current_client'
\mylib.h(20): error C2059: syntax error : ';'
\mylib.h(20): error C2059: syntax error : ','
\mylib.h(20): error C2059: syntax error : ')'
\mylib.h(23): error C2146: syntax error : missing ')' before identifier 'current_client'
\mylib.h(23): error C2061: syntax error : identifier 'current_client'
\mylib.h(23): error C2059: syntax error : ';'
\mylib.h(23): error C2059: syntax error : ')'
I m searching 1.30 hour now on net but i cannot find a way to fix it.
What the problem could be ?
Alternatively to what's suggested here, you fix the problem in the header file without actually moving the definition of PCLIENT into the header:
...
struct _client;
...
// Accept Client.
BOOL AcceptClient(struct _client* current_client);
...
// Receive data from client.
BOOL recv_data(struct _client* current_client, char *buffer, int size);
...
// Send data.
BOOL send_data(struct _client* current_client, char *buffer, int size);
// Disconnect Client.
VOID disconnect_client(struct _client* current_client);
...

Visual C++ 2008 Boost Problem

Hey I'm using the C++ Communication Services Framework, which uses the Boost's Thread library.
I'm compiling one of their test projects (CSF's) and i'm getting a huge errors
The errors are in the Boost Bind library in file bind/mem_fn_template.hpp
EDIT: I installed Boost through the Boost installers provided by BoostPro
Here are few of the errors
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(146) : error C2332: 'class' : missing tag name
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(193) : see reference to class template instantiation 'boost::_mfi::mf1<R,T,A1>' being compiled
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(146) : error C2993: '' : illegal type for non-type template parameter '<unnamed-tag>'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(146) : error C2143: syntax error : missing ',' before 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(146) : error C2988: unrecognizable template declaration/definition
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(146) : error C2059: syntax error : 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(151) : error C2332: 'class' : missing tag name
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(151) : error C2993: '' : illegal type for non-type template parameter '<unnamed-tag>'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(151) : error C2143: syntax error : missing ',' before 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(151) : error C2988: unrecognizable template declaration/definition
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(151) : error C2059: syntax error : 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(210) : error C2332: 'class' : missing tag name
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(243) : see reference to class template instantiation 'boost::_mfi::cmf1<R,T,A1>' being compiled
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(210) : error C2993: '' : illegal type for non-type template parameter '<unnamed-tag>'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(210) : error C2143: syntax error : missing ',' before 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(210) : error C2988: unrecognizable template declaration/definition
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(210) : error C2059: syntax error : 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(215) : error C2332: 'class' : missing tag name
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(215) : error C2993: '' : illegal type for non-type template parameter '<unnamed-tag>'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(215) : error C2143: syntax error : missing ',' before 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(215) : error C2988: unrecognizable template declaration/definition
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(215) : error C2059: syntax error : 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(258) : error C2332: 'class' : missing tag name
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(305) : see reference to class template instantiation 'boost::_mfi::mf2<R,T,A1,A2>' being compiled
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(258) : error C2993: '' : illegal type for non-type template parameter '<unnamed-tag>'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(258) : error C2143: syntax error : missing ',' before 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(258) : error C2988: unrecognizable template declaration/definition
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(258) : error C2059: syntax error : 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(263) : error C2332: 'class' : missing tag name
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(263) : error C2993: '' : illegal type for non-type template parameter '<unnamed-tag>'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(263) : error C2143: syntax error : missing ',' before 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(263) : error C2988: unrecognizable template declaration/definition
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(263) : error C2059: syntax error : 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(320) : error C2332: 'class' : missing tag name
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(353) : see reference to class template instantiation 'boost::_mfi::cmf2<R,T,A1,A2>' being compiled
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(320) : error C2993: '' : illegal type for non-type template parameter '<unnamed-tag>'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(320) : error C2143: syntax error : missing ',' before 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(320) : error C2988: unrecognizable template declaration/definition
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(320) : error C2059: syntax error : 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(325) : error C2332: 'class' : missing tag name
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(325) : error C2993: '' : illegal type for non-type template parameter '<unnamed-tag>'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(325) : error C2143: syntax error : missing ',' before 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(325) : error C2988: unrecognizable template declaration/definition
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(325) : error C2059: syntax error : 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(368) : error C2332: 'class' : missing tag name
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(415) : see reference to class template instantiation 'boost::_mfi::mf3<R,T,A1,A2,A3>' being compiled
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(368) : error C2993: '' : illegal type for non-type template parameter '<unnamed-tag>'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(368) : error C2143: syntax error : missing ',' before 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(368) : error C2988: unrecognizable template declaration/definition
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(368) : error C2059: syntax error : 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(373) : error C2332: 'class' : missing tag name
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(373) : error C2993: '' : illegal type for non-type template parameter '<unnamed-tag>'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(373) : error C2143: syntax error : missing ',' before 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(373) : error C2988: unrecognizable template declaration/definition
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(373) : error C2059: syntax error : 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(430) : error C2332: 'class' : missing tag name
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(463) : see reference to class template instantiation 'boost::_mfi::cmf3<R,T,A1,A2,A3>' being compiled
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(430) : error C2993: '' : illegal type for non-type template parameter '<unnamed-tag>'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(430) : error C2143: syntax error : missing ',' before 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(430) : error C2988: unrecognizable template declaration/definition
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(430) : error C2059: syntax error : 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(435) : error C2332: 'class' : missing tag name
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(435) : error C2993: '' : illegal type for non-type template parameter '<unnamed-tag>'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(435) : error C2143: syntax error : missing ',' before 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(435) : error C2988: unrecognizable template declaration/definition
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(435) : error C2059: syntax error : 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(478) : error C2332: 'class' : missing tag name
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(525) : see reference to class template instantiation 'boost::_mfi::mf4<R,T,A1,A2,A3,A4>' being compiled
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(478) : error C2993: '' : illegal type for non-type template parameter '<unnamed-tag>'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(478) : error C2143: syntax error : missing ',' before 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(478) : error C2988: unrecognizable template declaration/definition
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(478) : error C2059: syntax error : 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(483) : error C2332: 'class' : missing tag name
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(483) : error C2993: '' : illegal type for non-type template parameter '<unnamed-tag>'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(483) : error C2143: syntax error : missing ',' before 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(483) : error C2988: unrecognizable template declaration/definition
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(483) : error C2059: syntax error : 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(540) : error C2332: 'class' : missing tag name
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(573) : see reference to class template instantiation 'boost::_mfi::cmf4<R,T,A1,A2,A3,A4>' being compiled
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(540) : error C2993: '' : illegal type for non-type template parameter '<unnamed-tag>'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(540) : error C2143: syntax error : missing ',' before 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(540) : error C2988: unrecognizable template declaration/definition
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(540) : error C2059: syntax error : 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(545) : error C2332: 'class' : missing tag name
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(545) : error C2993: '' : illegal type for non-type template parameter '<unnamed-tag>'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(545) : error C2143: syntax error : missing ',' before 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(545) : error C2988: unrecognizable template declaration/definition
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(545) : error C2059: syntax error : 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(588) : error C2332: 'class' : missing tag name
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(635) : see reference to class template instantiation 'boost::_mfi::mf5<R,T,A1,A2,A3,A4,A5>' being compiled
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(588) : error C2993: '' : illegal type for non-type template parameter '<unnamed-tag>'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(588) : error C2143: syntax error : missing ',' before 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(588) : error C2988: unrecognizable template declaration/definition
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(588) : error C2059: syntax error : 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(593) : error C2332: 'class' : missing tag name
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(593) : error C2993: '' : illegal type for non-type template parameter '<unnamed-tag>'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(593) : error C2143: syntax error : missing ',' before 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(593) : error C2988: unrecognizable template declaration/definition
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(593) : error C2059: syntax error : 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(650) : error C2332: 'class' : missing tag name
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(683) : see reference to class template instantiation 'boost::_mfi::cmf5<R,T,A1,A2,A3,A4,A5>' being compiled
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(650) : error C2993: '' : illegal type for non-type template parameter '<unnamed-tag>'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(650) : error C2143: syntax error : missing ',' before 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(650) : error C2988: unrecognizable template declaration/definition
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(650) : error C2059: syntax error : 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(655) : error C2332: 'class' : missing tag name
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(655) : error C2993: '' : illegal type for non-type template parameter '<unnamed-tag>'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(655) : error C2143: syntax error : missing ',' before 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(655) : error C2988: unrecognizable template declaration/definition
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(655) : error C2059: syntax error : 'constant'
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(698) : error C2332: 'class' : missing tag name
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(745) : see reference to class template instantiation 'boost::_mfi::mf6<R,T,A1,A2,A3,A4,A5,A6>' being compiled
C:\Program Files\boost\boost_1_39\boost/bind/mem_fn_template.hpp(698) : fatal error C1003: error count exceeds 100; stopping compilation
The offending line is
template<class U, class B1> R call(U & u, T const *, B1 & b1) const
Are you sure you don't have any macro named either U or B1? You can probably do search over all sources for '#define U' and '#define B1'.
The C++ Communication Services Framework hasn't been updated since 2005, whereas Boost::Thread has been updated frequently since then so it's possible that something's changed that has broken backwards compatibility. I'd suggest trying Boost 1.33 to see if it gives the same errors.