You are here:

C++/error message


hello, bill

do you know the meaning of the following error message??

error: expected unqualified-id before ‘using’

i get that error when i type in include "filename.h"
before the using namespace std;

i couldnt find any errors in my filename.h file, so i dont
know what that error means

any suggestions would help


p.s. im using g++ compiler in ubuntu


I would check that the syntax in filename.h is valid.  If you have an error at the end of it, when it returns to the main file and parses the using, that's when it will complain.

Unless g++ doesn't handle that statement, it has to be something before it, probably just before it.


---------- FOLLOW-UP ----------

hey, bill

that was really fast!!

just a question out of curiosity

what is the difference between this and *this??

if i have a function that returns the current object like

ClassName ClassName::functionName( //argument list ){

  return *this;

but why can't it be this instead of *this
isnt *this supposed to return a pointer???

thanks again

this is the pointer (just like char *p;  p is the pointer).  *this is the contents (like *p is the contents of p).

If you use return *this, the function has to return a reference.  By the way, a return of *this for a reference is the same as return this for a return of a non-reference.



All Answers

Answers by Expert:

Ask Experts


Bill A


I can answer questions about C++, programming algorithms, Windows programming in MFC (which is C++). I cannot answer questions about STL (templates) and I have no experience with Linux. I do enjoy reviewing code and critiquing it or finding problems in it. I will also gladly show better algorithms or methods if you want to take advantage of that.


I've developed a commercial embedded C compiler/assembler and IDE with debugger toolset, of which the IDE and debugger are written in C++. I work in the industry writing high tech embedded programs and Windows programs to communicate with the embedded devices.

Book: Embedded Systems Design using the Rabbit 3000 Microprocessor Authored Chapter 10 in its entirety.

BS Computer Engineering

©2017 All rights reserved.