Visit the LQ Articles and Editorials section
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 08-26-2007, 04:02 AM   #1
Registered: Feb 2004
Location: Athens, Greece
Distribution: Gentoo,FreeBSD, Debian
Posts: 705

Rep: Reputation: 30
c++: "expected unqualified-id" newbie errors

This is

#include "FinancialProductsManager.h"
#include <iostream>
#include <string>

using namespace std;

FinancialProductsManager::bool insertProduct(string fproduct, double value)

FinancialProductsManager::bool removeProduct(string fproduct)

int main(int argc, const char* argv[]) 
    //cout << "testing the FinancialProductManager" << endl << "---------------------------------------------------";
and this is FinancialProductsManager.h:
#ifndef _FinancialProductsManager_H
#define	_FinancialProductsManager_H   

#include <hash_map.h>
#include <string>

using namespace std;

class FinancialProductsManager
        hash_map<string, int>  _financialProducts;
        bool insertProduct(string fproduct, double value);
        bool removeProduct(string fproduct);

When compiling with g++, i get
Running "rm -rf build/Debug/GNU-Generic/FinancialProductsManager.o" in /shared/kostas/10sem/programming/c++/arbigames

Clean successful. Exit value 0.

Running "make -f nbproject/ build/Debug/GNU-Generic/FinancialProductsManager.o" in /shared/kostas/10sem/programming/c++/arbigames

mkdir -p build/Debug/GNU-Generic
g++    -c -g -o build/Debug/GNU-Generic/FinancialProductsManager.o
In file included from /usr/include/c++/4.1.3/backward/hash_map.h:59,
                 from FinancialProductsManager.h:4,
/usr/include/c++/4.1.3/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <iostream> instead of the deprecated header <iostream.h>. To disable this warning use -Wno-deprecated.
In file included from
FinancialProductsManager.h:22:7: warning: no newline at end of file error: expected unqualified-id before ‘using’ error: expected unqualified-id before ‘bool’ error: expected unqualified-id before ‘bool’
make: *** [build/Debug/GNU-Generic/FinancialProductsManager.o] Error 1

Build failed. Exit value 2.
What's the problem?
Old 08-26-2007, 04:16 AM   #2
Registered: May 2003
Location: Bucharest,Romania
Distribution: Fedora Core 7
Posts: 109

Rep: Reputation: 15
There are a few errors, I might miss some because I just woke up.

So let's see

First .. in your .h file you're missing a ';' (semicolon) after the class declaration (e.g.: class X { .... }; )

Also the way you define your methods is wrong, the right way is:

return_value ClassName::methodname(params) {}

so where you have
FinancialProductsManager::bool insertProduct(string fproduct, double value)
you should change to:
bool FinancialProductsManager::insertProduct(string fproduct, double value)
The same goes for FinancialProductsManager::removeProduct

On another note if you do "using namespace std" in the header file ... you don't need to do it also in the .cc files that include it

Hope this helps ...


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
newbie question: whats the difference between "su root", "su" and "su -&quo mojarron Slackware 9 12-07-2009 04:08 PM
"NIM thread blocked" & "Deadman Switch (DMS) close to trigger" errors sosborne Linux - Networking 1 06-28-2006 02:07 PM
expected unqualified id Shwetha GS Linux - Software 0 10-21-2005 09:42 AM
FC4 install errors, "diabling IRQ #10" "nobody cares" error message??? A6Quattro Fedora 6 07-20-2005 12:49 PM

All times are GMT -5. The time now is 01:36 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration