std:cout unter linux
-
Hallo,
ich bin ziemlich unerfahren in C/C++ und ich habe ein Problem.Ich habe ein kleines Programm geschrieben und ich muss das unter Linux testen. Ich werde (versuchen) das Programm im Matlab zu benutzen aber jetzt möchte ich eine art "stand-alone" zu kompiliern.
mein Problem liegt am Ausgabe ... ich rechen eine fft Transformation und ich muss irgenwie die Ergebnisse sehen. Momentan sieht so aus:
#include <fftw3.h>
#include <stdio.h>
#include <math.h>
#include <conio.h>
#include <stdlib.h>
#include <iostream>....
//memory allocation
out=(fftw_complex*)fftw_malloc(sizeof(fftw_complex)N);
in=(fftw_complex)fftw_malloc(sizeof(fftw_complex)*N);//for filling the input array
for(int ii=0;ii|N;ii++){
in[ii][0]=A[j];
in[0][ii]=0;std::cout||in[ii][0]||std::endl;
std::cout||in[ii][1]||std::endl;
j++;
} getch();//plan creation and exection
p=fftw_plan_dft_1d(N,in,out,FFTW_FORWARD,FFTW_ESTIMATE);
fftw_execute(p);for (int iii=0;iii|N;iii++){
std::cout||out[iii][0]||std::endl;
std::cout||out[iii][1]||std::endl;
}getch();.....
unter Linux gibt kein conio.h, mit iostream sieht auch nicht so gut ...
hier ist was ich von gcc bekomme:my_fft.c:5:19: conio.h: No such file or directory
my_fft.c:6:20: iostream: No such file or directory
my_fft.c: In functionmain': my_fft.c:25: error: syntax error before ':' token my_fft.c:26: error: duplicate labelstd'
my_fft.c:26: error: syntax error before ':' token
my_fft.c:36: error: duplicate labelstd' my_fft.c:36: error: syntax error before ':' token my_fft.c:37: error: duplicate labelstd'
my_fft.c:37: error: syntax error before ':' tokenohne "std::" bekomme ich das:
my_fft.c:25: error:
cout' undeclared (first use in this function) my_fft.c:25: error: (Each undeclared identifier is reported only once my_fft.c:25: error: for each function it appears in.) my_fft.c:25: error:endl' undeclared (first use in this function)
my_fft.c:11: warning: return type of `main' is not `int'mich interesiert eingentlich nur wie ich überhaupt meine "in" und "out" ausgeben kann.
wenn ihr eine Idee habt wäre ich sehr dankbar
adios
-
probiers mal mit g++ statt gcc.
Ich hatte am Anfang auch meine Probleme mit gcc... Weil die <iostream> sollte er ohne murren hinnehmen.Und war das nicht cout << und nicht cout || !?

-
Compilierst Du das vielleicht als ANSI-C statt C++?
-
[quote="LordJaxom"]Compilierst Du das vielleicht als ANSI-C statt C++?[/quote]
Ja, es tut mir leid.
Ich habe mit g++ versucht und hat schon geklappt.

Aber wenn ich jetzt
./my_fft aufrufe sehe ich immer noch kein output in der Konsole. Dass liegt wahrsheinlich am getch() ... den kann ich immer noch nicht benutzen ... kein conio.h gefunden.|| statt << war eine Editor Fehler, klar ist << und nicht ||
ich suche jetzt nach Alternative, dieses getch() zu ersetzen.
danke

-
-
.filmor schrieb:
Danke für den Hinweis. Ich weiss aber nicht ob das ist was ich suche, ich möchte nur die Ergebnis von meinem Programm aus dem Display zu sehen. Und die Lösung ist für DOS, WIN32 ... ich arbeite unter Linux.
ich habe das C++ Code übernommen und in meinen Prog. und passiert nichts.
danke trotzdem!
-
Wo ist das Problem? Starte das Programm doch einfach in der Konsole, dann brauchst du schonmal kein getch() am Ende. Und für zwischendrim im Programm reicht ein cin.get() (und vorher eventuell noch den Readbuffer leeren).
Gruß
-
Stimmt,
ich habe gestern Nacht oft probiert und ... nix.
Heute habe ich das Prog. nochmal laufen lassen und da waren schon meine complex Zahlen auf dem Bildschirm.
Alles gut gegangen
Danke
-
Hmm, ist die Hintergrundbeleuchtung des TFT kaputt?

