Diese Website existiert nur weil wir Werbung mit AdSense ausliefern.
Bitte den AdBlocker daher auf dieser Website ausschalten! Danke.

gcc 3.3.4

Alles rund um die verschiedenen Konsolen und shells sowie die Programmierung unter Linux

Moderator: Moderatoren

Lothar Jung
Newbie
Newbie
Beiträge: 12
Registriert: 1. Apr 2005, 19:45

gcc 3.3.4

Beitrag von Lothar Jung »

Hallo
Nach einer Kompilierung von gcc 3.4.3 finden alle meine Compiler (kdevelop, anjuta usw) nicht mehr die c++-Funktionen und brechen mit Fehlermeldungen ab.
Wie kann ich in den Umgebungsvariablen den alten Zustand wiederherstellen (gcc 3.3.4).
Ich habe suse 9.2 64-Bit installiert.
Kann mir jemand bitte helfen?

Vielen Dank für Eure Mühe

Lothar
Benutzeravatar
snaewe
Hacker
Hacker
Beiträge: 415
Registriert: 13. Dez 2004, 16:32
Wohnort: Zu Hause

Beitrag von snaewe »

Welche Fehlermeldungen ?
Wo liegt der gcc (type -ap gcc) ?

Stefan
Der Name Windows stammt ursprünglich aus dem Indianischen und
bedeutet: "Weißer Mann, der auf eine Sanduhr starrt."
Lothar Jung
Newbie
Newbie
Beiträge: 12
Registriert: 1. Apr 2005, 19:45

Beitrag von Lothar Jung »

Hallo
Der gcc liegt in /usr/bin/gcc .

Folgende Fehler treten z.B. auf:
/home/Lothar/hello/src/hello.cpp:158: error: `endl' undeclared (first use this function)
/home/Lothar/hello/src/hello.cpp: In function `const LongNumber benchSqrtTwo()':
/home/Lothar/hello/src/hello.cpp:175: error: invalid conversion from `const char*' to `int'
/home/Lothar/hello/src/hello.cpp:175: error: initializing argument 1 of `void Stopwatch::print(int, int)'
/home/Lothar/hello/src/hello.cpp: In function `void benchVector(const RandomNumberCollection&)':
/home/Lothar/hello/src/hello.cpp:182: error: `vector' undeclared (first use this function)
/home/Lothar/hello/src/hello.cpp:182: error: expected primary-expression before "int"
/home/Lothar/hello/src/hello.cpp:182: error: expected `;' before "int"
/home/Lothar/hello/src/hello.cpp:184: error: `c' undeclared (first use this function)
/home/Lothar/hello/src/hello.cpp:187: error: expected primary-expression before "int"
/home/Lothar/hello/src/hello.cpp:187: error: expected `;' before "int"
/home/Lothar/hello/src/hello.cpp:192: error: `pos' undeclared (first use this function)
/home/Lothar/hello/src/hello.cpp:192: error: `find' undeclared (first use this function)
/home/Lothar/hello/src/hello.cpp:195: error: invalid conversion from `const char*' to `int'
/home/Lothar/hello/src/hello.cpp:195: error: initializing argument 1 of `void Stopwatch::print(int, int)'
/home/Lothar/hello/src/hello.cpp: In function `void benchList(const RandomNumberCollection&)':
/home/Lothar/hello/src/hello.cpp:201: error: `list' undeclared (first use this function)
/home/Lothar/hello/src/hello.cpp:201: error: expected primary-expression before "int"
/home/Lothar/hello/src/hello.cpp:201: error: expected `;' before "int"
/home/Lothar/hello/src/hello.cpp:203: error: `c' undeclared (first use this function)
/home/Lothar/hello/src/hello.cpp:206: error: expected primary-expression before "int"
/home/Lothar/hello/src/hello.cpp:206: error: expected `;' before "int"
/home/Lothar/hello/src/hello.cpp:211: error: `pos' undeclared (first use this function)
/home/Lothar/hello/src/hello.cpp:211: error: `find' undeclared (first use this function)
/home/Lothar/hello/src/hello.cpp:214: error: invalid conversion from `const char*' to `int'
/home/Lothar/hello/src/hello.cpp:214: error: initializing argument 1 of `void Stopwatch::print(int, int)'
/home/Lothar/hello/src/hello.cpp: In function `void benchBlur(const RandomNumberCollection&)':
/home/Lothar/hello/src/hello.cpp:252: error: invalid conversion from `const char*' to `int'
/home/Lothar/hello/src/hello.cpp:252: error: initializing argument 1 of `void Stopwatch::print(int, int)'
/home/Lothar/hello/src/hello.cpp: In function `void benchRungeKutta()':
/home/Lothar/hello/src/hello.cpp:275: error: invalid conversion from `const char*' to `int'
/home/Lothar/hello/src/hello.cpp:275: error: initializing argument 1 of `void Stopwatch::print(int, int)'
/home/Lothar/hello/src/hello.cpp: In function `void benchMemorySimple(const RandomNumberCollection&)':
/home/Lothar/hello/src/hello.cpp:296: error: `memset' undeclared (first use this function)
/home/Lothar/hello/src/hello.cpp:305: error: invalid conversion from `const char*' to `int'
/home/Lothar/hello/src/hello.cpp:305: error: initializing argument 1 of `void Stopwatch::print(int, int)'
/home/Lothar/hello/src/hello.cpp: At global scope:
/home/Lothar/hello/src/hello.cpp:321: error: variable or field `print' declared void
/home/Lothar/hello/src/hello.cpp:321: error: `int Stopwatch::print' is not a static member of `class Stopwatch'
/home/Lothar/hello/src/hello.cpp:321: error: `string' is not a member of `std'
/home/Lothar/hello/src/hello.cpp:321: error: expected primary-expression before "int"
/home/Lothar/hello/src/hello.cpp:321: error: initializer expression list treated as compound expression
/home/Lothar/hello/src/hello.cpp:321: error: expected `,' or `;' before '{' token
/home/Lothar/hello/src/hello.cpp: In constructor `LongNumber::LongNumber(int, short int)':
/home/Lothar/hello/src/hello.cpp:391: error: `memset' undeclared (first use this function)
/home/Lothar/hello/src/hello.cpp: In copy constructor `LongNumber::LongNumber(const LongNumber&)':
/home/Lothar/hello/src/hello.cpp:398: error: `memcpy' undeclared (first use this function)
/home/Lothar/hello/src/hello.cpp: In member function `LongNumber& LongNumber::operator=(const LongNumber&)':
/home/Lothar/hello/src/hello.cpp:404: error: `memcpy' undeclared (first use this function)
gmake[2]: *** [hello.o] Fehler 1
gmake[2]: Das Target »all« wurde wegen Fehlern nicht aktualisiert.
gmake[1]: *** [all-recursive] Fehler 1
gmake: *** [all] Fehler 2
*** Beendet mit Status: 2 ***

Lothar
Benutzeravatar
snaewe
Hacker
Hacker
Beiträge: 415
Registriert: 13. Dez 2004, 16:32
Wohnort: Zu Hause

Beitrag von snaewe »

Zeig mal dein hello.cpp
(Ich wette, du hast ein 'using namespace std' vergessen)

Stefan
Der Name Windows stammt ursprünglich aus dem Indianischen und
bedeutet: "Weißer Mann, der auf eine Sanduhr starrt."
Lothar Jung
Newbie
Newbie
Beiträge: 12
Registriert: 1. Apr 2005, 19:45

Beitrag von Lothar Jung »

Hier ist das Programm, bisher konnte ich es ohne Schwierigkeiten kompilieren.

/***************************************************************************
* Copyright (C) 2004 by Lothar Jung *
* Lothar@linux *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. /***************************************************************************
* Copyright (C) 2004 by Lothar Jung *
* Lothar@linux *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/

#include "benchmark.h"

#include <qimage.h>
#include <qpixmap.h>
#include <qtoolbar.h>
#include <qtoolbutton.h>
#include <qpopupmenu.h>
#include <qmenubar.h>
#include <qtextedit.h>
#include <qfile.h>
#include <qfiledialog.h>
#include <qstatusbar.h>
#include <qmessagebox.h>
#include <qprinter.h>
#include <qapplication.h>
#include <qaccel.h>
#include <qtextstream.h>
#include <qpainter.h>
#include <qpaintdevicemetrics.h>
#include <qwhatsthis.h>

#include "filesave.xpm"
#include "fileopen.xpm"
#include "fileprint.xpm"

Benchmark::Benchmark()
: QMainWindow( 0, "Benchmark", WDestructiveClose )
{
printer = new QPrinter;
QPixmap openIcon, saveIcon, printIcon;

QToolBar * fileTools = new QToolBar( this, "file operations" );
fileTools->setLabel( tr("File Operations") );

openIcon = QPixmap( fileopen );
QToolButton * fileOpen
= new QToolButton( openIcon, tr("Open File"), QString::null,
this, SLOT(choose()), fileTools, "open file" );

saveIcon = QPixmap( filesave );
QToolButton * fileSave
= new QToolButton( saveIcon, tr("Save File"), QString::null,
this, SLOT(save()), fileTools, "save file" );

printIcon = QPixmap( fileprint );
QToolButton * filePrint
= new QToolButton( printIcon, tr("Print File"), QString::null,
this, SLOT(print()), fileTools, "print file" );


(void)QWhatsThis::whatsThisButton( fileTools );

QString fileOpenText = tr("<p><img source=\"fileopen\"> "
"Click this button to open a <em>new file</em>. <br>"
"You can also select the <b>Open</b> command "
"from the <b>File</b> menu.</p>");

QWhatsThis::add( fileOpen, fileOpenText );
nc-junglo@netcologne.de
QMimeSourceFactory::defaultFactory()->setPixmap( "fileopen", openIcon );

QString fileSaveText = tr("<p>Click this button to save the file you "
"are editing. You will be prompted for a file name.\n"
"You can also select the <b>Save</b> command "
"from the <b>File</b> menu.</p>");

QWhatsThis::add( fileSave, fileSaveText );

QString filePrintText = tr("Click this button to print the file you "
"are editing.\n You can also select the Print "
"command from the File menu.");

QWhatsThis::add( filePrint, filePrintText );
nc-junglo@netcologne.de

QPopupMenu * file = new QPopupMenu( this );
menuBar()->insertItem( tr("&File"), file );


file->insertItem( tr("&New"), this, SLOT(newDoc()), CTRL+Key_N );

int id;
id = file->insertItem( openIcon, tr("&Open..."),
this, SLOT(choose()), CTRL+Key_O );
file->setWhatsThis( id, fileOpenText );

id = file->insertItem( saveIcon, tr("&Save"),
this, SLOT(save()), CTRL+Key_S );
file->setWhatsThis( id, fileSaveText );nc-junglo@netcologne.de

id = file->insertItem( tr("Save &As..."), this, SLOT(saveAs()) );
file->setWhatsThis( id, fileSaveText );

file->insertSeparator();

id = file->insertItem( printIcon, tr("&Princ-junglo@netcologne.dent..."),
this, SLOT(print()), CTRL+Key_P );
file->setWhatsThis( id, filePrintText );

file->insertSeparator();
nc-junglo@netcologne.de
file->insertItem( tr("&Close"), this, SLOT(close()), CTRL+Key_W );

file->insertItem( tr("&Quit"), qApp, SLOT( closeAllWindows() ), CTRL+Key_Q );

menuBar()->insertSeparator();

QPopupMenu * help = new QPopupMenu( this );
menuBar()->insertItem( tr("&Help"), help );
nc-junglo@netcologne.de
help->insertItem( tr("&About"), this, SLOT(about()), Key_F1 );
help->insertItem( tr("About &Qt"), this, SLOT(aboutQt()) );
help->insertSeparator();
help->insertItem( tr("What's &This"), this, SLOT(whatsThis()), SHIFT+Key_F1 );

e = new QTextEdit( this, "editor" );
e->setFocus();
setCentralWidget( e );
statusBar()->message( tr("Ready"), 2000 );

resize( 450, 600 );
}


Benchmark::~Benchmark()
{
delete printer;
}



void Benchmark::newDoc()
{
Benchmark *ed = new Benchmark;
ed->setCaption(tr("Qt Example - Application"));
ed->show();
}

void Benchmark::choose()
{
QString fn = QFileDialog::getOpenFileName( QString::null, QString::null,
this);
if ( !fn.isEmpty() )
load( fn );
else
statusBar()->message( tr("Loading aborted"), 2000 );
}


void Benchmark::load( const QString &fileName )
{
QFile f( fileName );
if ( !f.open( IO_ReadOnly ) )
return;

QTextStream ts( &f );
e->setText( ts.read() );
e->setModified( FALSE );
setCaption( fileName );
statusBar()->message( tr("Loaded document %1").arg(fileName), 2000 );
}


void Benchmark::save()
{
if ( filename.isEmpty() ) {
saveAs();
return;
}

QString text = e->text();
QFile f( filename );
if ( !f.open( IO_WriteOnly ) ) {
statusBar()->message( tr("Could not write to %1").arg(filename),
2000 );
return;
}

QTextStream t( &f );
t << text;
f.close();

e->setModified( FALSE );

setCaption( filename );

statusBar()->message( tr( "File %1 saved" ).arg( filename ), 2000 );
}


void Benchmark::saveAs()
{
QString fn = QFileDialog::getSaveFileName( QString::null, QString::null,
this );
if ( !fn.isEmpty() ) {
filename = fn;
save();
} else {
statusBar()->message( tr("Saving aborted"), 2000 );
}
}


void Benchmark::print()
{
// ###### Rewrite to use QSimpleRichText to print here as well
const int Margin = 10;
int pageNo = 1;

if ( printer->setup(this) ) { // printer dialog
statusBar()->message( tr("Printing...") );
QPainter p;
if( !p.begin( printer ) ) // paint on printer
return;

p.setFont( e->font() );
int yPos = 0; // y-position for each line
QFontMetrics fm = p.fontMetrics();
QPaintDeviceMetrics metrics( printer ); // need width/height
// of printer surface
for( int i = 0 ; i < e->lines() ; i++ ) {
if ( Margin + yPos > metrics.height() - Margin ) {
QString msg( "Printing (page " );
msg += QString::number( ++pageNo );
msg += ")...";
statusBar()->message( msg );
printer->newPage(); // no more room on this page
yPos = 0; // back to top of page
}
p.drawText( Margin, Margin + yPos,
metrics.width(), fm.lineSpacing(),
ExpandTabs | DontClip,
e->text( i ) );
yPos = yPos + fm.lineSpacing();
}
p.end(); // send job to printer
statusBar()->message( tr("Printing completed"), 2000 );
} else {
statusBar()->message( tr("Printing aborted"), 2000 );
}
}

void Benchmark::closeEvent( QCloseEvent* ce )
{
if ( !e->isModified() ) {
ce->accept();
return;
}

switch( QMessageBox::information( this, tr("Qt Application Example"),
tr("Do you want to save the changes"
" to the document?"),
tr("Yes"), tr("No"), tr("Cancel"),
0, 1 ) ) {
case 0:
save();
ce->accept();
break;
case 1:
ce->accept();
break;
case 2:
default: // just for sanity
ce->ignore();
break;
}
}


void Benchmark::about()
{
QMessageBox::about( this, tr("Qt Application Example"),
tr("This example demonstrates simple use of "
"QMainWindow,\nQMenuBar and QToolBar."));
}


void Benchmark::aboutQt()
{
QMessageBox::aboutQt( this, tr("Qt Application Example") );
}
*
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the *
* Free Software Foundation, Inc., *
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/

#include "benchmark.h"

#include <qimage.h>
#include <qpixmap.h>
#include <qtoolbar.h>
#include <qtoolbutton.h>
#include <qpopupmenu.h>
#include <qmenubar.h>
#include <qtextedit.h>
#include <qfile.h>
#include <qfiledialog.h>
#include <qstatusbar.h>
#include <qmessagebox.h>
#include <qprinter.h>
#include <qapplication.h>
#include <qaccel.h>
#include <qtextstream.h>
#include <qpainter.h>
#include <qpaintdevicemetrics.h>
#include <qwhatsthis.h>

#include "filesave.xpm"
#include "fileopen.xpm"
#include "fileprint.xpm"

Benchmark::Benchmark()
: QMainWindow( 0, "Benchmark", WDestructiveClose )
{
printer = new QPrinter;
QPixmap openIcon, saveIcon, printIcon;

QToolBar * fileTools = new QToolBar( this, "file operations" );
fileTools->setLabel( tr("File Operations") );

openIcon = QPixmap( fileopen );
QToolButton * fileOpen
= new QToolButton( openIcon, tr("Open File"), QString::null,
this, SLOT(choose()), fileTools, "open file" );

saveIcon = QPixmap( filesave );
QToolButton * fileSave
= new QToolButton( saveIcon, tr("Save File"), QString::null,
this, SLOT(save()), fileTools, "save file" );

printIcon = QPixmap( fileprint );
QToolButton * filePrint
= new QToolButton( printIcon, tr("Print File"), QString::null,
this, SLOT(print()), fileTools, "print file" );


(void)QWhatsThis::whatsThisButton( fileTools );

QString fileOpenText = tr("<p><img source=\"fileopen\"> "
"Click this button to open a <em>new file</em>. <br>"
"You can also select the <b>Open</b> command "
"from the <b>File</b> menu.</p>");

QWhatsThis::add( fileOpen, fileOpenText );
nc-junglo@netcologne.de
QMimeSourceFactory::defaultFactory()->setPixmap( "fileopen", openIcon );

QString fileSaveText = tr("<p>Click this button to save the file you "
"are editing. You will be prompted for a file name.\n"
"You can also select the <b>Save</b> command "
"from the <b>File</b> menu.</p>");

QWhatsThis::add( fileSave, fileSaveText );

QString filePrintText = tr("Click this button to print the file you "
"are editing.\n You can also select the Print "
"command from the File menu.");

QWhatsThis::add( filePrint, filePrintText );
nc-junglo@netcologne.de

QPopupMenu * file = new QPopupMenu( this );
menuBar()->insertItem( tr("&File"), file );


file->insertItem( tr("&New"), this, SLOT(newDoc()), CTRL+Key_N );

int id;
id = file->insertItem( openIcon, tr("&Open..."),
this, SLOT(choose()), CTRL+Key_O );
file->setWhatsThis( id, fileOpenText );

id = file->insertItem( saveIcon, tr("&Save"),
this, SLOT(save()), CTRL+Key_S );
file->setWhatsThis( id, fileSaveText );nc-junglo@netcologne.de

id = file->insertItem( tr("Save &As..."), this, SLOT(saveAs()) );
file->setWhatsThis( id, fileSaveText );

file->insertSeparator();

id = file->insertItem( printIcon, tr("&Princ-junglo@netcologne.dent..."),
this, SLOT(print()), CTRL+Key_P );
file->setWhatsThis( id, filePrintText );

file->insertSeparator();
nc-junglo@netcologne.de
file->insertItem( tr("&Close"), this, SLOT(close()), CTRL+Key_W );

file->insertItem( tr("&Quit"), qApp, SLOT( closeAllWindows() ), CTRL+Key_Q );

menuBar()->insertSeparator();

QPopupMenu * help = new QPopupMenu( this );
menuBar()->insertItem( tr("&Help"), help );
nc-junglo@netcologne.de
help->insertItem( tr("&About"), this, SLOT(about()), Key_F1 );
help->insertItem( tr("About &Qt"), this, SLOT(aboutQt()) );
help->insertSeparator();
help->insertItem( tr("What's &This"), this, SLOT(whatsThis()), SHIFT+Key_F1 );

e = new QTextEdit( this, "editor" );
e->setFocus();
setCentralWidget( e );
statusBar()->message( tr("Ready"), 2000 );

resize( 450, 600 );
}


Benchmark::~Benchmark()
{
delete printer;
}



void Benchmark::newDoc()
{
Benchmark *ed = new Benchmark;
ed->setCaption(tr("Qt Example - Application"));
ed->show();
}

void Benchmark::choose()
{
QString fn = QFileDialog::getOpenFileName( QString::null, QString::null,
this);
if ( !fn.isEmpty() )
load( fn );
else
statusBar()->message( tr("Loading aborted"), 2000 );
}


void Benchmark::load( const QString &fileName )
{
QFile f( fileName );
if ( !f.open( IO_ReadOnly ) )
return;

QTextStream ts( &f );
e->setText( ts.read() );
e->setModified( FALSE );
setCaption( fileName );
statusBar()->message( tr("Loaded document %1").arg(fileName), 2000 );
}


void Benchmark::save()
{
if ( filename.isEmpty() ) {
saveAs();
return;
}

QString text = e->text();
QFile f( filename );
if ( !f.open( IO_WriteOnly ) ) {
statusBar()->message( tr("Could not write to %1").arg(filename),
2000 );
return;
}

QTextStream t( &f );
t << text;
f.close();

e->setModified( FALSE );

setCaption( filename );

statusBar()->message( tr( "File %1 saved" ).arg( filename ), 2000 );
}


void Benchmark::saveAs()
{
QString fn = QFileDialog::getSaveFileName( QString::null, QString::null,
this );
if ( !fn.isEmpty() ) {
filename = fn;
save();
} else {
statusBar()->message( tr("Saving aborted"), 2000 );
}
}


void Benchmark::print()
{
// ###### Rewrite to use QSimpleRichText to print here as well
const int Margin = 10;
int pageNo = 1;

if ( printer->setup(this) ) { // printer dialog
statusBar()->message( tr("Printing...") );
QPainter p;
if( !p.begin( printer ) ) // paint on printer
return;

p.setFont( e->font() );
int yPos = 0; // y-position for each line
QFontMetrics fm = p.fontMetrics();
QPaintDeviceMetrics metrics( printer ); // need width/height
// of printer surface
for( int i = 0 ; i < e->lines() ; i++ ) {
if ( Margin + yPos > metrics.height() - Margin ) {
QString msg( "Printing (page " );
msg += QString::number( ++pageNo );
msg += ")...";
statusBar()->message( msg );
printer->newPage(); // no more room on this page
yPos = 0; // back to top of page
}
p.drawText( Margin, Margin + yPos,
metrics.width(), fm.lineSpacing(),
ExpandTabs | DontClip,
e->text( i ) );
yPos = yPos + fm.lineSpacing();
}
p.end(); // send job to printer
statusBar()->message( tr("Printing completed"), 2000 );
} else {
statusBar()->message( tr("Printing aborted"), 2000 );
}
}

void Benchmark::closeEvent( QCloseEvent* ce )
{
if ( !e->isModified() ) {
ce->accept();
return;
}

switch( QMessageBox::information( this, tr("Qt Application Example"),
tr("Do you want to save the changes"
" to the document?"),
tr("Yes"), tr("No"), tr("Cancel"),
0, 1 ) ) {
case 0:
save();
ce->accept();
break;
case 1:
ce->accept();
break;
case 2:
default: // just for sanity
ce->ignore();
break;
}
}


void Benchmark::about()
{
QMessageBox::about( this, tr("Qt Application Example"),
tr("This example demonstrates simple use of "
"QMainWindow,\nQMenuBar and QToolBar."));
}


void Benchmark::aboutQt()
{
QMessageBox::aboutQt( this, tr("Qt Application Example") );
}
Benutzeravatar
snaewe
Hacker
Hacker
Beiträge: 415
Registriert: 13. Dez 2004, 16:32
Wohnort: Zu Hause

Beitrag von snaewe »

Ich bezweifle, dass das die Datei ist, die solche Fehler produziert!

Stefan
Der Name Windows stammt ursprünglich aus dem Indianischen und
bedeutet: "Weißer Mann, der auf eine Sanduhr starrt."
Lothar Jung
Newbie
Newbie
Beiträge: 12
Registriert: 1. Apr 2005, 19:45

Beitrag von Lothar Jung »

Hallo
Sie produziert unter Kdevelop solche Fehler.
Configure und automake laufen ohne Fehler durch.
Beim Installieren oder Programm ausführen werden die
Fehler ausgegeben. Offensichtlich werden die C++Biliotheken
nicht gefunden.
Muss ich etwas an den Umgebungsvariablen einstellen oder bei Projekteinstellungen etwas ändern.

Lothar
Benutzeravatar
snaewe
Hacker
Hacker
Beiträge: 415
Registriert: 13. Dez 2004, 16:32
Wohnort: Zu Hause

Beitrag von snaewe »

Glaube ich nicht!

Zeige mir genau Zeile 158 der Datei die die angegebenen Fehler produziert. Dort soll angeblich ein 'endl' benutzt werden, welches in dem von dir geposteten Code aber nicht drin ist. Also lüg mich nicht an.

Ausserdem liefert der Compiler die Fehler, da ist noch nix mit Bibliotheken, Wie ich schon vermutet habe, wirst du im Code sowas wie

Code: Alles auswählen

cout << ... << endl;
drinhaben, dass ein älterer Compiler vielleicht einfach so geschluckt hat. Der 3.3.4 ist aber etwas Standard-konformer und erwartet, dass du es so schreibst

Code: Alles auswählen

std::cout << ... std::endl;
Stefan
Der Name Windows stammt ursprünglich aus dem Indianischen und
bedeutet: "Weißer Mann, der auf eine Sanduhr starrt."
Lothar Jung
Newbie
Newbie
Beiträge: 12
Registriert: 1. Apr 2005, 19:45

Beitrag von Lothar Jung »

Hallo
ich lüge nicht, irre mich vielleicht.
Die Codezeile 158 lautet wie folgt:

cout << "Bitte warten !! ..." << endl;

Mache ich etwas falsch.
Das Benchmark-Programm ist aus der c't also nur ein Testprogramm.

Lothar
Benutzeravatar
snaewe
Hacker
Hacker
Beiträge: 415
Registriert: 13. Dez 2004, 16:32
Wohnort: Zu Hause

Beitrag von snaewe »

So wie ich sagte (Ich kann doch hellsehen...)

Was zu tun ist, habe ich dir ja schon 2x verraten.

(Wenn du die Datei, welche die besagte Zeile 158 enthält, hier nochmal schön in '[code]...[/code]' eingeschlossen postest, sag ich's dir auch noch ein drittes mal)

Stefan
Der Name Windows stammt ursprünglich aus dem Indianischen und
bedeutet: "Weißer Mann, der auf eine Sanduhr starrt."
Lothar Jung
Newbie
Newbie
Beiträge: 12
Registriert: 1. Apr 2005, 19:45

Beitrag von Lothar Jung »

Hallo Stefan,
Der Code von Zeile 158:
'cout << "Bitte warten !! ..." << endl;'

Die Fehlermeldungen:
home/Lothar/hello/src/hello.cpp:158: error: `cout' undeclared (first use this function)
/home/Lothar/hello/src/hello.cpp:158: error: (Each undeclared identifier is reported only once for each function it appears in.)
/home/Lothar/hello/src/hello.cpp:158: error: `endl' undeclared (first use this function)

Ich kann Dir nicht anderes zeigen.
So ist es.
Gruß
Lothar
Benutzeravatar
snaewe
Hacker
Hacker
Beiträge: 415
Registriert: 13. Dez 2004, 16:32
Wohnort: Zu Hause

Beitrag von snaewe »

Sorry, aber: Man bist du blöd...

Nochmal zum mitschreiben
- Öffne die Datei /home/Lothar/hello/src/hello.cpp im Editor deiner Wahl
- klicke hier auf 'Antwort erstellen'
- Schreibe '[code] [/code]' (ohne die '') in das Textfeld in deinem Browser
- markiere den gesamten Text der Datei hello.cpp im Editor
- kopiere den markierten Text aus dem Editor in das Textfeld in deinem Browser zwischen '[code]' und '[/code]'
- klicke auf 'Vorschau' im Browser
- überprüfe, dass man alles lesen kann
- wenn OK, klicke auf 'Absenden'

Wenn du das nicht hinbekommst, schicke mir die Datei an
stefan_AT_naewe_DOT_de

Stefan
Der Name Windows stammt ursprünglich aus dem Indianischen und
bedeutet: "Weißer Mann, der auf eine Sanduhr starrt."
Lothar Jung
Newbie
Newbie
Beiträge: 12
Registriert: 1. Apr 2005, 19:45

Beitrag von Lothar Jung »

Code: Alles auswählen

/***************************************************************************
 *   Copyright (C) 2004 by Lothar Jung                                     *
 *   Lothar@linux                                                          *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/


// g++ -Wall -O3 benchmark.cpp

/*
Title: ctbench
Description: a small benchmark for C#, Java, and C++
Copyright (c) 2002
Company: c't magazine, www.heise.de/ct
Authors: J�n Loviscach, Ulrich Breymann
Version: 1.0
*/

#include <limits.h>
#if (SHRT_MAX != 32767) || (INT_MAX != 2147483647)
#error Required: short is two bytes long, int is four bytes long.
#endif

// workarounds to adapt Microsoft (TM) Visual C++ (R) to ISO C++
// or use compiler option /Za
#ifdef _MSC_VER
// see Knowledge Base Q167748
#define for if(0);else for
// see Knowledge Base Q167733
#include <new>
#include <new.h>
int my_new_handler(size_t) {
	throw std::bad_alloc();
	return 0; // never reached
}
#endif



// ******** integrated header to facilitate distribution *******

#include <iostream>
#include <sys/timeb.h>
#include <string>
#include <vector>
#include <list>
#include <algorithm>



// simple stop timer with formatted output
class Stopwatch {
	timeb startTime, stopTime;
	long getMillis();
	public:
	void start();
	void stop();
	void print(std::string name, int num);
};

// unsigned fixed point type of "arbitrary" precision
class LongNumber {
	int length;
	short* array; // using 15 bits in lack of an unsigned type in Java
	void addAndCarry(int i, int s);
	void subAndCarry(int i, int s);
	public:
	LongNumber(int len, short x = 0);
	LongNumber(const LongNumber& a);
	LongNumber& operator= (const LongNumber& a);
	virtual ~LongNumber() { delete[] array; }
	// subtraction: a has to be smaller than the objects itself: unsigned op!
	void sub(const LongNumber& a);
	void half();
	void addProd(const LongNumber& a, const LongNumber& b);
	bool almostEqual(const LongNumber& a) const;
	short get(int i) const { return array[i]; }
	int getLength() const { return length; }
	void swap(LongNumber& a);
};

// calculate sqrt(2) up to "arbitrary" precision
class SqrtTwo {
	static const int size;
	static LongNumber sqrtTwoValue;
	public:
	// calculate sqrt(2) and return number of iterations needed
	static int init();
	// return copy of internal LongNumber object
	static LongNumber getValue();
	private:
	// iteration step for calculating sqrt(2): r = n*(3-n*n/2)/2
	static void iterate(const LongNumber& n, LongNumber& r);
};

// pseudo-random number generator taking values from a LongNumber object
class RandomNumberCollection {
	mutable int num;
	LongNumber val;
	public:
	// initialize by a LongNumber
	RandomNumberCollection (const LongNumber& ln);
	// get the next short as random number
	short next(short max) const;
};

// 3D vector with arithmetics and a pre-defined chaos vector field
class Vector3D {
	public:
	double x, y, z;
	Vector3D(double x_, double y_, double z_) : x(x_), y(y_), z(z_) {}
	Vector3D operator+(const Vector3D& v) const;

	// vector field of the Lorenz differential equation
	static Vector3D lorenz(const Vector3D& v) {
		const double a = 10.0;
		const double r = 28.0;
		const double b = 8.0/3.0;
		return Vector3D(a*(v.y-v.x), r*v.x-v.y-v.x*v.z, v.x*v.y-b*v.z);
	}
};

Vector3D operator*(double c, const Vector3D& v);

const LongNumber benchSqrtTwo(); // call and bench the initializer of the square root class
void benchVector(const RandomNumberCollection& r); // search in a vector-like container
void benchList(const RandomNumberCollection& r); // search in a list-like container
void benchBlur(const RandomNumberCollection& r); // Gaussian blur of a random grayscale picture
void benchRungeKutta(); // solve the Lorenz differential equation by Runge-Kutta integration
void benchMemorySimple(const RandomNumberCollection& r); // allocate and free memory, no crisscross pointers involved



// ******** implementation *******

using namespace std;

int main() {
	#ifdef _MSC_VER
	_set_new_handler(my_new_handler); // for MSVC, see above

	#endif

	cout << "Bitte warten !! ..." << endl;
	// use the bits of sqrt(2) as pseudo-random numbers
	RandomNumberCollection r = RandomNumberCollection(benchSqrtTwo());
	benchVector(r);
	benchList(r);
	benchBlur(r);
	benchRungeKutta();
	benchMemorySimple(r);

	return 0;
}

const LongNumber benchSqrtTwo() {
	Stopwatch s;
	s.start();
	int i = SqrtTwo::init();
	s.stop();
	s.print("Square Root", i);
	return SqrtTwo::getValue();
}

void benchVector(const RandomNumberCollection& r) {
	const short count = 20000;
	const short size = 10000;
	vector<int> c;
	for(int i=0; i < size; ++i) {
		c.push_back(i);
	}
	int seeked;
	vector<int>::iterator pos;
	Stopwatch s;
	s.start();
	for(int j = 0; j < count; ++j) {
		seeked =r.next(size);
		pos = find(c.begin(), c.end(), seeked);
	}
	s.stop();
	s.print("Vector", (count*size)/2); // (count*size)/2 is an estimate
}

void benchList(const RandomNumberCollection& r) {
	const short count = 5000;
	const short size = 10000;
	list<int> c;
	for(int i=0; i < size; ++i) {
		c.push_back(i);
	}
	int seeked;
	list<int>::iterator pos;
	Stopwatch s;
	s.start();
	for(int j = 0; j < count; ++j) {
		seeked = r.next(size);
		pos = find(c.begin(), c.end(), seeked);
	}
	s.stop();
	s.print("List", (count*size)/2); // (count*size)/2 is an estimate
}

void benchBlur(const RandomNumberCollection& r) {
	const short size = 1000;
	const short num	= 5;
	Stopwatch s;
	// size is constant here, so one could write unsigned char (*arr1)[size] = new ...,
	// but in real-world apps, size won't be constant.
	unsigned char* arr1 = new unsigned char[size*size];
	unsigned char* arr2 = new unsigned char[size*size];

	for(int i = 0; i < size; ++i) {
		for(int j = 0; j < size; ++j) {
			arr1[i*size+j] = (unsigned char) r.next(128); // Java has no unsigned byte type, so use only 0...127
		}
	}
	s.start();
	for(int n = 0; n < num; n++) { // num rounds of blurring
		for (int i = 3; i < size-3; ++i) { // vertical blur arr1 -> arr2
			for(int j = 0; j < size; ++j) {
				arr2[i*size+j] = (arr1[(i-3)*size+j] + arr1[(i+3)*size+j]
					+ 6*(arr1[(i-2)*size+j]+arr1[(i+2)*size+j])
					+ 15*(arr1[(i-1)*size+j]+arr1[(i+1)*size+j])
					+ 20*arr1[i*size+j] + 32)>>6;
			}
		}

		for(int j = 3; j < size-3; ++j) { // horizontal blur arr1 -> arr2
			for(int i = 0; i < size; ++i) {
				arr1[i*size+j] = (arr2[i*size+j-3] + arr2[i*size+j+3]
					+ 6*(arr2[i*size+j-2]+arr2[i*size+j+2])
					+ 15*(arr2[i*size+j-1]+arr2[i*size+j+1])
					+ 20*arr2[i*size+j] + 32)>>6;
			}
		}
	}
	s.stop();
	s.print("Blur", num*(size-6)*(size-6));

	delete[] arr2;
	delete[] arr1;
}

void benchRungeKutta() {
	Stopwatch s;
	const double dt = 1e-4;
	double t = 0.0;
	Vector3D v(2.0, 2.0, 1.0);

	s.start();
	while(t < 50.0 + 0.5*dt){ // 0.5*dt to compensate for possible roundoff errors
		Vector3D dv1 = dt*Vector3D::lorenz(v);
		t += 0.5*dt;
		Vector3D dv2 = dt*Vector3D::lorenz(v + 0.5*dv1);
		Vector3D dv3 = dt*Vector3D::lorenz(v + 0.5*dv2);
		t += 0.5*dt;
		Vector3D dv4 = dt*Vector3D::lorenz(v + dv3);
		v = v + (1.0/6.0)*dv1 + (1.0/3.0)*dv2 + (1.0/3.0)*dv3 + (1.0/6.0)*dv4;
	}
	s.stop();
	s.print("Runge-Kutta", (int)(50.0/dt + 0.5));
}

void benchMemorySimple(const RandomNumberCollection& r) {
	Stopwatch s;
	const short maxSize = 2000;
	const short minSize = 1;
	const short num = 2000;
	int** arr = new int*[num];
	const short count = 20000;

	for(int i = 0; i < num; ++i) {
		arr[i] = new int[minSize + r.next(maxSize - minSize + 1)];
	}

	s.start();
	for(int i = 0; i < count; ++i) {
		int n = r.next(num);
		delete[] arr[n];
		int size = minSize + r.next(maxSize - minSize + 1);
		arr[n] = new int[size];
		memset(arr[n], 0, size*sizeof(int));
		// We use memset because Java and C# deliver only initialized memory.
		// Of course, this means putting the brake on
		// since initialization by zero is not often needed.

		// for analogy to Java and C# versions:
		arr[n][size-1] = 42;
	}
	s.stop();
	s.print("Memory", count);
	for(int i = 0; i < num; ++i) {
		delete[] arr[i];
	}
	delete[] arr;
}

long Stopwatch::getMillis() {
	return (long)(1000*(stopTime.time - startTime.time)
		+ stopTime.millitm - startTime.millitm);
}

void Stopwatch::start() { ftime(&startTime); }

void Stopwatch::stop() { ftime(&stopTime); }
		
void Stopwatch::print(std::string name, int num) {
	string tUnit = "ns";
	double tPerIteration = (1e9/1000.0/num)*getMillis();
	if (tPerIteration > 1e8) {
		tPerIteration /= 1e6;
		tUnit = "ms";
	} else if (tPerIteration > 1e5) {
		tPerIteration /= 1e3;
		tUnit = "s";
	}

	cout << name << ": "
		<< (int)(0.5 + (1000.0/1000.0)*getMillis())
		<< " ms for " << num << " Durrchläufe ; "
		<< (int)(0.5 + tPerIteration)
		<< " " << tUnit << " je Durchlauff"
		<< endl;
}

const int SqrtTwo::size = 10000;
LongNumber SqrtTwo::sqrtTwoValue = LongNumber(size);

// calculate sqrt(2) and return number of iterations needed
int SqrtTwo::init() {
	int i = 1;
	LongNumber n(size, 1);
	iterate(n, sqrtTwoValue);
	while(! n.almostEqual(sqrtTwoValue) ) {
		n.swap(sqrtTwoValue);
		iterate(n, sqrtTwoValue);
		++i;
	}
	return i;
}

// return copy of internal LongNumber object
LongNumber SqrtTwo::getValue() {
	return LongNumber(sqrtTwoValue);
}

// iteration step for calculating sqrt(2): r = n*(3-n*n/2)/2
inline void SqrtTwo::iterate(const LongNumber& n, LongNumber& r) {
	LongNumber x(size, 3);
	LongNumber y(size);
	y.addProd(n, n);
	y.half();
	x.sub(y);
	x.half();
	LongNumber z(size);
	z.addProd(n, x);
	z.swap(r);
}

// initialize by a LongNumber
RandomNumberCollection::RandomNumberCollection(const LongNumber& ln)
: num(0), val(ln) // use a copy so that later changes to ln don't matter
{}

// get the next short as random number
inline short RandomNumberCollection::next(short max) const {
	++num;
	if(num >= val.getLength()) {
		num = 0;
	}
	return (short)((max*(int)val.get(num)) >> 15);
}

LongNumber::LongNumber(int len, short x)
: length(len), array(new short[length])
{
	memset(array, 0, length*sizeof(short));
	array[0] = x;
}

LongNumber::LongNumber(const LongNumber& a)
: length(a.length), array(new short[length])
{
	memcpy(array, a.array, length*sizeof(short));
}

LongNumber& LongNumber::operator=(const LongNumber& a) {
	if(this != &a) { // needn't copy into itself
		short* temp = new short[a.length];
		memcpy(temp, a.array, a.length*sizeof(short));
		delete[] array; // no 'new' exception has been thrown, so it's ok to destroy old data
		length = a.length;
		array = temp;
	}
	return *this;
}

inline void LongNumber::addAndCarry(int i, int s) {
	int s1 = array[i] + s; // array may contain 0x7FFF, s may contain 0x3FFFF001
	if(s1 <= 0x7FFF) { // only 15 bits because Java doesn't do unsigned types
		array[i] = (short) s1;
	} else {
		int twoShort = array[i-1]*0x8000 + s1;
		if(twoShort >= 0x8000*0x8000) { // need to carry over more than 2*15 bits
			twoShort -= 0x8000*0x8000; // enough in any case, because s1 is smaller than this number
			int j = i-2;
			while(array[j] == 0x7FFF) {
				array[j] = 0;
				--j;
			}
			++array[j];
		}
		array[i] = (twoShort&0x7FFF);
		array[i-1] = (twoShort>>15);
	}
}

inline void LongNumber::subAndCarry(int i, int s) { // note: s may be filled up to 31 bits
	if(array[i] >= s) {
		array[i] = (short)(array[i]-s);
	} else {
		int twoShort = array[i-1]*0x8000 + array[i] - s;
		if(twoShort <= 0) { // need to carry over more than 2*15 bits
			twoShort += 0x8000*0x8000; // enough in any case, because s is smaller than this number
			int j = i-2;
			while(array[j] == 0) {
				array[j] = 0x7FFF;
				--j;
			}
			--array[j];
		}
		array[i] = (short)(twoShort&0x7FFF);
		array[i-1] = (short)(twoShort>>15);
	}
}

inline void LongNumber::sub(const LongNumber& a) {
	int len = length;
	if(a.length < len) {
		len = a.length;
	}
	for(int i = len-1; i >= 0; --i) {
		subAndCarry(i, a.array[i]);
	}
}

inline void LongNumber::half() {
	array[length-1]>>=1;
	for(int i = length-2; i >= 0; --i) {
		if( (array[i] & 0x1) == 1 ) {
			array[i+1] += 0x4000; // this bit has been cleared in the step before
		}
	array[i]>>=1;
	}
}

void LongNumber::addProd(const LongNumber& a, const LongNumber& b) {
	int len = length;
	if(a.length < len) {
		len = a.length;
	}
	if(b.length < len) {
		len = b.length;
	}
	for(int i = len-1; i >= 0; --i) {
		for(int j = len-1-i; j >= 0; --j) {
			addAndCarry(i+j, a.array[i] * b.array[j]);
		}
	}
}

bool LongNumber::almostEqual(const LongNumber& a) const {
	int len = length;
	if(a.length < len) {
		len = a.length;
	}
	int carry = 0;
	for(int i = 0; i < len-2; ++i) { // skip the last two
		if(carry == 0) {
			if(array[i] != a.array[i]) {
				carry = array[i]-a.array[i];
				if( (carry != 1) && (carry != -1) ) return false;
			}
		} else if(carry > 0) { // carry == +1
			if(array[i] != 0) return false;
			if(a.array[i] != 0x7FFF) return false;
		} else { // carry == -1
			if(a.array[i] != 0) return false;
			if(array[i] != 0x7FFF) return false;
		}
	}
	return true;
}

inline void LongNumber::swap(LongNumber& a){
	short* temp = array;
	array = a.array;
	a.array = temp;
	int itemp = length;
	length = a.length;
	a.length = itemp;
}

inline Vector3D Vector3D::operator+(const Vector3D& v) const {
	return Vector3D(x+v.x, y+v.y, z+v.z);
}

inline Vector3D operator*(double c, const Vector3D& v) {
	return Vector3D(c*v.x, c*v.y, c*v.z);
}
Benutzeravatar
snaewe
Hacker
Hacker
Beiträge: 415
Registriert: 13. Dez 2004, 16:32
Wohnort: Zu Hause

Beitrag von snaewe »

Tja, was soll ich sagen...
Die Datei, die du mir per mail geschickt hast, kann ich ohne Fehler
übersetzen

Code: Alles auswählen

stefan@sam:~/Src> gcc -c -Wall --pedantic bench.cpp -o bench
stefan@sam:~/Src> ls -l bench
-rw-r--r--  1 stefan users 43752 2005-04-01 21:37 bench
stefan@sam:~/Src>
Da ist ja auch in Zeile 150 das benötigte 'using namespace std;'

Ach ja

Code: Alles auswählen

stefan@sam:~/Src> gcc -v
Reading specs from /usr/lib/gcc-lib/i586-suse-linux/3.3.3/specs
Configured with: ../configure --enable-threads=posix --prefix=/usr --with-local-prefix=/usr/local --infodir=/usr/share/info --mandir=/usr/share/man --enable-languages=c,c++,f77,objc,java,ada --disable-checking --libdir=/usr/lib --enable-libgcj --with-gxx-include-dir=/usr/include/g++ --with-slibdir=/lib --with-system-zlib --enable-shared --enable-__cxa_atexit i586-suse-linux
Thread model: posix
gcc version 3.3.3 (SuSE Linux)
stefan@sam:~/Src>
(3.3.3 vs. 3.3.4 sollte da keinen Unterschied machen)

Bekommst du vielleicht noch Fehler vor der Zeile 158 ?

Stefan
Der Name Windows stammt ursprünglich aus dem Indianischen und
bedeutet: "Weißer Mann, der auf eine Sanduhr starrt."
Lothar Jung
Newbie
Newbie
Beiträge: 12
Registriert: 1. Apr 2005, 19:45

Beitrag von Lothar Jung »

Ja und zwar folgende

/home/Lothar/hello/src/hello.cpp:56:20: iostream: Datei oder Verzeichnis nicht gefunden
/home/Lothar/hello/src/hello.cpp:58:18: string: Datei oder Verzeichnis nicht gefunden
/home/Lothar/hello/src/hello.cpp:59:18: vector: Datei oder Verzeichnis nicht gefunden
/home/Lothar/hello/src/hello.cpp:60:16: list: Datei oder Verzeichnis nicht gefunden
/home/Lothar/hello/src/hello.cpp:61:21: algorithm: Datei oder Verzeichnis nicht gefunden
/home/Lothar/hello/src/hello.cpp:72: error: `std::string' has not been declared
/home/Lothar/hello/src/hello.cpp:72: error: ISO C++ forbids declaration of `name' with no type
/home/Lothar/hello/src/hello.cpp: In function `int main()':
Gruß Lothar
Benutzeravatar
snaewe
Hacker
Hacker
Beiträge: 415
Registriert: 13. Dez 2004, 16:32
Wohnort: Zu Hause

Beitrag von snaewe »

Mach's mir bloss nicht zu leicht...

OK. Dein gcc findet seine Header-Dateien nicht.
Zeig mal die Ausgabe von 'gcc -v' und schaue, ob du das bei '--with-gxx-include-dir=...' angezeigt Verzeichnis hast.

Stefan
Der Name Windows stammt ursprünglich aus dem Indianischen und
bedeutet: "Weißer Mann, der auf eine Sanduhr starrt."
Lothar Jung
Newbie
Newbie
Beiträge: 12
Registriert: 1. Apr 2005, 19:45

Beitrag von Lothar Jung »

Ausgabe von gcc -v ist folgende:

Lothar@linux:~> gcc -v
Lese Spezifikationen von /usr/lib64/gcc-lib/x86_64-suse-linux/3.3.4/specs
Konfiguriert mit: ../configure --enable-threads=posix --prefix=/usr --with-local-prefix=/usr/local --infodir=/usr/share/info --mandir=/usr/share/man --enable-languages=c,c++,f77,objc,java,ada --disable-checking --libdir=/usr/lib64 --enable-libgcj --with-gxx-include-dir=/usr/include/g++ --with-slibdir=/lib64 --with-system-zlib --enable-shared --enable-__cxa_atexit x86_64-suse-linux
Thread-Modell: posix
gcc-Version 3.3.4 (pre 3.3.5 20040809)

Das Verzeichnis /usr/include/g++ habe ich.

Lothar
Benutzeravatar
TeXpert
Guru
Guru
Beiträge: 2166
Registriert: 17. Jan 2005, 11:22

Beitrag von TeXpert »

ich hab mir das Dingen jetzt auch mal angesehen:

1. @snaewe wir arbeiten hier mit Klassen, daher sollten wir uns schon auf den g++ festlegen ;)

2. Umgebung 32bit-System auf einem Amd64

Code: Alles auswählen

$ g++ -v
Lese Spezifikationen von /usr/lib/gcc-lib/i486-linux/3.3.5/specs
Konfiguriert mit: ../src/configure -v --enable-languages=c,c++,java,f77,pascal,objc,ada,treelang --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-gxx-include-dir=/usr/include/c++/3.3 --enable-shared --with-system-zlib --enable-nls --without-included-gettext --disable-__cxa_atexit --enable-clocale=gnu --enable-debug --enable-java-gc=boehm --enable-java-awt=xlib --enable-objc-gc i486-linux
Thread-Modell: posix
gcc-Version 3.3.5 (Debian 1:3.3.5-9)
auf einer 32bit-Installation problemlos

Code: Alles auswählen

$ g++ -Wall --pedantic bench.cpp -o bench
$
funktioniert auch :) ich denke hier dürfte ein 64bit Problem vorliegen-> evtl. hat Suse da ja noch ein Problem bei den Include-Files

Code: Alles auswählen

# to resolve all your problems, try this:
HOWTO='pack c5,41*2,sqrt 7056,unpack(c,H)-2,oct 115' && perl -le "print $HOWTO"
Ich beantworte keine Supportfragen per PM!
Benutzeravatar
snaewe
Hacker
Hacker
Beiträge: 415
Registriert: 13. Dez 2004, 16:32
Wohnort: Zu Hause

Beitrag von snaewe »

Lothar Jung hat geschrieben:Das Verzeichnis /usr/include/g++ habe ich.
Liegt dort z.B. auch eine Datei 'iostream', oder 'vector', oder 'list' ??

@TeXpert: Ist doch Pups-egal. Ist doch eh nur das Frontend. Oder wieso kann ich die Datei mit 'gcc' übersetzen?

Stefan
Der Name Windows stammt ursprünglich aus dem Indianischen und
bedeutet: "Weißer Mann, der auf eine Sanduhr starrt."
Lothar Jung
Newbie
Newbie
Beiträge: 12
Registriert: 1. Apr 2005, 19:45

Beitrag von Lothar Jung »

Hallo,
ja unter G++ liegen die Header von vector, iostrem etc.
Trotzdem werden diese Dateien von gcc nicht gefunden.
Liegt es an der $PATH-Variable?
Für Tips wäre ich dankbar.
Lothar Jung
Antworten