Sirakov
Mitglied
Hallo,
ich kempfe schon wieder mit C++...da komme ich aber nicht zurecht. Kann mir jmd vielleicht sagen, was ich da falsch mache?
IMApplication.h
IMApplication.cc
Fehlt mir etw. bei dem Include vielleicht? Sorry....für die meisten von euch ist ja dumme Frage, aber ich komm wirklich nicht weiter
Und hier alle Fehlermeldungen, die ich beim Kompilieren bekomme:
Vielleicht helfen diese, um das Problem zu lokalisieren.
Gruß,
Sirakov
ich kempfe schon wieder mit C++...da komme ich aber nicht zurecht. Kann mir jmd vielleicht sagen, was ich da falsch mache?
IMApplication.h
C++:
/*
* IMApplication.h
*
* Created on: 03.12.2008
* Author: bufka
*/
#ifndef IMAPPLICATION_H_
#define IMAPPLICATION_H_
#include "app.h"
#include <stdio.h>
#include <iostream>
#include <ostream>
#include <string>
using namespace std;
class IMApplication;
class IMApplication : public Application {
public:
IMApplication();
void process_data(int, AppData*);
virtual int command(int argc, const char*const* argv);
protected:
virtual void recv(int nbytes);
// ID für den Knoten
unsigned long my_addr_;
// Unklar
static int first_probe_;
//Paketgröße
int p_size_;
};
#endif /* IMAPPLICATION_H_ */
IMApplication.cc
C++:
#include <string>
#include "IMApplication.h"
static class IMApplicationClass : public TclClass {
public:
IMApplicationClass() : TclClass("Application/IMApplication") {}
TclObject* create(int, const char*const*) {
return (new IMApplication());
}
} class_imapplication;
int IMApplication::first_probe_ = 0;
// Konstruktor
IMApplication::IMApplication() : Application() {
// TCL-variable für die Paketgröße
bind("paketSize", &p_size_);
}
int IMApplication::command(int argc, const char*const* argv) {
Tcl& tcl = Tcl::instance();
if (argc == 3) {
if (strcmp(argv[1], "attach-agent") == 0) {
agent_ = (Agent*) TclObject::lookup(argv[2]);
if (agent_ == 0) {
tcl.resultf("Der Agent %s gibt es nicht", argv[2]);
return(TCL_ERROR);
}
agent_->attachApp(this);
my_addr_ = agent_->addr();
// printf("%d\n", my_addr_);
printf("Erfolgreich", my_addr_);
return(TCL_OK);
}
}
return(Application::command(argc, argv));
}
void IMApplication::process_data(int nbytes, AppData* data) {
recv(nbytes);
}
void IMApplication::recv(int nbytes) {
if (!first_probe_) {
first_probe_ = 1;
printf("D FP %.2f\n", Scheduler::instance().clock());
}
}
Fehlt mir etw. bei dem Include vielleicht? Sorry....für die meisten von euch ist ja dumme Frage, aber ich komm wirklich nicht weiter

Und hier alle Fehlermeldungen, die ich beim Kompilieren bekomme:
Code:
apps/IMApplication.cc:10: Fehler: expected class-name before »{« token
apps/IMApplication.cc:13: Fehler: ISO-C++ verbietet Deklaration von »TclObject« ohne Typ
apps/IMApplication.cc:13: Fehler: expected »;« before »*« token
apps/IMApplication.cc:16: Fehler: expected `;' before »}« token
apps/IMApplication.cc: In constructor »IMApplicationClass::IMApplicationClass()«:
apps/IMApplication.cc:12: Fehler: Klasse »IMApplicationClass« hat keinen Feldnamen »TclClass«
apps/IMApplication.cc: In constructor »IMApplication::IMApplication()«:
apps/IMApplication.cc:23: Fehler: ungültige Umwandlung von »const char*« in »int«
apps/IMApplication.cc:23: Fehler: »int*« kann nicht nach »const sockaddr*« für Argument »2« nach »int bind(int, const sockaddr*, socklen_t)« umgewandelt werden
apps/IMApplication.cc: In member function »virtual int IMApplication::command(int, const char* const*)«:
apps/IMApplication.cc:27: Fehler: »Tcl« wurde in diesem Gültigkeitsbereich nicht definiert
apps/IMApplication.cc:27: Fehler: »tcl« wurde in diesem Gültigkeitsbereich nicht definiert
apps/IMApplication.cc:27: Fehler: »Tcl« is not a class or namespace
apps/IMApplication.cc:31: Fehler: »TclObject« wurde in diesem Gültigkeitsbereich nicht definiert
apps/IMApplication.cc:31: Fehler: expected `;' before »::« token
apps/IMApplication.cc:34: Fehler: »TCL_ERROR« wurde in diesem Gültigkeitsbereich nicht definiert
apps/IMApplication.cc:39: Warnung: zu viele Argumente für Format
apps/IMApplication.cc:40: Fehler: »TCL_OK« wurde in diesem Gültigkeitsbereich nicht definiert
make: *** [apps/IMApplication.o] Fehler 1
Gruß,
Sirakov
Zuletzt bearbeitet von einem Moderator: