My first Ubuntu under the C program.
C language
1. First confirm that you have the GCC compiler
in the terminal input GCC--version view your GCC version. As shown, if there is no error occurs, it is installed
2. Create a new file of. C with a terminal
Type vim hello.cin the terminal (file name is optional, but you need to use. C as the extension).
3. After the creation press I enter the edit mode to enter the following code, then ESC exit screenwriter mode, in English state input: Wq (don't forget the colon) (for VIM word processing do not understand classmate, please see this blog Ubuntu below VI use base)
4. After compiling exit vim, type gcc hello.c-o Helloand enter to generate an executable named Hello.
5. Run
Run the executable file and type sudo./hello(note./not less).
If you want to write C + +, you need to create a. cpp file and use a g++ compiler, which is later.
2.CUDA Language
Use VI to create. cu files, enter programs, save exits.
Compile NVCC filename.cu-o filename (with an executable filename after-O).
Execute sudo./filename
3.OPENCV
New Opencvtest.cpp
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
using namespace CV;
int main ()
{
Mat src = imread ("test.jpg", 1);
Imshow ("src", SRC);
Waitkey (0);
return 0;
}
(Note that this is not a single quote, the key to the left of keyboard 1,--cflags and--libs preceded by a space ")
g++ opencvtest.cpp-o opencvtest ' pkg-config--cflags--libs opencv ' last OpenCV lowercase)