Results 1 to 4 of 4
hi,
how can i know whether i have installed C++ libraries in the debian
i have tried out with
gcc command but it is not working
gcc sample.cpp
student@debian:~$ gcc ...
- 08-21-2008 #1Linux Newbie
- Join Date
- Jul 2007
- Location
- india,andhra pradesh,hyderabad
- Posts
- 125
how to execute C++ files ?
hi,
how can i know whether i have installed C++ libraries in the debian
i have tried out with
gcc command but it is not working
gcc sample.cpp
student@debian:~$ gcc 1.cc
In file included from /usr/include/c++/4.2/backward/iostream.h:31,
from 1.cc:1:
/usr/include/c++/4.2/backward/backward_warning.h:32:2: warning: #warning This file includes at least one deprecated or antiquated header. Please consider using one of the 32 headers found in section 17.4.1.2 of the C++ standard. Examples include substituting the <X> header for the <X.h> header for C++ includes, or <iostream> instead of the deprecated header <iostream.h>. To disable this warning use -Wno-deprecated.
1.cc:3: error: ‘::main’ must return ‘int’
student@debian:~$ ./a.out
bash: ./a.out: No such file or directoryrocky
- 08-21-2008 #2
Use the command below
g++ -v
This will show all the info about the c++ compiler you have in your system.
Do
g++ file_name.cpp
This will compile and generate a.out file if your program has no errors.
Do
./a.out to see the output on display.
- 08-21-2008 #3Correct this error in your code.1.cc:3: error: ‘::main’ must return ‘int’
- 08-21-2008 #4
To summarize the last two posts, there are two problems with your program. The first is that you're trying to compile a C++ program using the regular GNU C Compiler. That just won't work. You have to use g++ to compile C++.
The second issue, as stated above, is that you have an error in your code. Code will not compile (and therefore not produce an a.out file) unless it is free of errors. Fix that error in your code and use the right compiler and you should be fine.Registered Linux user #270181
TechieMoe's Tech Rants


Reply With Quote
