473,832 Members | 2,122 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dev-C++ Error Help

2 New Member
I'm a 14 year old student in Singapore. I am doing a programming for my Research Studies in school, I got the source codes of my programme from my mentor in the National University of Singapore Infocomm Research department. However, when I tried to compile the codes, I get the error message that says: "no matching function for call to `Englingo::addE nglingo(std::ve ctor<int, std::allocator< int> >)' "

The error is in the Englingo.cpp:
#include "Englingo.h "


/*************** *************** *************** *************** ************
*
* constructor
*
*************** *************** *************** *************** ************/
Englingo::Engli ngo(Utility *utilPtr)
{
m_putil = utilPtr;
}


/*************** *************** *************** *************** ************
*
* create lingo table from input file
*
*************** *************** *************** *************** ************/
void Englingo::creat eLingoTbl(void)
{
ifstream inFile("text\\E nglingo", ios::in);

if (!inFile) {
cout << "file opening error: Englingo file\n";
} else {
while(!inFile.e of()) {
addEnglingo(sca nSMS2(m_putil->readSMS(inFile )));
}
}

inFile.close();
}


/*************** *************** *************** *************** ************
*
* enter a pair of lingo into lingo table
*
*************** *************** *************** *************** ************/
void Englingo::addEn glingo(vector<i nt>& tokenArray)
{
vector<int> tokens;

for(int i = 2; i<tokenArray.si ze(); i++) {
tokens.push_bac k(tokenArray[i]);
}

m_putil->addLingo(token Array[0], m_putil->getCombinedTok en(tokens));
}


vector<int> Englingo::scanS MS2(const string& message)
{
vector<int> wordMap;
string aToken;
int indexS=0, indexE=0, pos=0;

while(message[pos]!='\0')
{
// skip space
if (isspace(messag e[pos])) {
while(isspace(m essage[pos]))
pos++;

// punctuations token except '
} else if ((ispunct(messa ge[pos]))&&(message[pos]!='\'')) {
indexS = pos;
while(ispunct(m essage[pos]))
pos++;

indexE = pos;
aToken = message.substr( indexS, indexE-indexS);
wordMap.push_ba ck(m_putil->insertVocab(aT oken));
}

//texts token and ' and unknow chars
else {
indexS = pos;

while(!(isspace (message[pos]))&&!(ispunct(m essage[pos]))
&&(message[pos]!=0)&&(message[pos]!= EOF)||(message[pos]=='\''))
pos++;

indexE = pos;
aToken = message.substr( indexS, indexE-indexS);
m_putil->toLowerCase(aT oken);
wordMap.push_ba ck(m_putil->insertVocab(aT oken));
}
}

return wordMap;
}

I have also included the Englingo.h and Utility.h needed for this cpp file, as well as the compiler log.

Englingo.h:
#ifndef ENGLINGO_H
#define ENGLINGO_H

#include <Utility.h>

using namespace std;

class Englingo {

public:

Englingo(Utilit y*);

void createLingoTbl( void);

private:

void addEnglingo(vec tor<int>& tokenArray);
vector<int> scanSMS2(const string& message);

Utility* m_putil;
};

#endif


Utility.h:
#ifndef UTILITY_H
#define UTILITY_H

#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <fstream>
#include <algorithm>

#define MAX_OFFSET 5
using namespace std;

class Utility {

public:

typedef struct {
vector<int> rawSMS;
vector<int> norSMS;
} TextPair;

typedef struct
{
int rawIndex;
int norIndex;
} IndexPair;

typedef map<string, int> VocabTable;
typedef map<int, int> LingoTable;

Utility();

string readSMS(ifstrea m& ifs);
void scanSMS(const string& message, vector<int>& tkArray);

int getCombinedToke n(vector<int> tokens);
vector<string> splitStr(const string& str);
vector<int> splitToken(int tokenID);
string trimStr(const string& rawStr);
int toLowerCase(int tokenID);
void toLowerCase(str ing& token);
int getVocabID(stri ng vocab);
string lookupVocab(int vocabID);
int insertVocab(str ing word);
bool compareTokens(i nt rTokenID, int nTokenID);
bool hasMatchToken(c onst Utility::TextPa ir& textPair, Utility::IndexP air low, Utility::IndexP air& high);
void addLingo(int frontID, int lingoID);
vector<int> lookupLingo(int tokenID);
bool hasLingo(const Utility::TextPa ir& textPair, Utility::IndexP air low, vector<int>& lingo);

private:

bool checkFollowedTo kens(const Utility::TextPa ir& textPair, int rIndex, int nIndex, int nBegin);
bool compareNextBoun dary(const Utility::TextPa ir& textPair, int rIndex, int nIndex, int nBegin);
bool compareSimilari ty(const Utility::TextPa ir& textPair, int rIndex, int nIndex, int nBegin);
bool compareLingo(co nst Utility::TextPa ir& textPair, int rIndex, int nBegin);
bool compareLingoTok ens(const Utility::TextPa ir& textPair, const vector<int>& tokens, int nBegin);
bool compareMultiLin goTokens(const Utility::TextPa ir& textPair, vector<int>& tokens, int nBegin);
void copyLingo(vecto r<int>& lingo, const vector<int>& sepTokens);

static int m_wordUID;
VocabTable m_vocabTable;
vector<string> m_vocabList;
LingoTable m_lingoTable;
};
bool space(char c);
bool notSpace(char c);
#endif

Compiler Log:
Compiler: Default compiler
Building Makefile: "E:\Yuki\Resear ch Studies\Trainin g\Makefile.win"
Executing make...
make.exe -f "E:\Yuki\Resear ch Studies\Trainin g\Makefile.win" all
g++.exe -c Englingo.cpp -o Englingo.o -I"E:/Yuki/Dev-Cpp/lib/gcc/mingw32/3.4.2/include" -I"E:/Yuki/Dev-Cpp/include/c++/3.4.2/backward" -I"E:/Yuki/Dev-Cpp/include/c++/3.4.2/mingw32" -I"E:/Yuki/Dev-Cpp/include/c++/3.4.2" -I"E:/Yuki/Dev-Cpp/include" -I"E:/Yuki/Research Studies/Training" -I"E:/Yuki/Research Studies" -D__GNUWIN32__ -W -DWIN32 -DNDEBUG -D_CONSOLE -D_MBCS

Englingo.cpp: In member function `void Englingo::creat eLingoTbl()':
Englingo.cpp:28 : error: no matching function for call to `Englingo::addE nglingo(std::ve ctor<int, std::allocator< int> >)'
Englingo.h:18: note: candidates are: void Englingo::addEn glingo(std::vec tor<int, std::allocator< int> >&)

Englingo.cpp: In member function `void Englingo::addEn glingo(std::vec tor<int, std::allocator< int> >&)':
Englingo.cpp:45 : warning: comparison between signed and unsigned integer expressions

make.exe: *** [Englingo.o] Error 1

Execution terminated


Can anyone help me please?
May 24 '06 #1
2 7478
Banfa
9,065 Recognized Expert Moderator Expert
The problem is here

Expand|Select|Wrap|Line Numbers
  1. void Englingo::createLingoTbl(void)
  2. {
  3.     ifstream inFile("text\\Englingo", ios::in);
  4.  
  5.     if (!inFile) {
  6.         cout << "file opening error: Englingo file\n";
  7.     } else {
  8.         while(!inFile.eof()) {
  9.             addEnglingo(scanSMS2(m_putil->readSMS(inFile)));
  10.         }
  11.     }
  12.  
  13.     inFile.close();
  14. }
  15.  
scanSMS2 returns type vector<int> but addEnglingo expects type vector<int> & in theory this seems ok but in practice it doesn't work properly (at least not with my compiler) I think because the return value of scanSMS2 is just on the stack but not a declared variable. I think this will work if you change this function to

Expand|Select|Wrap|Line Numbers
  1. void Englingo::createLingoTbl(void)
  2. {
  3.     ifstream inFile("text\\Englingo", ios::in);
  4.  
  5.     if (!inFile) {
  6.         cout << "file opening error: Englingo file\n";
  7.     } else {
  8.         while(!inFile.eof()) {
  9.             vector<int> temp = scanSMS2(m_putil->readSMS(inFile));
  10.             addEnglingo(temp);
  11.         }
  12.     }
  13.  
  14.     inFile.close();
  15. }
  16.  
although I am not 100% sure what has caused the problem in the first place.
May 24 '06 #2
pretear_yuki
2 New Member
yep, it solved the problem. Thanx!
May 24 '06 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
9795
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9642
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9320
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7753
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6951
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5624
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5789
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4421
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3972
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.