Monday, March 2, 2015

CLion Simple Setup

Download CLion:
https://confluence.jetbrains.com/display/CLION/Early+Access+Program

Extract the archive
run the bin/clion.sh

If you receive errors that you are using a 32-bit version, then
setenv PATH /opt/jdk1.8.0_25/bin:$PATH
setenv JDK_PATH /opt/jdk1.8.0_25/

Saturday, November 1, 2014

OpenCV Property Sheets - Visual Studio

OpenCV Property Sheets

For: Visual Studio 

I created 2 property sheets one for Debug and one for Release, see attached.

To use these you will need to open them with a text editor (they are just ASCII XML files) and change the pathing so that it matches your pathing to opencv. I used version 243, so make sure you update that number as needed.

Once the property sheets are pointing to the correct locations, then move the files to a common area so you can reference them for all projects/solutions you create.

In the Property Manager right-click on debug and select Add Property Sheet and select OpenCV243PropD.props, then on the Release right-click and select Add Property Sheet and select OpenCV243Prop.props.

 -- attachment 1 / 2 : filename OpenCV243Prop.props --

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ImportGroup Label="PropertySheets" />
  <PropertyGroup Label="UserMacros" />
  <PropertyGroup />
  <ItemDefinitionGroup>
    <ClCompile>
      <AdditionalIncludeDirectories>"C:\opencv\build\include"</AdditionalIncludeDirectories>
    </ClCompile>
    <Link>
      <AdditionalLibraryDirectories>"C:\opencv\build\x86\vc10\lib"</AdditionalLibraryDirectories>
      <AdditionalDependencies>opencv_core243.lib;opencv_imgproc243.lib;opencv_highgui243.lib;opencv_ml243.lib;opencv_video243.lib;opencv_features2d243.lib;opencv_calib3d243.lib;opencv_objdetect243.lib;opencv_contrib243.lib;opencv_legacy243.lib;opencv_flann243.lib;%(AdditionalDependencies)</AdditionalDependencies>
    </Link>
  </ItemDefinitionGroup>
  <ItemGroup />
</Project>

 -- attachment 2 / 2 : filename OpenCV243Prop.props --

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <ImportGroup Label="PropertySheets" />
  <PropertyGroup Label="UserMacros" />
  <PropertyGroup />
  <ItemDefinitionGroup>
    <ClCompile>
      <AdditionalIncludeDirectories>"C:\opencv\build\include"</AdditionalIncludeDirectories>
    </ClCompile>
    <Link>
      <AdditionalLibraryDirectories>"C:\opencv\build\x86\vc10\lib"</AdditionalLibraryDirectories>
      <AdditionalDependencies>opencv_core243d.lib;opencv_imgproc243d.lib;opencv_highgui243d.lib;opencv_ml243d.lib;opencv_video243d.lib;opencv_features2d243d.lib;opencv_calib3d243d.lib;opencv_objdetect243d.lib;opencv_contrib243d.lib;opencv_legacy243d.lib;opencv_flann243d.lib;%(AdditionalDependencies)</AdditionalDependencies>
    </Link>
  </ItemDefinitionGroup>
  <ItemGroup />
</Project>

Thursday, June 12, 2014

Debugging C++ Code with NetBeans and GDB on Linux

Download NetBeans

Download:
https://netbeans.org/downloads/index.html

Run the file, very easy install.

Debug

Start your program with debug symbols loaded.
NetBeans > Debug > Attach > Pick running program

STL Container Support

Reference:
https://sourceware.org/gdb/wiki/STLSupport

Change directory (cd) to the directory you want the scripts to live in

svn co svn://gcc.gnu.org/svn/gcc/trunk/libstdc++-v3/python

If you are behind a firewall, then you may need to edit the ~/.subversion/server file under [global] and uncomment all of the http-* commands and give them the correct info for your proxy. You should then change the svn:// to http://

Then edit the ~/.gdbinit file and add the following:

python
import sys
sys.path.insert(0, '/home/me/gdb_printers/python')
from libstdcxx.v6.printers import register_libstdcxx_printers
register_libstdcxx_printers (None)
end


Sunday, June 8, 2014

(off-topic) Setting up Plex on CentOS 6.5 for Home Network

Download and run Plex



If http://localhost:32400/web returns "404 Not Found", then:


$ sudo vi /etc/sysconfig/selinux

change SELINUX=enforcing to SELINUX=disabled
reboot

go to plex url (localhost:32400/web) and it will load

$ sudo vi /etc/sysconfig/selinux

change SELINUX=disabled to SELINUX=enforcing
reboot


If http://192.168.1.2:32400/web doesn't work from other machines, then open port:

$ gvim /etc/sysconfig/iptables

add:
-A INPUT -m state --state NEW -m tcp -p tcp --dport 32400 -j ACCEPT

$ sudo service iptables restart

To check if the port is being used:
$ lsof -i :32400
OR
$ netstat -an | grep 32400 | grep LISTEN

To add network sources, mount the source, then add it:

$ sudo mkdir /mnt/nas1

$ sudo mount -t cifs //192.168.1.3/videos/ /mnt/nas1 -o username=user,password=123123

If this works for you, then you need to set these points to mount at boot:

$ sudo gvim /etc/fstab

Add:

//192.168.1.3/videos/  /mnt/nas1               cifs    defaults        0 0
//192.168.1.4/videos/  /mnt/nas2               cifs    defaults        0 0


Friday, June 6, 2014

SlickEdit Setup (Simple)

Download & Install SlickEdit

https://www.slickedit.com/products/slickedit

Project Setup

Use vs +new if you want a second UI opened

vs

Project > New > Other
  Name: [reponame]_[branch]
  Location: [repo_location]
  [x] Create new workspace
OK

Project > Project Properties...
  Add Tree...
  [select_dir]
  [x] Add as wildcard
  Repeat for all dirs
OK

Build Setup

Project > Project Properties... > Tools
  Compile (this file)
  Build (whole project)
  ...
OK




Thursday, June 5, 2014

emacs w/ intelligent code completion (CEDET)

Installing EMACS

http://savannah.gnu.org/projects/emacs

ERROR: no gif
FIX: --with-gif=no

ERROR: collect2: error: ld returned 1 exit status
FIX: CPPFLAGS="-fgnu89-inline"

make distclean
./configure --prefix=~/emacs-24.3_install --with-gif=no CPPFLAGS="-fgnu89-inline"
make
./src/emacs -Q
make install


Installing CEDET

http://cedet.sourceforge.net/setup.shtml

wget https://sourceforge.net/projects/cedet/files/cedet/cedet-1.1.tar.gz
tar zxf cedet-1.1.tar.gz
cd cedet-1.1
make EMACS=emacs

append ~/.emacs

(load-file "~/cedet-1.1/common/cedet.el")
(global-ede-mode 1)                      ; Enable the Project management system
(semantic-load-enable-code-helpers)      ; Enable prototype help and smart completion 
(global-srecode-minor-mode 1)            ; Enable template insertion menu


Getting Started with CEDET

http://alexott.net/en/writings/emacs-devenv/EmacsCedet.html

Wednesday, June 4, 2014

Vim auto (IntelliSense like) completion using GCCSense & gcc-code-assit


Download and Instructions from:
http://cx4a.org/software/gccsense/

Prerequisites:
http://gcc.gnu.org/install/prerequisites.html

Remember to setup your build environment, GCC, GMP, etc. (PATH, LD_LIBRARY_PATH, etc.)

wget http://cx4a.org/pub/gccsense/gcc-code-assist-0.1-4.4.4.tar.bz2
tar xvf gcc-code-assist-0.1-4.4.4.tar.bz2
cd gcc-code-assist-0.1-4.4.4/
./configure --prefix ~/gcc-code-assist-0.1-4.4.4_install --program-suffix=-code-assist --enable-languages=c,c++ --disable-bootstrap --disable-multilib

Received error:

configure: error: Building GCC requires GMP 4.1+ and MPFR 2.3.2+.
Try the --with-gmp and/or --with-mpfr options to specify their locations.
Copies of these libraries' source code can be found at their respective
hosting sites as well as at ftp://gcc.gnu.org/pub/gcc/infrastructure/.
See also http://gcc.gnu.org/install/prerequisites.html for additional info.
If you obtained GMP and/or MPFR from a vendor distribution package, make
sure that you have installed both the libraries and the header files.
They may be located in separate packages.

Install MPFR to fix error @ http://www.mpfr.org/mpfr-current/#download :

wget http://www.mpfr.org/mpfr-current/mpfr-3.1.2.tar.gz
tar xzf mpfr-3.1.2.tar.gz
cd mpfr-3.1.2
./configure --prefix=~/mpfr-3.1.2_install 
make
make check
make install

Rerun ./configure... from above but --with-mpfr=~/mpfr-3.1.2_install/

make

Received error:

...console
checking for suffix of object files... configure: error: in `~/gcc-code-assist-0.1-4.4.4/x86_64-unknown-linux-gnu/libgcc':
configure: error: cannot compute suffix of object files: cannot compile
See `config.log' for more details.
...config.log
configure:5031: gcc -c -g -O2 -I/include -DCLOOG_PPL_BACKEND  -I~/mpfr-3.1.2_install//include   conftest.c >&5
conftest.c:12:25: fatal error: cloog/cloog.h: No such file or directory
 #include "cloog/cloog.h"
                         ^CLooG
compilation terminated.

Specified cloog-ppl location:

Rerun ./configure... from above but --with-cloog=/tools/devkits/lnx64/cloog-ppl-0.15.11/

make

Received error:

configure:5009: checking for correct version of CLooG
configure:5031: gcc -c -g -O2 -I/tools/batonroot/rodin/devkits/lnx64/cloog-ppl-0.15.11//include -DCLOOG_PPL_BACKEND  -I/proj/rdi-xco/staff/nikc/tools/archive/mpfr-3.1.2_install//include   conftest.c >&5
In file included from /tools/batonroot/rodin/devkits/lnx64/cloog-ppl-0.15.11//include/cloog/cloog.h:45:0,
                 from conftest.c:12:
/tools/batonroot/rodin/devkits/lnx64/cloog-ppl-0.15.11//include/cloog/ppl_backend.h:34:19: fatal error: ppl_c.h: No such file or directory
 #include <ppl_c.h>
                   ^
compilation terminated.

Rerun ./configure... from above but --with-ppl=/tools/devkits/lnx64/ppl-0.11/

Final configuration command:

./configure --prefix ~/gcc-code-assist-0.1-4.4.4_install --program-suffix=-code-assist --enable-languages=c,c++ --disable-bootstrap --disable-multilib --with-mpfr=~/mpfr-3.1.2_install/ --with-cloog=/tools/devkits/lnx64/cloog-ppl-0.15.11/ --with-ppl=/tools/devkits/lnx64/ppl-0.11/


make

make install

!!! NOTICE: make clean would not correctly clean, I had to manually delete the build-... directory and then rerun before I would make progress.