Ho provato a creare un programma semplice nel terminale.Impossibile compilare un semplice programma C++ in Ubuntu
#include <stdio.h>
#include <stdlib.h>
int main()
{
printf("TESTING");
return 1;
}
ho corse g ++ -o prova test.cpp
Gli errori:
/usr/include/features.h:323:26: error: bits/predefs.h: No such file or directory
/usr/include/features.h:356:25: error: sys/cdefs.h: No such file or directory
/usr/include/features.h:388:23: error: gnu/stubs.h: No such file or directory
In file included from test.cpp:2:
/usr/include/stdlib.h:42:29: error: bits/waitflags.h: No such file or directory
/usr/include/stdlib.h:43:30: error: bits/waitstatus.h: No such file or directory
/usr/include/stdlib.h:320:49: error: sys/types.h: No such file or directory
In file included from test.cpp:2:
/usr/include/stdlib.h:35: error: ‘__BEGIN_DECLS’ does not name a type
/usr/include/stdlib.h:102: error: expected constructor, destructor, or type conversion before ‘;’ token
/usr/include/stdlib.h:113: error: ‘__END_NAMESPACE_STD’ does not name a type
/usr/include/stdlib.h:122: error: expected constructor, destructor, or type conversion before ‘;’ token
/usr/include/stdlib.h:140: error: expected constructor, destructor, or type conversion before ‘extern’
/usr/include/stdlib.h:145: error: expected constructor, destructor, or type conversion before ‘extern’
/usr/include/stdlib.h:149: error: expected initializer before ‘__THROW’
/usr/include/stdlib.h:152: error: expected initializer before ‘__THROW’
/usr/include/stdlib.h:153: error: ‘__END_NAMESPACE_STD’ does not name a type
/usr/include/stdlib.h:160: error: ‘__END_NAMESPACE_C99’ does not name a type
/usr/include/stdlib.h:168: error: ‘__END_NAMESPACE_STD’ does not name a type
La lista continua in questo modo. Spero che qualcuno possa far notare ciò che non ho fatto per far funzionare questo.
Cosa offre 'g ++ --verbose -o test test.cpp'? – genpfault
vedi se http://ubuntuforums.org/showthread.php?t=1877944 aiuta –
Forse ho risolto il problema. Ho controllato l'output dettagliato e ho deciso di semplificare il percorso. Ho cambiato solo /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin Il programma viene compilato ora, ma non emette alcunché quando viene eseguito . È normale? –