async_write method error - c++

void Chat::Send(uint8_t* buffer, int length){
boost::asio::async_write(socket_,boost::asio::buffer(buffer,length),
boost::bind(&Chat:Send, this,boost::asio::placeholders::error));
}
it should work like this tutorial. But when I try to build the project I get the following errors
Error 1 error C2825: 'F': must be a class or namespace when followed by '::' e:\boost_1_46_1\boost_1_46_1\boost\bind\bind.hpp 69
Error 2 error C2039: 'result_type' : is not a member of '`global namespace'' e:\boost_1_46_1\boost_1_46_1\boost\bind\bind.hpp 69
Error 3 error C2146: syntax error : missing ';' before identifier 'type' e:\boost_1_46_1\boost_1_46_1\boost\bind\bind.hpp 69
Error 4 error C2208: 'boost::_bi::type' : no members defined using this type e:\boost_1_46_1\boost_1_46_1\boost\bind\bind.hpp 69
Error 5 error C1903: unable to recover from previous error(s); stopping compilation e:\boost_1_46_1\boost_1_46_1\boost\bind\bind.hpp 69
I am not even using 'F' why it's keep saying 'F': must be a class or namespace when followed by '::'?

boost::bind(&Chat:Send, this,boost::asio::placeholders::error));
^^^^^^
should be
boost::bind(&Chat::Send, this,boost::asio::placeholders::error));
^^^^^^
note the scope resolution operator for class Chat. The compiler errors that can be encountered when using boost::bind are very confusing.

Related

including freetype-gl.h causes wglew errors

I've integrated all the needed files to use freetype-gl.hdirectly into my OpenGL project, but when I try to build the program, I receive 262 errors complaining aboutwglew.h. A sample of the errors:
error C2143: syntax error : missing ')' before '*' c:\bar\includes\glew110\include\gl\wglew.h 113 1 Foo
error C2143: syntax error : missing ';' before '*' c:\bar\glew110\include\gl\wglew.h 113 1 Foo
error C2059: syntax error : ')' c:\bar\includes\glew110\include\gl\wglew.h 113 1 Foo
error C2065: 'HDC' : undeclared identifier c:\bar\glew110\include\gl\wglew.h 113 1 Foo
error C2146: syntax error : missing ')' before identifier 'hDC' c:\bar\includes\glew110\include\gl\wglew.h 113 1 Foo
And in my class, just this header causes the problem with wglew.h:
#include "freetype-gl.h" // causes all the errors
This solution solved a wglew error for me, not sure if it's the same problem.
Try adding the wglew.h include line to the same file as your other include line for freetype-gl.h, and in this order:
#include <Windows.h> // maybe not needed
#define GLEW_STATIC // maybe not needed
#include "GL/glew.h"
#include "GL/wglew.h"
#include "freetype-gl.h"
// other includes below

Getting string compile errors in visual studio using the boost string lib

i am trying to make a program that reads from an ini file but in Visual Studio I keep getting compile errors about string identifiers and semicolons in the wrong place. I am not very good at C++ so it's most likely something really simple, but any way here is the code and error list.
INI.h
#ifndef INI_H
#define INI_H
#include <boost/property_tree/ptree.hpp>
#include <boost/property_tree/ini_parser.hpp>
#include <boost/algorithm/string.hpp>
#include <iostream>
string INIreader(const string&, const string&);
#endif
INI_readnwrite.cpp
#include "INI.h"
using boost::property_tree::ptree;
string INIreader(const string& section, const string& name)
{
ptree pt;
read_ini("GameSettings.ini", pt);
string value = pt.get<string>("section.name");
return value;
}
mainCode.cpp
#include "INI.h"
using namespace std;
int main()
{
string sec = "gameSettings";
string val = "resXY";
cout << INIreader(sec, val);
}
And here is the error list
error// file// line//
error C2872: 'string' : ambiguous symbol maincode.cpp 18
error C2146: syntax error : missing ';' before identifier 'sec' maincode.cpp 18
error C2065: 'sec' : undeclared identifier maincode.cpp 18
error C2872: 'string' : ambiguous symbol maincode.cpp 19
error C2146: syntax error : missing ';' before identifier 'val' maincode.cpp 19
error C2065: 'val' : undeclared identifier maincode.cpp 19
error C2065: 'val' : undeclared identifier maincode.cpp 20
error C2065: 'sec' : undeclared identifier maincode.cpp 20
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int ini_readnwrite.cpp 6
error C2872: 'string' : ambiguous symbol ini_readnwrite.cpp 6
error C2146: syntax error : missing ';' before identifier 'INIreader' ini_readnwrite.cpp 6
error C2143: syntax error : missing ',' before '&' ini_readnwrite.cpp 6
error C2086: 'int string' : redefinition ini_readnwrite.cpp 6
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int ini_readnwrite.cpp 7
error C2974: 'boost::property_tree::basic_ptree<std::string,std::string,std::less<Key>>::get' : invalid template argument for 'Type', type expected ini_readnwrite.cpp 10
error C2974: 'boost::property_tree::basic_ptree<std::string,std::string,std::less<Key>>::get' : invalid template argument for 'Ch', type expected ini_readnwrite.cpp 10
error C2146: syntax error : missing ';' before identifier 'value' ini_readnwrite.cpp 10
error C2065: 'value' : undeclared identifier ini_readnwrite.cpp 10
error C2065: 'value' : undeclared identifier ini_readnwrite.cpp 11
IntelliSense: identifier "string" is undefined INI.h 9
IntelliSense: identifier "string" is undefined INI.h 9
IntelliSense: identifier "string" is undefined INI.h 9
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int ini.h 9
error C4430: missing type specifier - int assumed. Note: C++ does not support default-int ini.h 9
error C2146: syntax error : missing ';' before identifier 'INIreader' ini.h 9
error C2146: syntax error : missing ';' before identifier 'INIreader' ini.h 9
error C2143: syntax error : missing ',' before '&' ini.h 9
error C2143: syntax error : missing ',' before '&' ini.h 9
Thanks.
You need to use the fully qualified name when you attempt to use std::string in your header file:
std::string INIreader(const std::string&, const std::string&);
And do the same thing in INI_readnwrite.cpp, or add a "using" directive like you did in the other .cpp file:
using boost::property_tree::ptree;
using namespace std;

Can't compile boost/any_iterator.hpp in boost 1.57

After (attempting to) upgrade a VS2012 project to use boost 1.57, I can no longer compile--lots and lots of error messages coming out of boost/any_iterator.hpp (see below). As a test, I created a new project that contained nothing but an empty main function and #include "boost/any_iterator.hpp" and got the same set of errors. Here is the code it's complaining about:
// snippet from boost/any_iterator.hpp
template<
class Value
, class Traversal
, class Reference
, class Difference
, class Buffer
>
class postfix_increment_proxy<
range_detail::any_iterator< // line 131
Value
, Traversal
, Reference
, Difference
, Buffer
>
>
{
// ...
};
There is another class in the same file that follows the same pattern and generates identical errors. range_detail::any_iterator is forward-declared a little higher up in the file:
namespace range_detail
{
// ...
template<
class Value
, class Traversal
, class Reference
, class Difference
, class Buffer = any_iterator_default_buffer
>
class any_iterator;
// ...
}
For what it's worth, here's the set of errors I get from VS2012:
Error 1 error C2143: syntax error : missing ';' before '<' [path]\boost\range\detail\any_iterator.hpp 131
Error 2 error C2059: syntax error : '<' [path]\boost\range\detail\any_iterator.hpp 131
Error 3 error C2065: 'Value' : undeclared identifier [path]\boost\range\detail\any_iterator.hpp 134
Error 4 error C2065: 'Traversal' : undeclared identifier [path]\boost\range\detail\any_iterator.hpp 135
Error 5 error C2065: 'Reference' : undeclared identifier [path]\boost\range\detail\any_iterator.hpp 136
Error 6 error C2065: 'Difference' : undeclared identifier [path]\boost\range\detail\any_iterator.hpp 137
Error 7 error C2065: 'Buffer' : undeclared identifier [path]\boost\range\detail\any_iterator.hpp 138
Error 8 error C2923: 'boost::range_detail::any_iterator' : 'Value' is not a valid template type argument for parameter 'Value' [path]\boost\range\detail\any_iterator.hpp 138
Error 9 error C2923: 'boost::range_detail::any_iterator' : 'Traversal' is not a valid template type argument for parameter 'Traversal' [path]\boost\range\detail\any_iterator.hpp 138
Error 10 error C2923: 'boost::range_detail::any_iterator' : 'Reference' is not a valid template type argument for parameter 'Reference' [path]\boost\range\detail\any_iterator.hpp 138
Error 11 error C2923: 'boost::range_detail::any_iterator' : 'Difference' is not a valid template type argument for parameter 'Difference' [path]\boost\range\detail\any_iterator.hpp 138
Error 12 error C2923: 'boost::range_detail::any_iterator' : 'Buffer' is not a valid template type argument for parameter 'Buffer' [path]\boost\range\detail\any_iterator.hpp 138
Error 13 error C2143: syntax error : missing ';' before '{' [path]\boost\range\detail\any_iterator.hpp 140
Error 14 error C2447: '{' : missing function header (old-style formal list?) [path]\boost\range\detail\any_iterator.hpp 140
Is anyone aware of a workaround?
This appears to be a bug in the boost codebase. postfix_increment_proxy and writable_postfix_increment_proxy are both in the boost::iterators::detail namespace (iterator_facade.hpp). However, both names are used unqualified in any_iterator.hpp. Adding boost::iterators::detail:: in front of both names allows the code to compile.
For anyone who's uncomfortable with the idea of editing boost code, including iterator_facade.hpp followed by using namespace boost::iterators::detail followed by an include for any_iterator.hpp will also solve the problem at the cost of namespace pollution. VS2012 doesn't support them so it doesn't do me any good, but you could presumably use a C++11 using too.
Ticket submitted:
https://svn.boost.org/trac/boost/ticket/10754

VS2010 IntelliSense says: CComPtr is not a template

I have encountered a problem when I was trying to write a directshow-based livestream player as an ActiveX control.
I first created a MFC ActiveX control project with VS2010 (under VC++ category),
and attached a dialog on the control, then tested it with a simple html page.
So far it works well, but when I tried to add some directshow codes with CComPtr,
the compiler shows the following errors (I've also attached the line numbers and files):
29 IntelliSense: CComPtr is not a template (CIceBaseLivestreamPlayerCore.h, Line 37)
30 IntelliSense: CComPtr is not a template (CIceBaseLivestreamPlayerCore.h, Line 38)
31 IntelliSense: CComPtr is not a template (CIceBaseLivestreamPlayerCore.h, Line 44)
32 IntelliSense: CComPtr is not a template (CIceBaseLivestreamPlayerCore.h, Line 44)
33 IntelliSense: CComPtr is not a template (CIceBaseLivestreamPlayerCore.h, Line 47)
34 IntelliSense: CComPtr is not a template (CIceBaseLivestreamPlayerCore.h, Line 48)
35 IntelliSense: CComPtr is not a template (CIceBaseLivestreamPlayerCore.h, Line 49)
36 IntelliSense: CComPtr is not a template (CIcePlayAndSaveAXCore.h, Line 19)
37 IntelliSense: CComPtr is not a template (CIcePlayAndSaveAXCore.h, Line 20)
38 IntelliSense: CComPtr is not a template (CIcePlayAndSaveAXCore.h, Line 21)
39 IntelliSense: CComPtr is not a template (CIcePlayAndSaveAXCore.h, Line 22)
Error 2 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int (CIceBaseLivestreamPlayerCore.h, Line 37)
Error 5 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int (CIceBaseLivestreamPlayerCore.h, Line 38)
Error 14 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int (CIcePlayAndSaveAXCore.h, Line 19)
Error 17 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int (CIcePlayAndSaveAXCore.h, Line 20)
Error 20 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int (CIcePlayAndSaveAXCore.h, Line 21)
Error 23 error C4430: missing type specifier - int assumed. Note: C++ does not support default-int (CIcePlayAndSaveAXCore.h, Line 22)
Error 25 error C2614: 'CIcePlayAndSaveAXCore' : illegal member initialization: 'm_vInfTee' is not a base or member (CIcePlayAndSaveAXCore.h, Line 9)
Error 27 error C2614: 'CIcePlayAndSaveAXCore' : illegal member initialization: 'm_fileWriter' is not a base or member (CIcePlayAndSaveAXCore.h, Line 9)
Error 28 error C2614: 'CIcePlayAndSaveAXCore' : illegal member initialization: 'm_AVIMux' is not a base or member (CIcePlayAndSaveAXCore.h, Line 9)
Error 26 error C2614: 'CIcePlayAndSaveAXCore' : illegal member initialization: 'm_aInfTee' is not a base or member (CIcePlayAndSaveAXCore.h, Line 9)
Error 12 error C2614: 'CIceBaseLivestreamPlayerCore' : illegal member initialization: 'm_pGraph' is not a base or member (CIceBaseLivestreamPlayerCore.h, Line 18)
Error 11 error C2614: 'CIceBaseLivestreamPlayerCore' : illegal member initialization: 'm_pControl' is not a base or member (CIceBaseLivestreamPlayerCore.h, Line 18)
Error 3 error C2238: unexpected token(s) preceding ';' (CIceBaseLivestreamPlayerCore.h, Line 37)
Error 6 error C2238: unexpected token(s) preceding ';' (CIceBaseLivestreamPlayerCore.h, Line 38)
Error 15 error C2238: unexpected token(s) preceding ';' (CIcePlayAndSaveAXCore.h, Line 19)
Error 18 error C2238: unexpected token(s) preceding ';' (CIcePlayAndSaveAXCore.h, Line 20)
Error 21 error C2238: unexpected token(s) preceding ';' (CIcePlayAndSaveAXCore.h, Line 21)
Error 24 error C2238: unexpected token(s) preceding ';' (CIcePlayAndSaveAXCore.h, Line 22)
Error 1 error C2143: syntax error : missing ';' before '<' (CIceBaseLivestreamPlayerCore.h, Line 37)
Error 4 error C2143: syntax error : missing ';' before '<' (CIceBaseLivestreamPlayerCore.h, Line 38)
Error 13 error C2143: syntax error : missing ';' before '<' (CIcePlayAndSaveAXCore.h, Line 19)
Error 16 error C2143: syntax error : missing ';' before '<' (CIcePlayAndSaveAXCore.h, Line 20)
Error 19 error C2143: syntax error : missing ';' before '<' (CIcePlayAndSaveAXCore.h, Line 21)
Error 22 error C2143: syntax error : missing ';' before '<' (CIcePlayAndSaveAXCore.h, Line 22)
Error 7 error C2061: syntax error : identifier 'CComPtr' (CIceBaseLivestreamPlayerCore.h, Line 44)
Error 8 error C2061: syntax error : identifier 'CComPtr' (CIceBaseLivestreamPlayerCore.h, Line 47)
Error 9 error C2061: syntax error : identifier 'CComPtr' (CIceBaseLivestreamPlayerCore.h, Line 48)
Error 10 error C2061: syntax error : identifier 'CComPtr' (CIceBaseLivestreamPlayerCore.h, Line 49)
And all these errors seem to specify that there is something weird with the CComPtr,
but I cannot figure out what's wrong.
I've added two header files in the bottom of my stdafx.h as following:
#include <streams.h>
#include <atlbase.h>
And I'll list part of my CIceBaseLivestreamPlayerCore.h and CIcePlayAndSaveAXCore.h as below, all the involved lines in the above errors are all included.
CIceBaseLivestreamPlayerCore.h:
#pragma once
#include "stdafx.h"
class CIceBaseLivestreamPlayerCore
{
...
15 CIceBaseLivestreamPlayerCore():
16 ..., m_pGraph(NULL), m_pControl(NULL),
17 ...
18 { ; }
...
37 CComPtr<IGraphBuilder> m_pGraph;
38 CComPtr<IMediaControl> m_pControl;
...
44 HRESULT ConnectFilters(CComPtr<IBaseFilter> pIn, CComPtr<IBaseFilter> pOut, const AM_MEDIA_TYPE& mType);
...
47 HRESULT MatchPin(CComPtr<IPin>, PIN_DIRECTION, BOOL, BOOL*);
48 HRESULT IsPinConnected(CComPtr<IPin>, BOOL*);
49 HRESULT IsPinDirection(CComPtr<IPin>, PIN_DIRECTION, BOOL*);
};
CIcePlayAndSaveAXCore.h:
#pragma once
#include "CIceBaseLivestreamPlayerCore.h"
class CIcePlayAndSaveAXCore : public CIceBaseLivestreamPlayerCore
{
...
7 CIcePlayAndSaveAXCore() :
8 m_AVIMux(NULL), m_fileWriter(NULL), m_aInfTee(NULL), m_vInfTee(NULL)
9 { ; }
...
19 CComPtr<IBaseFilter> m_AVIMux;
20 CComPtr<IBaseFilter> m_fileWriter;
21 CComPtr<IBaseFilter> m_aInfTee;
22 CComPtr<IBaseFilter> m_vInfTee;
};
Additional dependencies of my project is "strmbasd.lib;winmm.lib;uuid.lib;".
That's all.. Hope someone can give me the answer of how to solve it,
or just gives me any advice or suggestion as a direction of what I should do.
Any help is appreciated.
And this is my first time to post an English question (I'm not a native speaker though..),
so please let me know if I've anything lost or done something wrong as asking a question.
Thanks a lot. :)
After many times of trying I finally found the problem and got it solved.
I think I should put the result here, for there might be someone who has the same problem,
and is not knowing how to solve it like I was. I don't know if it's an etiquette offense of stackoverflow to answer my own question, so I will left this answer unaccepted.
As I've said, I've put #define <atlbase.h> into the bottom of my stdafx.h.
But because I'm making a MFC ActiveX control project, the IDE (VS 2010) auto generates a #define statement into my stdafx.h, which is #define _ATL_NO_AUTOMATIC_NAMESPACE.
And when we use #include <atlbase.h> in ordinary times, the compiler will perform using namespace ATL by default, but this #define _ATL_NO_AUTOMATIC_NAMESPACE statement cancels this behavior, which then caused the naming conflict that my compiler had said.
So, in this case, just use ATL::CComPtr for declarations or directly use using ATL::CComPtr statement in which CComPtr appears, and this compilation error will be eliminated.

How to find the "real" error?

I am having an enormous amount of errors showing up in the error list of the program, but none of the ones listed seem to be "real" errors. Some of the lines are red and then when I go to highlight over them the error disappears. I just can't seem to find where my error really is. What is the best process to go through to find my mistake?
Below is the error list in case that is helpful.
Error 38 error C1004: unexpected end-of-file found 85
Error 68 error C1004: unexpected end-of-file found 42
Error 63 error C1903: unable to recover from previous error(s); stopping compilation 72
Error 66 error C2059: syntax error : ')' 42
Error 2 error C2059: syntax error : '>' 80
Error 40 error C2059: syntax error : '>' 80
Error 65 error C2059: syntax error : '>' 42
Error 20 error C2065: '_Ptr_cerr' : undeclared identifier 27
Error 16 error C2065: '_Ptr_cin' : undeclared identifier 25
Error 22 error C2065: '_Ptr_clog' : undeclared identifier 28
Error 18 error C2065: '_Ptr_cout' : undeclared identifier 26
Error 28 error C2065: '_Ptr_wcerr' : undeclared identifier 32
Error 24 error C2065: '_Ptr_wcin' : undeclared identifier 30
Error 30 error C2065: '_Ptr_wclog' : undeclared identifier 33
Error 26 error C2065: '_Ptr_wcout' : undeclared identifier 31
Error 4 error C2065: 'faction' : undeclared identifier 84
Error 42 error C2065: 'faction' : undeclared identifier 84
Error 64 error C2065: 'Faction' : undeclared identifier 42
Error 13 error C2065: 'socialite' : undeclared identifier 100
Error 51 error C2065: 'socialite' : undeclared identifier 100
Error 1 error C2065: 'Socialite' : undeclared identifier 80
Error 12 error C2065: 'Socialite' : undeclared identifier 100
Error 39 error C2065: 'Socialite' : undeclared identifier 80
Error 50 error C2065: 'Socialite' : undeclared identifier 100
Error 8 error C2065: 'textWriter' : undeclared identifier 82
Error 46 error C2065: 'textWriter' : undeclared identifier 82
Error 6 error C2143: syntax error : missing ',' before ')' 84
Error 10 error C2143: syntax error : missing ',' before ')' 82
Error 14 error C2143: syntax error : missing ',' before ')' 100
Error 44 error C2143: syntax error : missing ',' before ')' 84
Error 48 error C2143: syntax error : missing ',' before ')' 82
Error 52 error C2143: syntax error : missing ',' before ')' 100
Error 17 error C2143: syntax error : missing ',' before ';' 25
Error 19 error C2143: syntax error : missing ',' before ';' 26
Error 21 error C2143: syntax error : missing ',' before ';' 27
Error 23 error C2143: syntax error : missing ',' before ';' 28
Error 25 error C2143: syntax error : missing ',' before ';' 30
Error 27 error C2143: syntax error : missing ',' before ';' 31
Error 29 error C2143: syntax error : missing ',' before ';' 32
Error 31 error C2143: syntax error : missing ',' before ';' 33
Error 7 error C2143: syntax error : missing ';' before '{' 32
Error 15 error C2143: syntax error : missing ';' before '{' 10
Error 32 error C2143: syntax error : missing ';' before '{' 36
Error 35 error C2143: syntax error : missing ';' before '{' 27
Error 45 error C2143: syntax error : missing ';' before '{' 32
Error 54 error C2143: syntax error : missing ';' before '{' 34
Error 57 error C2143: syntax error : missing ';' before '{' 48
Error 60 error C2143: syntax error : missing ';' before '{' 61
Error 3 error C2143: syntax error : missing ';' before '}' 82
Error 11 error C2143: syntax error : missing ';' before '}' 98
Error 33 error C2143: syntax error : missing ';' before '}' 42
Error 34 error C2143: syntax error : missing ';' before '}' 45
Error 36 error C2143: syntax error : missing ';' before '}' 83
Error 37 error C2143: syntax error : missing ';' before '}' 85
Error 41 error C2143: syntax error : missing ';' before '}' 82
Error 49 error C2143: syntax error : missing ';' before '}' 98
Error 55 error C2143: syntax error : missing ';' before '}' 43
Error 58 error C2143: syntax error : missing ';' before '}' 57
Error 61 error C2143: syntax error : missing ';' before '}' 69
Error 67 error C2143: syntax error : missing ';' before '}' 42
Error 5 error C2275: 'Faction' : illegal use of this type as an expression 84
Error 43 error C2275: 'Faction' : illegal use of this type as an expression 84
Error 9 error C2275: 'std::ofstream' : illegal use of this type as an expression 82
Error 47 error C2275: 'std::ofstream' : illegal use of this type as an expression 82
Error 53 error C2653: 'Socialite' : is not a class or namespace name 33
Error 56 error C2653: 'Socialite' : is not a class or namespace name 46
Error 59 error C2653: 'Socialite' : is not a class or namespace name 60
Error 62 error C2653: 'Socialite' : is not a class or namespace name 72
Probably a missing ; after the closing } of a class / struct. Could you post some code?
UPDATE: The code compiles now on my gcc. The problem I found is that you have a circular dependency between your classes. So solve this, forward declare some of them in the headers. I added class Faction; before class Socialite in Socialite.h and class Socialite; before class Faction in Faction.h.
Unexpected end of file is usually that you are missing a closing "something", such as a bracket } or parenthesis )
It's either a missing #endif or a ; at the end of a type definition or possibly a missing } at the end of a function.
Start with the first error reported. Often it's the cause of a lot of the subsequent problems because the first error causes the parser to be out of sync with the rest of the code.
In C++, long cascades of errors are often caused by an undeclared type (did you forget an include file?) or by a missing ; after a class or struct definition.
Consider:
Foobar fb; // Declare an instance of Foobar.
If Foobar hasn't been declared yet (perhaps because you forgot to include "foobar.h"), then the compiler might think you're trying to declare a variable named Foobar with a default type of int. From there, it sees the fb and gets all confused.
Or consider:
struct Foobar {
int x;
int y;
}
int blah = 0;
Without the ; after the struct definition, the parser thinks you're trying to declare an instance of Foobar named int, which isn't allowed since int is a reserved keyword. And everything after that looks like gobbledegook to the compiler.
One trick is to temporarily #if 0-out all the code after the line with the first reported error, as that will reduce the noise until you isolate the original problem.
If you look at the "Error List" window (View > Error List) it can be really hard to figure out where the errors originate. Luckily, there's another way:
Open the "Output" window (Debug > Windows > Output)
Compile and build
Start at the top of the "Output" window and work your way down the compiler/linker output text until you come to the first line that says "error"
This will usually lead you right to the problem.