Problems with "error: invalid conversion from `const char*' to `char*' "
Hi, I need some help. I tried to install obs-ns. Itīs based on ns2, but when I ran "make", the problem below appears... please I wish anybody would help me.
This is the error: Code:
OBS/ns-2/integrated_agent.h: In constructor `BurstManager::BurstManager()': And this is the code of the program... Code:
int BurstManager::nhops(nsaddr_t src,nsaddr_t des) { |
Look for the declaration (it should be char *ni; or a similar thing at the top of the function or file. If it has some global significance it might be defined in the matching .h file instead of the .c file. The cause of the problem might lie in that declaration.
|
Quote:
But that error looks easy enough to correct, so try correcting it. That might just move down to the next error. But it's worth a try. Quote:
Code:
int BurstManager::nhops(nsaddr_t src,nsaddr_t des) { I greatly prefer char const* ni = tcl.result(); rather than const char *ni = tcl.result(); but they mean the same thing and the latter should be more obvious to a C++ beginner from the original code plus the error message. |
You might also want to check and see if there is a newer version of the package, or if a fix for your problem already exists. It is very rare that you're the only one to ever see a problem like that. Just my 2c.
|
Rather than try and debug the code, I would just check the documentation and verify the software requirements and make sure your versions all match up.
Good Luck Mark Schiltz |
Rather than try and debug the code, I would just check the documentation and verify the software requirements and make sure your versions all match up.
Good Luck Mark Schiltz |
Thanks guys
I use Fedora Core 3 and this software (obs-ns) was developed in 2000 or 2001. I didn't find a new version. I try to install in Fedora 9 and in Ubuntu 7.1 but it doesnīt work. Additionally, I use ns-allinone-2.31 with the most recently packages of all. I try this: char const *ni = tcl.result(); And this work, but I have more similar problems. Thanks for all, but I have more problems. |
Then yoy either need to
This is a relatively frequent problem because of bad programming practices sometimes. Each version of the compiler is, in general, stricter than the previous one in which regards the acknowledgment of the standads. |
Another problem with obs-ns
Hi again,
I resolved some problems but I have another problem: Code:
OBS/ns-2/stats.cc: In member function `virtual int StatCollector::command(int, const char* const*)': |
I don't think you mentioned which version of gcc you're using.
One detail became way pickier, (I think in version 4.3): You need the correct #include directives. In earlier versions, some include files brought in other definitions they weren't supposed to, so things like your example ofstream might be defined even thought the right #include isn't present. So you just need to add the right #include near the top of the .cc file. But I never learned how you're supposed to look up which is the right #include for a specific function. (Any experts here what to tell me that one?) My guess is the line you need to add is #include <fstream> |
I tried with
#include <fstream> But it doesnīt work The version of gcc is 3.4.2 this is the code: Code:
void StatCollector::dumpstats(const char *filename,const float parameter, float simtime,int nagents) { |
i am facing the same problem..will you help me??
|
All times are GMT -5. The time now is 06:33 PM. |