// A simple program that computes the square root of a number#include<stdio.h>#include<stdlib.h>#include<math.h>int main (int argc,char*argv[]){if(argc <2){fprintf(stdout,"Usage: %s number\n",argv[0]);return1;}double inputValue =atof(argv[1]);double outputValue =sqrt(inputValue);fprintf(stdout,"The square root of %g is %g\n",
inputValue, outputValue);return0;}
尝试一下
cmake .make
xx@xx:/mnt/h/opencv/project$ cmake .
-- The C compiler identification is GNU 7.4.0
-- The CXX compiler identification is GNU 7.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /mnt/h/opencv/slam/project
xx@xx:/mnt/h/opencv/project$ make
Scanning dependencies of target Tutorial
[ 50%] Building CXX object CMakeFiles/Tutorial.dir/tutorial.cpp.o
[100%] Linking CXX executable Tutorial
[100%] Built target Tutorial
xx@xx:/mnt/h/opencv/project$ ls
CMakeCache.txt CMakeFiles CMakeLists.txt Makefile Tutorial cmake_install.cmake tutorial.cpp
xx@xx:/mnt/h/opencv/project$ ./Tutorial 5
The square root of 5 is 2.23607
// A simple program that computes the square root of a number#include<stdio.h>#include<stdlib.h>#include<math.h>#include"test.h"int main (int argc,char*argv[]){if(argc <2){fprintf(stdout,"Usage: %s number\n",argv[0]);return1;}double inputValue =atof(argv[1]);double outputValue =sqrt(inputValue);fprintf(stdout,"The square root of %g is %g\n",
inputValue, outputValue);
TEST testa(1,0);fprintf(stdout,"Test val is %d\n", testa.get_val());return0;}
// A simple program that computes the square root of a number#include<stdio.h>#include<stdlib.h>#include<math.h>#include<opencv2/core/core.hpp>#include<opencv2/highgui/highgui.hpp>#include"test.h"int main (int argc,char*argv[]){if(argc <2){fprintf(stdout,"Usage: %s number\n",argv[0]);return1;}double inputValue =atof(argv[1]);double outputValue =sqrt(inputValue);fprintf(stdout,"The square root of %g is %g\n",
inputValue, outputValue);
TEST testa(1,0);fprintf(stdout,"Test val is %d\n", testa.get_val());
cv::Mat image = cv::imread("./ubuntu.png");//cv::namedWindow("image");
cv::imshow("image", image);
cv::waitKey(0);return0;}