boost asio compilation error with async functions - c++

I want to create an async. server.
i succeed to do that, but now i want to bind async_read/asyn_write functions to caller object function. So i tried to do that with boost::function
here you have my code :
Server.cpp
#include "Server.h"
#include "Client.h"
#include "Network.h"
void Server::accept(void)
{
Network::ptr connection = Network::create(this->my_acceptor.get_io_service());
this->my_acceptor.async_accept(connection->getSocket(), bind(&Server::endCmd, this, connection, placeholders::error));
}
void Server::endCmd(Network::ptr connection, const boost::system::error_code& error)
{
if (!error)
{
std::cout << "Recu un client!" << std::endl;
this->client.push_back(new Client(connection));
this->client[client.size() - 1]->checkAuthentification();
std::cout << "Envoie du message de securisation" << std::endl;
std::cout << "Nouvelle ecoute" << std::endl;
this->accept();
}
}
Client.h and .cpp
#include "Network.h"
class Client
{
private:
Network::ptr connection;
public:
Client(Network::ptr);
~Client();
void checkAuthentification(void);
void endRead(const error_code& error, size_t nbytes);
void endWrite(const error_code &error);
};
#include "Client.h"
Client::Client(Network::ptr connect)
{
this->connection = connect;
this->connection->assignFunction(this);
}
Client::~Client()
{
this->connection->close();
}
void Client::checkAuthentification(void)
{
this->connection->Swrite("BIENVENUE", this);
}
void Client::endRead(const error_code& error, size_t nbytes)
{
if (!error && nbytes != 0)
{
std::cout << this->connection->getRcvMsg() << std::endl;
this->connection->Sread(this);
}
else
this->connection->close();
}
void Client::endWrite(const error_code &error)
{
if (!error)
this->connection->Sread(this);
else
this->connection->close();
}
and Network.cpp and .h
#include "Client.h"
class Network : public boost::enable_shared_from_this<Network>
{
private:
tcp::socket socket;
std::string rcv_msg;
std::string msg;
boost::array<char, 6> rbuffer;
boost::function<void (Client *, const error_code &, size_t)> fread;
boost::function<void (Client *, const error_code &)> fwrite;
public:
typedef boost::shared_ptr<Network> ptr;
Network(io_service &);
~Network();
void assignFunction(void);
void close(void);
void Sread(Client *cli);
void Swrite(std::string msg, Client *cli);
tcp::socket& getSocket(void);
std::string getRcvMsg(void);
static ptr create(io_service &);
};
#include "Client.h"
#include "Network.h"
Network::Network(io_service &ios) : socket(ios)
{
}
Network::~Network()
{
this->close();
}
void Network::assignFunction(void)
{
this->fread = &Client::endRead;
this->fwrite = &Client::endWrite;
}
void Network::close(void)
{
if (this->socket.is_open())
{
std::cout << "Connection closed" << std::endl;
this->socket.close();
}
}
void Network::Sread(Client *cli)
{
async_read(this->socket, buffer(this->rbuffer), bind(&Network::fread, cli, placeholders::error, placeholders::bytes_transferred));
}
void Network::Swrite(std::string msg, Client *cli)
{
this->msg = msg;
async_write(this->socket, buffer(this->msg, (int)this->msg.size()), bind(&Network::fwrite, cli, placeholders::error));
}
std::string Network::getRcvMsg(void)
{
return (std::string(this->rbuffer.c_array(), this->rbuffer.size()));
}
tcp::socket& Network::getSocket(void)
{
return (this->socket);
}
Network::ptr Network::create(io_service &ios)
{
return (ptr(new Network(ios)));
}
When i want to compile that, i have the following errors :
Client.h(10): error C2653: 'Network' : is not a class or namespace name
Client.h(10): error C2146: syntax error : missing ';' before identifier 'connection'
Client.h(10): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
Client.h(10): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
Client.h(13): error C2653: 'Network' : is not a class or namespace name
Client.h(13): error C2653: 'Network' : is not a class or namespace name
Client.h(13): error C2460: 'Client::ptr' : uses 'Client', which is being defined
Client.h(8) : see declaration of 'Client'
1>Client.cpp(6): error C2511: 'Client::Client(Network::ptr)' : overloaded member function not found in 'Client'
Client.h(8) : see declaration of 'Client'
1>Client.cpp(13): error C2039: 'connection' : is not a member of 'Client'
Client.h(8) : see declaration of 'Client'
1>Client.cpp(13): error C2227: left of '->close' must point to class/struct/union/generic type
1>Client.cpp(18): error C2039: 'connection' : is not a member of 'Client'
Client.h(8) : see declaration of 'Client'
1>Client.cpp(18): error C2227: left of '->Swrite' must point to class/struct/union/generic type
1>Client.cpp(25): error C2039: 'connection' : is not a member of 'Client'
Client.h(8) : see declaration of 'Client'
1>Client.cpp(25): error C2227: left of '->getRcvMsg' must point to class/struct/union/generic type
1>Client.cpp(26): error C2039: 'connection' : is not a member of 'Client'
Client.h(8) : see declaration of 'Client'
1>Client.cpp(26): error C2227: left of '->Sread' must point to class/struct/union/generic type
1>Client.cpp(29): error C2039: 'connection' : is not a member of 'Client'
Client.h(8) : see declaration of 'Client'
1>Client.cpp(29): error C2227: left of '->close' must point to class/struct/union/generic type
1>Client.cpp(35): error C2039: 'connection' : is not a member of 'Client'
Client.h(8) : see declaration of 'Client'
1>Client.cpp(35): error C2227: left of '->Sread' must point to class/struct/union/generic type
1>Client.cpp(37): error C2039: 'connection' : is not a member of 'Client'
Client.h(8) : see declaration of 'Client'
1>Client.cpp(37): error C2227: left of '->close' must point to class/struct/union/generic type
Commande.cpp
main.cpp
Client.h(10): error C2653: 'Network' : is not a class or namespace name
Client.h(10): error C2146: syntax error : missing ';' before identifier 'connection'
Client.h(10): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
Client.h(10): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
Client.h(13): error C2653: 'Network' : is not a class or namespace name
Client.h(13): error C2653: 'Network' : is not a class or namespace name
Client.h(13): error C2460: 'Client::ptr' : uses 'Client', which is being defined
Client.h(8) : see declaration of 'Client'
My_exception.cpp
Network.cpp
Network.h(14): error C2065: 'Client' : undeclared identifier
Network.h(14): error C2059: syntax error : ','
Network.h(15): error C2065: 'Client' : undeclared identifier
Network.h(15): error C2059: syntax error : ','
Network.h(25): error C2065: 'Client' : undeclared identifier
Network.h(25): error C2065: 'cli' : undeclared identifier
Network.h(25): error C2143: syntax error : missing ',' before ')'
Network.h(29): error C2143: syntax error : missing ';' before '}'
Client.h(8): error C2143: syntax error : missing ';' before '{'
Client.h(18): error C2143: syntax error : missing ';' before '}'
1>Network.cpp(6): error C2143: syntax error : missing ';' before '{'
1>Network.cpp(7): error C2143: syntax error : missing ';' before '}'
1>Network.cpp(10): error C2143: syntax error : missing ';' before '{'
1>Network.cpp(12): error C2143: syntax error : missing ';' before '}'
1>Network.cpp(15): error C2143: syntax error : missing ';' before '{'
1>Network.cpp(16): error C2653: 'Client' : is not a class or namespace name
1>Network.cpp(17): error C2653: 'Client' : is not a class or namespace name
1>Network.cpp(18): error C2143: syntax error : missing ';' before '}'
1>Network.cpp(21): error C2143: syntax error : missing ';' before '{'
1>Network.cpp(23): error C2143: syntax error : missing ';' before '{'
1>Network.cpp(26): error C2143: syntax error : missing ';' before '}'
1>Network.cpp(27): error C2143: syntax error : missing ';' before '}'
1>Network.cpp(30): error C2143: syntax error : missing ';' before '{'
1>Network.cpp(31): error C2355: 'this' : can only be referenced inside non-static member functions
1>Network.cpp(31): error C2227: left of '->rbuffer' must point to class/struct/union/generic type
1>Network.cpp(31): error C2065: 'cli' : undeclared identifier
1>Network.cpp(31): error C2143: syntax error : missing ',' before ')'
1>Network.cpp(32): error C2143: syntax error : missing ';' before '}'
1>Network.cpp(35): error C2065: 'Client' : undeclared identifier
1>Network.cpp(35): error C2065: 'cli' : undeclared identifier
1>Network.cpp(35): error C2143: syntax error : missing ',' before ')'
1>Network.cpp(36): error C2143: syntax error : missing ';' before '{'
1>Network.cpp(38): error C2355: 'this' : can only be referenced inside non-static member functions
1>Network.cpp(38): error C2227: left of '->msg' must point to class/struct/union/generic type
1>Network.cpp(38): error C2355: 'this' : can only be referenced inside non-static member functions
1>Network.cpp(38): error C2227: left of '->msg' must point to class/struct/union/generic type
1>Network.cpp(38): error C2228: left of '.size' must have class/struct/union
1>Network.cpp(38): error C2065: 'cli' : undeclared identifier
1>Network.cpp(38): error C2143: syntax error : missing ',' before ')'
1>Network.cpp(39): error C2143: syntax error : missing ';' before '}'
1>Network.cpp(42): error C2143: syntax error : missing ';' before '{'
1>Network.cpp(43): error C2355: 'this' : can only be referenced inside non-static member functions
1>Network.cpp(43): error C2227: left of '->rbuffer' must point to class/struct/union/generic type
1>Network.cpp(43): error C2228: left of '.size' must have class/struct/union
1>Network.cpp(43): error C2143: syntax error : missing ',' before ')'
1>Network.cpp(44): error C2143: syntax error : missing ';' before '}'
1>Network.cpp(47): error C2143: syntax error : missing ';' before '{'
1>Network.cpp(49): error C2143: syntax error : missing ';' before '}'
1>Network.cpp(52): error C2143: syntax error : missing ';' before '{'
1>Network.cpp(54): error C2143: syntax error : missing ';' before '}'
1>Network.cpp(55): error C2143: syntax error : missing ';' before '}'
1>Network.cpp(55): fatal error C1004: unexpected end-of-file found
Server.cpp
Client.h(10): error C2653: 'Network' : is not a class or namespace name
Client.h(10): error C2146: syntax error : missing ';' before identifier 'connection'
Client.h(10): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
Client.h(10): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
Client.h(13): error C2653: 'Network' : is not a class or namespace name
Client.h(13): error C2653: 'Network' : is not a class or namespace name
Client.h(13): error C2460: 'Client::ptr' : uses 'Client', which is being defined
Client.h(8) : see declaration of 'Client'
1>Server.cpp(22): error C2664: 'Client::Client(const Client &)' : cannot convert parameter 1 from 'Network::ptr' to 'const Client &'
Reason: cannot convert from 'Network::ptr' to 'const Client'
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
After so many hours of "googlings" and reflexion, i didn't found why i have these errors.
Anyone can help me plz ?

Mmm.. Maybe you have left them out but you failed to include the headers:
Edit That seems to obvious. If it's not that then
Edit 2 Note that these suggestions have been typed when full information about the include structure wasn't given. The problems has been resolved now, but these hints are good general troubleshooting advice whenever strange issues arise with the compiler not 'seeing' your declarations:
check precompiled header settings (disable them, e.g.)
check you header include guards (if they are incorrect, e.g.
#ifndef __NETWORK_H
#define __NETWORK_H
...
#endif // __NETWORK_H
in your Client.h...
check namespace issues
accidentally declared Network in a namespace
included Network.h from within a namespace { ... } block
check preprocessor issues (#defines wreaking havoc?)
Server.cpp
include "Network.h"
include "Server.h"
//....
Client.cpp
include "Network.h"
include "Server.h"
Network.cpp
include "Network.h"
And probably (form looking at the errors):
Client.h
include "Network.h"
too

In Network.h, do not include Client.h, but instead forward declare class Client.

Related

Intel pin and chrono conflicts

I try to measure the runtime of the program using Intel Pin. For this purpose I include chrono in my project. However It is not going to compile well. It gives a lot of errors. Furthermore, I tried to include chrono to many standart Intel Pin examples - the same result.
Could you please help me to solve errors below?
ratio(24,32): error C2143: syntax error: missing ',' before '<'
ratio(25): message : see reference to class template instantiation 'std::_Abs<_Val>' being compiled
ratio(30,38): error C2143: syntax error: missing ',' before '<'
ratio(31): message : see reference to class template instantiation 'std::_Safe_mult<_Ax,_Bx,_Sfinae,_Good>' being compiled
ratio(40,36): error C2143: syntax error: missing ',' before '<'
ratio(41): message : see reference to class template instantiation 'std::_Sign_of<_Val>' being compiled
ratio(45,38): error C2143: syntax error: missing ',' before '<'
ratio(46): message : see reference to class template instantiation 'std::_Safe_addX<_Ax,_Bx,_Good,_Also_good>' being compiled
ratio(50,44): error C2760: syntax error: unexpected token ',', expected 'expression'
ratio(51): message : see reference to class template instantiation 'std::_Safe_addX<_Ax,_Bx,false,false>' being compiled
ratio(65,41): error C2143: syntax error: missing ',' before '<'
ratio(66): message : see reference to class template instantiation 'std::_GcdX<_Ax,0>' being compiled
ratio(74,2): error C2504: 'integral_constant': base class undefined
ratio(74,38): error C2143: syntax error: missing ',' before '<'
ratio(158,5): error C2065: 'void_t': undeclared identifier
ratio(158,1): error C2226: syntax error: unexpected type 'std::_Ratio_multiply<_R1,_R2>::_Num::type'
ratio(159,1): error C2988: unrecognizable template declaration/definition
ratio(159,1): error C2059: syntax error: '>'
ratio(159,58): error C2143: syntax error: missing ';' before '{'
ratio(159,58): error C2447: '{': missing function header (old-style formal list?)
ratio(186,35): error C2143: syntax error: missing ',' before '<'
ratio(188): message : see reference to class template instantiation 'std::ratio_equal<_R1,_R2>' being compiled
ratio(195,39): error C2143: syntax error: missing ',' before '<'
ratio(197): message : see reference to class template instantiation 'std::ratio_not_equal<_R1,_R2>' being compiled
ratio(252,34): error C2143: syntax error: missing ',' before '<'
ratio(254): message : see reference to class template instantiation 'std::ratio_less<_R1,_R2>' being compiled
ratio(261,40): error C2143: syntax error: missing ',' before '<'
ratio(263): message : see reference to class template instantiation 'std::ratio_less_equal<_R1,_R2>' being compiled
ratio(279,43): error C2143: syntax error: missing ',' before '<'
ratio(282): message : see reference to class template instantiation 'std::ratio_greater_equal<_R1,_R2>' being compiled
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\corecrt.h(512,39): error C2371: 'wint_t': redefinition; different basic types
1>E:\Tools\source\pin\extras\crt\include\wchar.h(52): message : see declaration of 'wint_t'
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\corecrt.h(513,39): error C2371: 'wctype_t': redefinition; different basic types
1>E:\Tools\source\pin\extras\crt\include\wchar.h(77): message : see declaration of 'wctype_t'
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\corecrt.h(538,19): error C2371: 'mbstate_t': redefinition; different basic types
1>E:\Tools\source\pin\extras\crt\include\wchar.h(58): message : see declaration of 'mbstate_t'
1>C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\corecrt.h(552,28): error C2371: 'time_t': redefinition; different basic types
1>E:\Tools\source\pin\extras\crt\include\sys\types.h(91): message : see declaration of 'time_t'
vcruntime_new.h(34,26): error C2011: 'std::nothrow_t': 'struct' type redefinition
1>E:\Tools\source\pin\extras\libstdc++\include\new(10): message : see declaration of 'std::nothrow_t'
vcruntime_new.h(168,5): error C2084: function 'void *operator new(size_t,void *)' already has a body
1>E:\Tools\source\pin\extras\libstdc++\include\new(36): message : see previous definition of 'new'
vcruntime_new.h(174,5): error C2084: function 'void operator delete(void *,void *) throw()' already has a body
1>E:\Tools\source\pin\extras\libstdc++\include\new(40): message : see previous definition of 'delete'
vcruntime_new.h(184,5): error C2084: function 'void *operator new[](size_t,void *)' already has a body
1>E:\Tools\source\pin\extras\libstdc++\include\new(37): message : see previous definition of 'new[]'
vcruntime_new.h(190,5): error C2084: function 'void operator delete[](void *,void *) throw()' already has a body
1>E:\Tools\source\pin\extras\libstdc++\include\new(41): message : see previous definition of 'delete[]'
xtimec.h(28,15): error C2144: syntax error: 'int' should be preceded by ';'
xtimec.h(28,19): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
xtimec.h(30,15): error C2144: syntax error: 'long' should be preceded by ';'
xtimec.h(30,20): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
xtimec.h(30,1): error C2086: 'int _CRTIMP2': redefinition
xtimec.h(28): message : see declaration of '_CRTIMP2'
xtimec.h(31,15): error C2144: syntax error: 'long' should be preceded by ';'
xtimec.h(31,20): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
xtimec.h(31,1): error C2086: 'int _CRTIMP2': redefinition
xtimec.h(28): message : see declaration of '_CRTIMP2'
xtimec.h(32,15): error C2144: syntax error: '__int64' should be preceded by ';'
xtimec.h(32,25): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
xtimec.h(32,1): error C2086: 'int _CRTIMP2': redefinition
xtimec.h(28): message : see declaration of '_CRTIMP2'
xtimec.h(36,15): error C2144: syntax error: '__int64' should be preceded by ';'
xtimec.h(36,25): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
xtimec.h(36,1): error C2086: 'int _CRTIMP2': redefinition
xtimec.h(28): message : see declaration of '_CRTIMP2'
xtimec.h(37,15): error C2144: syntax error: '__int64' should be preceded by ';'
xtimec.h(37,25): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
xtimec.h(37,1): error C2086: 'int _CRTIMP2': redefinition
xtimec.h(28): message : see declaration of '_CRTIMP2'
chrono(28,55): error C2143: syntax error: missing ',' before '<'
chrono(29): message : see reference to class template instantiation 'std::chrono::treat_as_floating_point<_Rep>' being compiled
chrono(96,43): error C2143: syntax error: missing ';' before '<'
chrono(171): message : see reference to class template instantiation 'std::chrono::duration<_Rep,_Period>' being compiled
chrono(96,1): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
chrono(96,30): error C2126: 'std::chrono::duration<_Rep,_Period>::common_type_t' cannot be declared with 'constexpr' specifier
chrono(96,1): warning C4869: 'nodiscard' may only be applied to classes, enumerations, and functions
chrono(97,1): error C2334: unexpected token(s) preceding '{'; skipping apparent function body
chrono(101,43): error C2143: syntax error: missing ';' before '<'
chrono(101,1): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
chrono(101,30): error C2126: 'std::chrono::duration<_Rep,_Period>::common_type_t' cannot be declared with 'constexpr' specifier
chrono(101,1): warning C4869: 'nodiscard' may only be applied to classes, enumerations, and functions
chrono(102,1): error C2334: unexpected token(s) preceding '{'; skipping apparent function body
chrono(223,24): error C2143: syntax error: missing ',' before '<'
chrono(224): message : see reference to class template instantiation 'std::_Lcm<_Ax,_Bx>' being compiled
chrono(228,19): error C2988: unrecognizable template declaration/definition
chrono(228,19): error C2143: syntax error: missing ';' before '<'
chrono(228,19): error C2059: syntax error: '<'
chrono(228,37): error C2065: '_Rep1': undeclared identifier
chrono(228,44): error C2065: '_Period1': undeclared identifier
chrono(228,28): error C2923: 'std::chrono::duration': '_Rep1' is not a valid template type argument for parameter '_Rep'
chrono(228,28): error C2923: 'std::chrono::duration': '_Period1' is not a valid template type argument for parameter '_Period'
chrono(229,22): error C2065: '_Rep2': undeclared identifier
chrono(229,29): error C2065: '_Period2': undeclared identifier
chrono(229,13): error C2923: 'std::chrono::duration': '_Rep2' is not a valid template type argument for parameter '_Rep'
chrono(229,13): error C2923: 'std::chrono::duration': '_Period2' is not a valid template type argument for parameter '_Period'
chrono(229,40): error C2143: syntax error: missing ';' before '{'
chrono(229,40): error C2447: '{': missing function header (old-style formal list?)
chrono(235,8): error C2976: 'std::common_type': too few template arguments
chrono(228): message : see declaration of 'std::common_type'
chrono(238,2): error C2976: 'std::common_type': too few template arguments
chrono(236): message : see declaration of 'std::common_type'
chrono(243,39): error C2988: unrecognizable template declaration/definition
chrono(243,39): error C2143: syntax error: missing ';' before '<'
chrono(243,16): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
chrono(243,39): error C2059: syntax error: '<'
chrono(243,49): error C2065: '_Rep1': undeclared identifier
chrono(243,56): error C2065: '_Period1': undeclared identifier
chrono(243,40): error C2923: 'std::chrono::duration': '_Rep1' is not a valid template type argument for parameter '_Rep'
chrono(243,40): error C2923: 'std::chrono::duration': '_Period1' is not a valid template type argument for parameter '_Period'
chrono(243,76): error C2065: '_Rep2': undeclared identifier
chrono(243,83): error C2065: '_Period2': undeclared identifier
chrono(243,67): error C2923: 'std::chrono::duration': '_Rep2' is not a valid template type argument for parameter '_Rep'
chrono(243,67): error C2923: 'std::chrono::duration': '_Period2' is not a valid template type argument for parameter '_Period'
chrono(244,34): error C2065: '_Rep1': undeclared identifier
chrono(244,41): error C2065: '_Period1': undeclared identifier
chrono(244,25): error C2923: 'std::chrono::duration': '_Rep1' is not a valid template type argument for parameter '_Rep'
chrono(244,25): error C2923: 'std::chrono::duration': '_Period1' is not a valid template type argument for parameter '_Period'
chrono(244,74): error C2065: '_Rep2': undeclared identifier
chrono(244,81): error C2065: '_Period2': undeclared identifier
chrono(244,65): error C2923: 'std::chrono::duration': '_Rep2' is not a valid template type argument for parameter '_Rep'
chrono(244,65): error C2923: 'std::chrono::duration': '_Period2' is not a valid template type argument for parameter '_Period'
chrono(245,81): error C2143: syntax error: missing ';' before '{'
chrono(245,81): error C2447: '{': missing function header (old-style formal list?)
chrono(251,39): error C2988: unrecognizable template declaration/definition
chrono(251,39): error C2143: syntax error: missing ';' before '<'
chrono(251,16): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
chrono(251,26): error C2374: 'std::chrono::common_type_t': redefinition; multiple initialization
chrono(243): message : see declaration of 'std::chrono::common_type_t'
chrono(251,39): error C2059: syntax error: '<'
chrono(251,49): error C2065: '_Rep1': undeclared identifier
chrono(251,56): error C2065: '_Period1': undeclared identifier
chrono(251,40): error C2923: 'std::chrono::duration': '_Rep1' is not a valid template type argument for parameter '_Rep'
chrono(251,40): error C2923: 'std::chrono::duration': '_Period1' is not a valid template type argument for parameter '_Period'
chrono(251,76): error C2065: '_Rep2': undeclared identifier
chrono(251,83): error C2065: '_Period2': undeclared identifier
chrono(251,67): error C2923: 'std::chrono::duration': '_Rep2' is not a valid template type argument for parameter '_Rep'
chrono(251,67): error C2923: 'std::chrono::duration': '_Period2' is not a valid template type argument for parameter '_Period'
chrono(252,34): error C2065: '_Rep1': undeclared identifier
chrono(252,41): error C2065: '_Period1': undeclared identifier
chrono(252,25): error C2923: 'std::chrono::duration': '_Rep1' is not a valid template type argument for parameter '_Rep'
chrono(252,25): error C2923: 'std::chrono::duration': '_Period1' is not a valid template type argument for parameter '_Period'
chrono(252,74): error C2065: '_Rep2': undeclared identifier
chrono(252,81): error C2065: '_Period2': undeclared identifier
chrono(252,1): fatal error C1003: error count exceeds 100; stopping compilation

EnterCriticalSection identifier not found

Ok, I'm compiling a project that is using the Chromium Embedded Framework 3. I'm using Windows 7 64-bit with Visual Studio 2013 RC. Officially, VS2013 RC is not supported by CEF3. However, I require VS2013 due to C++11 features that are only available in VS2013.
I downloaded the CEF3 64 bit binaries, and compiled their sample application using VS2013. It worked beautifully (although I had to add the <algorithm> header file to some of the cef3 header files).
Now, when I include some of the CEF3 files into my project, I'm getting a bunch of compile errors. I'm using SCons to compile my project. It looks almost like some variables and defines are not getting set/called when the CEF3 header file(s) include the <windows.h> header file...
The errors are:
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
cl /Fobuild\gui\GUI.obj /c src\gui\GUI.cpp /TP /w /wd4350 /EHsc /MD /DDEBUG /DPACKAGE_VERSION=\"0.0.1\" /DPACKAGE_BUGREPORT=\"https://github.com/jarrettchisholm/glr/issues\" /DBOOST_SPIRIT_USE_PHOENIX_V3
cl /Fobuild\gui\HtmlGuiComponent.obj /c src\gui\HtmlGuiComponent.cpp /TP /w /wd4350 /EHsc /MD /DDEBUG /DPACKAGE_VERSION=\"0.0.1\" /DPACKAGE_BUGREPORT=\"https://github.com/jarrettchisholm/glr/issues\" /DBOOST_SPIRIT_USE_PHOENIX_V3
GUI.cpp
HtmlGuiComponent.cpp
cl /Fobuild\models\ModelManager.obj /c src\models\ModelManager.cpp /TP /w /wd4350 /EHsc /MD /DDEBUG /DPACKAGE_VERSION=\"0.0.1\" /DPACKAGE_BUGREPORT=\"https://github.com/jarrettchisholm/glr/issues\" /DBOOST_SPIRIT_USE_PHOENIX_V3
ModelManager.cpp
cl /Fobuild\glw\Animation.obj /c src\glw\Animation.cpp /TP /w /wd4350 /EHsc /MD /DDEBUG /DPACKAGE_VERSION=\"0.0.1\" /DPACKAGE_BUGREPORT=\"https://github.com/jarrettchisholm/glr/issues\" /DBOOST_SPIRIT_USE_PHOENIX_V3
Animation.cpp
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_types_win.h(55) : error C2146: syntax error : missing ';' before identifier 'instance'
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_types_win.h(55) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_types_win.h(70) : error C2146: syntax error : missing ';' before identifier 'parent_window'
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_types_win.h(70) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_types_win.h(71) : error C2146: syntax error : missing ';' before identifier 'menu'
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_types_win.h(71) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_types_win.h(86) : error C2146: syntax error : missing ';' before identifier 'window'
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_types_win.h(86) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_types.h(83) : error C2371: 'char16' : redefinition; different basic types
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_string_types.h(51) : see declaration of 'char16'
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(65) : error C2146: syntax error : missing ';' before identifier 'm_sec'
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(65) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(52) : error C2065: 'm_sec' : undeclared identifier
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(52) : error C2065: 'CRITICAL_SECTION' : undeclared identifier
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(52) : error C2070: 'unknown-type': illegal sizeof operand
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(53) : error C2065: 'm_sec' : undeclared identifier
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(53) : error C3861: 'InitializeCriticalSection': identifier not found
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(56) : error C2065: 'm_sec' : undeclared identifier
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(56) : error C3861: 'DeleteCriticalSection': identifier not found
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(59) : error C2065: 'm_sec' : undeclared identifier
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(59) : error C3861: 'EnterCriticalSection': identifier not found
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(62) : error C2065: 'm_sec' : undeclared identifier
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(62) : error C3861: 'LeaveCriticalSection': identifier not found
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(84) : error C2039: 'instance' : is not a member of '_cef_main_args_t'
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_types_win.h(54) : see declaration of '_cef_main_args_t'
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_types_win.h(54) : see declaration of '_cef_main_args_t'
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(96) : error C2061: syntax error : identifier 'HINSTANCE'
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(96) : error C2535: 'CefMainArgs::CefMainArgs(void)' : member function already defined or declared
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(93) : see declaration of 'CefMainArgs::CefMainArgs'
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(97) : error C2065: 'instance' : undeclared identifier
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(97) : error C2065: 'hInstance' : undeclared identifier
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(120) : error C2039: 'parent_window' : is not a member of '_cef_window_info_t'
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_types_win.h(61) : see declaration of '_cef_window_info_t'
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_types_win.h(61) : see declaration of '_cef_window_info_t'
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(121) : error C2039: 'menu' : is not a member of '_cef_window_info_t'
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_types_win.h(61) : see declaration of '_cef_window_info_t'
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_types_win.h(61) : see declaration of '_cef_window_info_t'
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(122) : error C2039: 'window' : is not a member of '_cef_window_info_t'
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_types_win.h(61) : see declaration of '_cef_window_info_t'
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_types_win.h(61) : see declaration of '_cef_window_info_t'
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(139) : error C2061: syntax error : identifier 'HWND'
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(149) : error C2061: syntax error : identifier 'HWND'
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(165) : error C2061: syntax error : identifier 'HWND'
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(140) : error C2065: 'WS_CHILD' : undeclared identifier
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(140) : error C2065: 'WS_CLIPCHILDREN' : undeclared identifier
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(140) : error C2065: 'WS_CLIPSIBLINGS' : undeclared identifier
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(140) : error C2065: 'WS_TABSTOP' : undeclared identifier
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(141) : error C2065: 'WS_VISIBLE' : undeclared identifier
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(142) : error C2065: 'parent_window' : undeclared identifier
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(142) : error C2065: 'hWndParent' : undeclared identifier
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(143) : error C2065: 'windowRect' : undeclared identifier
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(143) : error C2228: left of '.left' must have class/struct/union
type is 'unknown-type'
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(144) : error C2065: 'windowRect' : undeclared identifier
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(144) : error C2228: left of '.top' must have class/struct/union
type is 'unknown-type'
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(145) : error C2065: 'windowRect' : undeclared identifier
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(145) : error C2228: left of '.right' must have class/struct/union
type is 'unknown-type'
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(145) : error C2228: left of '.left' must have class/struct/union
type is 'unknown-type'
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(146) : error C2065: 'windowRect' : undeclared identifier
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(146) : error C2228: left of '.bottom' must have class/struct/union
type is 'unknown-type'
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(146) : error C2228: left of '.top' must have class/struct/union
type is 'unknown-type'
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(150) : error C2065: 'WS_OVERLAPPEDWINDOW' : undeclared identifier
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(150) : error C2065: 'WS_CLIPCHILDREN' : undeclared identifier
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(150) : error C2065: 'WS_CLIPSIBLINGS' : undeclared identifier
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(151) : error C2065: 'WS_VISIBLE' : undeclared identifier
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(152) : error C2065: 'parent_window' : undeclared identifier
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(152) : error C2065: 'hWndParent' : undeclared identifier
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(153) : error C2065: 'CW_USEDEFAULT' : undeclared identifier
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(154) : error C2065: 'CW_USEDEFAULT' : undeclared identifier
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(155) : error C2065: 'CW_USEDEFAULT' : undeclared identifier
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(156) : error C2065: 'CW_USEDEFAULT' : undeclared identifier
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(158) : error C2065: 'windowName' : undeclared identifier
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(158) : error C2228: left of '.c_str' must have class/struct/union
type is 'unknown-type'
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(158) : error C2228: left of '.length' must have class/struct/union
type is 'unknown-type'
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(158) : error C2660: 'cef_string_utf16_set' : function does not take 3 arguments
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(167) : error C2065: 'parent_window' : undeclared identifier
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(167) : error C2065: 'hWndParent' : undeclared identifier
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/cef_base.h(98) : error C3861: 'InterlockedIncrement': identifier not found
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/cef_base.h(105) : error C3861: 'InterlockedDecrement': identifier not found
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/cef_browser.h(287) : error C2146: syntax error : missing ';' before identifier 'GetWindowHandle'
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/cef_browser.h(287) : error C2433: 'CefBrowserHost::HWND' : 'virtual' not permitted on data declarations
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/cef_browser.h(287) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/cef_browser.h(295) : error C2146: syntax error : missing ';' before identifier 'GetOpenerWindowHandle'
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/cef_browser.h(295) : error C2433: 'CefBrowserHost::HWND' : 'virtual' not permitted on data declarations
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/cef_browser.h(295) : error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/cef_browser.h(468) : error C2061: syntax error : identifier 'MSG'
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/cef_browser.h(474) : error C2061: syntax error : identifier 'MSG'
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/cef_browser.h(287) : error C2253: 'CefBrowserHost::GetWindowHandle' : pure specifier or abstract override specifier only allowed on virtual function
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/cef_browser.h(295) : error C2253: 'CefBrowserHost::GetOpenerWindowHandle' : pure specifier or abstract override specifier only allowed on virtual function
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/cef_keyboard_handler.h(59) : error C2061: syntax error : identifier 'MSG'
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/cef_keyboard_handler.h(71) : error C2061: syntax error : identifier 'MSG'
C:\Users\Jarrett\projects\cef_binary_3.1547.1412_windows64\include/cef_render_handler.h(129) : error C2061: syntax error : identifier 'HCURSOR'
src\gui\HtmlGuiComponent.cpp(179) : error C2082: redefinition of formal parameter 'clickCount'
scons: building terminated because of errors.
Some errors that jump out at me are:
\cef_binary_3.1547.1412_windows64\include/internal/cef_win.h(59) : error C3861: 'EnterCriticalSection': identifier not found
But this should be found, as cef_win.h clearly includes <windows.h> before it tries to call EnterCriticalSection.
There are various other errors that seem like they shouldn't be occuring.
I created a simple little sample file, which includes that same CEF3 header files that my project uses, and compiled using SCons, and it compiled just fine. The sample app is below:
/* Sample C/C++, Windows, link to kernel32.dll */
#include <cef_app.h>
#include <cef_client.h>
#include <cef_render_handler.h>
static CRITICAL_SECTION cs; /* This is the critical section object -- once initialized,
it cannot be moved in memory */
/* If you program in OOP, declare this as a non-static member in your class */
void f()
{
/* Enter the critical section -- other threads are locked out */
EnterCriticalSection(&cs);
/* Do some thread-safe processing! */
/* Leave the critical section -- other threads can now EnterCriticalSection() */
LeaveCriticalSection(&cs);
}
int main()
{
/* Initialize the critical section before entering multi-threaded context. */
InitializeCriticalSection(&cs);
f();
/* Release system object when all finished -- usually at the end of the cleanup code */
DeleteCriticalSection(&cs);
return 0;
}
Anyone have any ideas why I would be getting these errors?
as per comments: windows.h file wasn't included, because other script defined _WINDOWS_

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.

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);
...