Cosmin S
Cosmin S

Reputation: 93

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;

Upvotes: 6

Views: 1901

Answers (2)

John Dibling
John Dibling

Reputation: 101456

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
{
};

Upvotes: 4

Joe Z
Joe Z

Reputation: 17936

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.

Upvotes: 6

Related Questions