Basically, your problem is that opencv4tegra is installed in /usr, and /usr/include is a standard include path (as /usr/lib is a standard path for link). When you try to compile for opencv3.1, gcc finds opencv4tegra before opencv3 headers.
You can try to use -nostdinc in cflags so that gcc doesn’t find opencv4tegra headers in /usr/include.
But if you have dependencies to others headers there it won’t work. Maybe giving -I<path_to_opencv3.1_include> before -I/usr/include could help but you may have to manage link as well with -L<path-to_opencv3.1_libs>.
If it doesn’t work, you can try to move opencv4tegra into a specific directory (I would suggest /usr/local/opencv4tegra-2.4.12), while installing opencv3.1.0 in /usr/local/opencv-3.1.0.
If you are familiar with package options, maybe you can reinstall properly in your new folder.
I had made that a dirty way, just moving folders opencv and opencv2 from usr/include to /usr/local/opencv4tegra-2.4.12/include, moving /usr/lib/libopencv* to /usr/local/opencv4tegra-2.4.12/lib.
(you should also move examples opencv* from /usr/bin folder and doc in /usr/share/doc). It was ok.
Then you can tell to gcc which one to choose for compiling and linking.
For linking or executing, you may have to set environement LD_LIBRARY_PATH to the libs you want to use. For example:
export LD_LIBRARY_PATH=/usr/cuda/lib:/usr/local/opencv-3.1.0/lib
[EDIT: Be aware that using pkg-config --cflags opencv will report false paths and should not be used any longer if you’ve moved opencv4tegra folder.]
[EDIT2: Seems now it is ok to let opencv4tergra in /usr and just say to gcc
gcc -I/usr/local/opencv-3.1.0/include mycode.cpp -L/usr/local/opencv-3.1.0/lib -lopencv_core ...and other libs... -o myapp
and set LD_LIBRARY_PATH accordingly for execution]