roscore take too long to load in:
check ROS_IP and ROS_hostname
maybe not the same network IP as stated above in ~/.bashrc file
In order to compile C++ with ros you have to add LIB (libraries in /opt/ros/kinetic/lib) and INC (include paths in /opt/ros/kinetic/include) as following flag in g++.
FILES = main roscontroller
ROSROOT=/opt/ros/kinetic
#ROSROOT=/home/jerry/catkin_ws/install_isolated
LIBS += -L$(ROSROOT)/lib -lroscpp -lrosconsole -lroscpp_serialization
INC += -I$(ROSROOT)/include