OpenCV4Tegra Problems

I am looking to use OpenCV4Tegra GPU functions for my Jetson TX2, however I am running into problems with any kind of OpenCV command in my c++ programs. I have installed JetPack 3.0, and I have the current version of OpenCV4Tegra (2.4). A simple program I have made to test OpenCV4Tegra is as follows:

#include <opencv2/opencv.hpp>

int main()
cv::Mat image = cv::Mat(512,512,CV_8UC1);

The error message looks like this:

/tmp/cceUZgbX.o: In function main': openCVtest.cpp:(.text+0x88): undefined reference to cv::_InputArray::_InputArray(cv::Mat const&)’
openCVtest.cpp:(.text+0x94): undefined reference to cv::imshow(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, cv::_InputArray const&)' openCVtest.cpp:(.text+0xac): undefined reference to cv::waitKey(int)’
/tmp/cceUZgbX.o: In function cv::Mat::~Mat()': openCVtest.cpp:(.text._ZN2cv3MatD2Ev[_ZN2cv3MatD5Ev]+0x34): undefined reference to cv::fastFree(void*)’
/tmp/cceUZgbX.o: In function cv::Mat::create(int, int, int)': openCVtest.cpp:(.text._ZN2cv3Mat6createEiii[_ZN2cv3Mat6createEiii]+0xd0): undefined reference to cv::Mat::create(int, int const*, int)’
/tmp/cceUZgbX.o: In function cv::Mat::release()': openCVtest.cpp:(.text._ZN2cv3Mat7releaseEv[_ZN2cv3Mat7releaseEv]+0x4c): undefined reference to cv::Mat::deallocate()’
collect2: error: ld returned 1 exit status

If there are any suggestions what is going wrong it would be much appreciated.

You may want to post this in the TX2 forum.