Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Missing ";" before 'namespace' and ";" before 'using'

So I am working on a program that is due tomorrow and for some reason I keep getting this 2 errors, if I click on the first one it takes me to the iostream file and right before the _STD_BEGIN it wants me to put ";" but if I do that it messes up the file in the library so I am pretty sure I do not have to do that, the second error is in my main.cpp and it points to using namespace std; and it wants me to put a ";" before it =, if I do so the error disappears and it keeps pointing at the iostream error.... I have no idea what to do and my deadline is tomorrow. This is my main.cpp include section with the modification to using namespace std

#include "stdafx.h"
#include <iostream>
#include <iomanip>
#include <cstdlib>
#include <stdio.h>
#include "Package.h"
;using namespace std;
like image 937
Cosmin S Avatar asked Dec 19 '13 15:12

Cosmin S


2 Answers

Look for a class or struct definition in Package.h that's missing its semicolon. ie.

class act
{
    // yadda
}  // no semicolon here

Then add the missing semicolon.

like image 64
Joe Z Avatar answered Sep 21 '22 21:09

Joe Z


When you get a "missing ;type error on a line that follows closeley behind a bunch of#includestatements, the likely culprit is a missing;` in one of the header files. To find out which, start at the last include file, Package.h. You'll surely find a missing semicolon there. It's probably missing after a class declaration, as if you had written:

class Foo
{
}

instead of

class Foo
{
};
like image 4
John Dibling Avatar answered Sep 23 '22 21:09

John Dibling