invalid conversion from ‘const char*’ to ‘char’

2013年2月19日 03:24

In C++, the token " " is a string literal which represents an array of two characters: the value of a space in the character set (eg, the value 32 in ascii) and a zero. On the other hand, the token ' ' represents a single character with the value of a space (usually 32). Note that in C, the token ' ' represents an integer with the value of a space. (In C, sizeof( ' ' ) == sizeof( int ), while in C++, sizeof( ' ' ) == 1.)

so getline(cNum, 255, " ") should be getline(cNum, 255, ' ') to get every word in one line

 char cNum[255];
 in_file.getline(cNum, 255, ' ');
 data = atof(cNum); //atof returns to double
 cout<<data<<" ";

评论(17) 阅读(4121)

A Comprehensive Tutorial of Installing OpenCV 2.4.3 in Ubuntu 12.10 [ i386 ]

2013年2月17日 12:03


(few modifications are made for 12.10 version ubuntu system here)

The Installation Procedure

To install and configure OpenCV 2.4.1, complete the following steps. The commands shown in each step can be copy and pasted directly into a Linux command line.

  1. Remove any installed versions of ffmpeg and x264.
    sudo apt-get remove ffmpeg x264 libx264-dev
  2. Get all the dependencies for x264 and ffmpeg.
    sudo apt-get update
    sudo apt-get install build-essential checkinstall git cmake libfaac-dev libjack-jackd2-dev 
    libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libsdl1.2-dev 
    libtheora-dev libva-dev libvdpau-dev libvorbis-dev libx11-dev libxfixes-dev 
    libxvidcore-dev texi2html yasm zlib1g-dev
  3. Download and install gstreamer.
    sudo apt-get install libgstreamer0.10-0 libgstreamer0.10-dev gstreamer0.10-tools 
    gstreamer0.10-plugins-base libgstreamer-plugins-base0.10-dev 
    gstreamer0.10-plugins-good gstreamer0.10-plugins-ugly 
    gstreamer0.10-plugins-bad gstreamer0.10-ffmpeg
  4. Download and install gtk.
    sudo apt-get install libgtk2.0-0 libgtk2.0-dev
  5. Download and install libjpeg.
    sudo apt-get install libjpeg8 libjpeg8-dev
  6. Create a directory to hold source code.
    cd ~
    mkdir src
  7. Download and install install x264.
    1. Download a recent stable snapshot of x264 from The exact version does not seem to matter. To write this guide, I used version x264-snapshot-20120528-2245-stable.tar.bz2, but I have used previous versions too.
          cd ~/src
          tar xvf x264-snapshot-20120528-2245-stable.tar.bz2
          cd x264-snapshot-20120528-2245-stable
    2. Configure and build the x264 libraries.
      ./configure --enable-static
      sudo make install

      IMPORTANT: If you are running a 64-bit version of Ubuntu, you must configure x264 as shown in the following command

      ./configure --enable-shared --enable-pic
    3. The -shared and -pic options might also be required when you compile for some other architectures, such as ARM. You know you need these options if you get the following error when compiling OpenCV:

      [ 25%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/bitstrm.cpp.o
      Linking CXX shared library ../../lib/
      /usr/bin/ld: /usr/local/lib/libavcodec.a(avpacket.o): relocation R_X86_64_32S against `av_destruct_packet' can not be used when making a shared object; recompile with -fPIC
      /usr/local/lib/libavcodec.a: could not read symbols: Bad value
  8. Download and install install ffmpeg.
    1. Download ffmpeg version 0.11.1 from
      cd ~/src
      tar xvf ffmpeg-0.11.1.tar.bz2
      cd ffmpeg-0.11.1
    2. Configure and build ffmpeg.
      ./configure --enable-gpl --enable-libfaac --enable-libmp3lame 
      --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora 
      --enable-libvorbis --enable-libx264 --enable-libxvid --enable-nonfree 
      --enable-postproc --enable-version3 --enable-x11grab
      sudo make install

      IMPORTANT: Just like with x264 in the previous step, you must configure ffmpeg with the -shared and -pic options if you are running a 64-bit version of Ubuntu or some other architectures, such as ARM.

      ./configure --enable-gpl --enable-libfaac --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --enable-nonfree --enable-postproc --enable-version3 --enable-x11grab --enable-shared --enable-pic
  9. Download and install install a recent version of v4l (video for linux) from For this guide I used version 0.9.3.
        cd ~/src
        tar xvf v4l-utils-0.9.3.tar.bz2
        cd v4l-utils-0.9.3
        sudo make install
  10. Download and install install OpenCV 2.4.3.
    1. Download OpenCV version 2.4.3 from
          cd ~/src
          tar xvf OpenCV-2.4.2.tar.bz2
    2. Create a new build directory and run cmake:
      cd OpenCV-2.4.2/
      mkdir build
      cd build
    3. Verify that the output of cmake includes the following text:
      • found gstreamer-base-0.10
      • GTK+ 2.x: YES
      • FFMPEG: YES
      • GStreamer: YES
      • V4L/V4L2: Using libv4l
    4. Build and install OpenCV.
      sudo make install
  11. Configure Linux.
    1. Tell linux where the shared libraries for OpenCV are located by entering the following shell command:
      export LD_LIBRARY_PATH=/usr/local/lib

      Add the command to your .bashrc file so that you don’t have to enter every time your start a new terminal.

      Alternatively, you can configure the system wide library search path. Using your favorite editor, add a single line containing the text /usr/local/lib to the end of a file named /etc/ In the standard Ubuntu install, the opencv.conf file does not exist; you need to create it. Using vi, for example, enter the following commands:

      sudo vi /etc/

      After editing the opencv.conf file, enter the following command:

      sudo ldconfig /etc/
    2. Using your favorite editor, add the following two lines to the end of /etc/bash.bashrc:
          export PKG_CONFIG_PATH

After completing the previous steps, your system should be ready to compile code that uses the OpenCV libraries.


The following example shows one way to compile code for OpenCV:

g++ `pkg-config opencv --cflags` my_example.cpp -o my_example `pkg-config opencv --libs` 

Sample c++ file here, my_example.cpp, used for opening an image:

#include <stdio.h>
#include <opencv2/opencv.hpp>

using namespace cv;

int main( int argc, char** argv )
  Mat image;
  image = imread( argv[1], 1 );

  if( argc != 2 || ! )
      printf( "No image data \n" );
      return -1;

  namedWindow( "Display Image", CV_WINDOW_AUTOSIZE );
  imshow( "Display Image", image );


  return 0;

Once compiled, run command to see the sweetie :D

./my_example cLena.bmp

评论(20) 阅读(11990)

[ubuntu] Google Chrome: Could not load plugin error fixed

2013年2月04日 14:59

Problem Description:

Ubuntu 12.10 , Chrome Version 22.0.1229.94

For unknown reason it could not play any videos or sounds
and error "could not load plugin" reported.


Run command in terminal :

rm -rf ~/.config/google-chrome/PepperFlash/

评论(10) 阅读(4137)

ubuntu下force quit 的快捷键

2013年2月02日 13:52

There are easier ways to force quit apps, of course.

Hit Alt-F2 to bring up the "Run Application" dialog, then type xkill there and hit enter.




评论(14) 阅读(2775)

一万次悲伤 吉他谱 TXT格式

2012年11月26日 21:15

     G              D    Em     C        G         D       
哦,honey,我脑海里全都是你,无法抗拒的心悸 难以呼吸
  G                D  Em        C        G         D 
        G           Em             C             G 
          Em          C         G    D
      G           Em             C             G 
         Em          C         G    D

     G              D    Em     C        G         D 
 G                    D  Em              C       G           D 
        G           Em               C        G 
        Em            C         G    D
      G           Em             C           G 
         Em          C         G    D

G: 320033
D: 200233
Em: 022033
C: x32033

评论(4) 阅读(28402)