LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 09-01-2006, 04:37 AM   #1
aral
Member
 
Registered: Aug 2005
Posts: 115

Rep: Reputation: 15
errors &constructor pseudo return


Why do I get the errors :" ./rmt.cpp: In function `int main()':
../rmt.cpp:14: error: no matching function for call to `CMesQueue::CMesQueue(int&)'
../CMesQueue.hpp:27: note: candidates are: CMesQueue::CMesQueue(const CMesQueue&)
../CMesQueue.hpp:50: note: CMesQueue::CMesQueue() "

for the code below (I pointed the two errors with a comment in the code)?
Also , is there a way to make the constructor to modify a member variable like qid from the class CMesQueue ?, so I can put the code from the method " int CMesQueue::msg_create(std::string filepath)" in the constructor ? If the constructor could return something then I could simply make it return the qid .. but the constructor cannot return anything .. so how can I put the code from that method I mentioned above in the constructor ? and ..somehow be able to return the qid variable to the member variable qid, so other meehods (which i'll add) like send , receive can use it ..
Thank you !

#ifndef CMESQUEUE_HPP_
#define CMESQUEUE_HPP_

#include <sys/msg.h>
#include <sys/ipc.h>

#include <string>

#include <sys/types.h>
#include <stdio.h>

#include <string.h>

#include <iostream>

struct mymsgbuf{
long mtype;
char mtext[50];
pid_t pid;
};

using namespace std;

class CMesQueue
{ //error:note:"../CMesQueue.hpp:27: note: candidates are: CMesQueue::CMesQueue(const CMesQueue&)"
public:
CMesQueue();
//CMesQueue(int,std::string);
~CMesQueue();
//int CMesQueue::msg_create(char fname[50]);

int CMesQueue::msg_create(std::string filepath);

/*
* ID_2
*/
struct mymsgbuf qbuf;
int qid;


protected:
private:


};
CMesQueue::CMesQueue()
{ //error : "../CMesQueue.hpp:50: note: CMesQueue::CMesQueue() "
}
CMesQueue::~CMesQueue()
{
int a;
a=msgctl(qid,IPC_RMID,0);
}
int CMesQueue::msg_create(std::string filepath)
{
key_t mykey=ftok(filepath.c_str(),'b');
if((qid=msgget(IPC_PRIVATE,IPC_CREAT|0660))==-1) perror("eroare msgget");
return qid;
}
 
Old 09-01-2006, 04:54 AM   #2
aral
Member
 
Registered: Aug 2005
Posts: 115

Original Poster
Rep: Reputation: 15
I solved the error. Just answer my other question please.
 
  


Reply



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
not calling copy constructor on function return jhorvath Programming 7 09-22-2009 12:43 PM
How to add pseudo-terminals to /dev directory (Mandrake 10.1 & udev) blubery Mandriva 1 08-06-2005 12:46 PM
Regarding Pseudo tty, Pseudo terminals ? mqureshi Programming 0 07-30-2005 10:51 AM
cdrecord and K3B return errors the_rhino Fedora 19 01-02-2005 08:46 PM
constructor return type macro-linux Programming 2 11-12-2003 01:29 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:32 AM.

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