Thread: Error: expected unqualified-id before 'using'

  1. #1
    In the Land of Diddly-Doo g4j31a5's Avatar
    Join Date
    Jul 2006
    Posts
    476

    Error: expected unqualified-id before 'using'

    Hi, I've encountered this weird problem. When I compiled the project, it returned this error:

    error: expected unqualified-id before 'using'
    The weird thing is I didn't do anything to the class where the error occured. Yet the error appeared. I tried to clean build the project but the error is still there.

    When I tried to comment the 'using' line, there's another error. But this time it's not the same error. The error was:

    error: multiple types in one declaration
    The error was inside the bracket of the class (or more accurately the last bracket). Can anybody help me here?

    BTW, for the code:
    Code:
    #include "SDL_mixer.h"
    #include <string>
    
    //using namespace std; //The first error occured here
    
    class CMusik
    { 
    public:
    	unsigned int getHandle();
    	std::string getNama();
    	Mix_Music* getData();
    	CMusik();
    	CMusik(char* folder, char* file, char* nama, unsigned int handle);
    	virtual ~CMusik();
    	void setVolume(int vol);
    
    private:
    	unsigned int mHandle;
    	int mStateMusik; //0=stopped;1=paused;2=played
    	Mix_Music* mDataMusik;
    	std::string mNamaMusik;
    }; //The second error

  2. #2
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    You are probably missing a semi-colon after the last bracket in SDL_mixer.h, if it is closing a class definition.
    Originally Posted by brewbuck:
    Reimplementing a large system in another language to get a 25% performance boost is nonsense. It would be cheaper to just get a computer which is 25% faster.

  3. #3
    Its hard... But im here swgh's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,688
    if you comment out using namespace std the compiler cannot find the string object, ie: std::string even if you included the string library header. That may be why the second error occiured, the first could have somthing to do with before namespace std wsa read, try looking in the header file ".h" for an error a mis-match

  4. #4
    In the Land of Diddly-Doo g4j31a5's Avatar
    Join Date
    Jul 2006
    Posts
    476
    Well, I've reverted back to my code few days ago (thank God I've backed up the code.) and it compiled just fine. Sadly though my work today and yesterday was gone. Thanks anyway.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. unqualified name in template
    By George2 in forum C++ Programming
    Replies: 10
    Last Post: 03-11-2008, 03:48 AM
  2. qualified name and unqualified name
    By George2 in forum C++ Programming
    Replies: 8
    Last Post: 03-07-2008, 08:41 AM