opencv3.3.0 undefined reference to cv::String::deallocate() (in cvstd.hpp)
I am using Visual Studio 2017 Community edition (Linux development with C++ workload) to develop openCV3.3.0 C++ code for the Raspberry Pi 3. I get the following output when I try to compile:
1>------ Rebuild All started: Project: PiCarHello, Configuration: Debug ARM ------
1>Cleaning remote project directory
1>Validating architecture
1>Validating sources
1>Copying sources remotely to '192.168.1.81'
1>Starting remote build
1>Compiling sources:
1>PiCarHello.cpp
1>Linking objects
1>/home/pi/projects/PiCarHello/obj/ARM/Debug/PiCarHello.o: In function cv::String::~String()':
1>/usr/local/include/opencv2/core/cvstd.hpp:647: undefined reference to
cv::String::deallocate()'
1>/home/pi/projects/PiCarHello/obj/ARM/Debug/PiCarHello.o: In function cv::String::operator=(cv::String const&)':
1>/usr/local/include/opencv2/core/cvstd.hpp:655: undefined reference to
cv::String::deallocate()'
1>collect2: error: ld returned 1 exit status
1>D:\Users\Loyd\Documents\Software\PiCar-old\PiCarHello\obj\ARM\Debug\PiCarHello.o: In function cv::String: : error :
1>/usr/local/include/opencv2/core/cvstd.hpp:647: undefined reference to
cv::String : error : deallocate()'
1>D:\Users\Loyd\Documents\Software\PiCar-old\PiCarHello\obj\ARM\Debug\PiCarHello.o: In function cv::String::operator=(cv: : error :
1>/usr/local/include/opencv2/core/cvstd.hpp:655: undefined reference to
cv::String : error : deallocate()'
1>collect2 : error : ld returned 1 exit status
1>Done building project "PiCarHello.vcxproj" -- FAILED.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========
I have no idea why this is happening or what to do about it. Sure would appreciate any help that you might be able to supply. Thanks so much.
Incidentally this is the code that is being compiled:
include <cstdio>
include <opencv2 opencv.hpp="">
using namespace cv;
int main() { printf("hello from PiCarHello!\n"); return 0; }
If I compile the code on the Raspberry Pi 3 using the following command:
g++ $(pkg-config --libs --cflags opencv) -o PiCarHello PiCarHello.cpp
(as recommended on http://pklab.net/index.php?lang=EN&id... ), IT WORKS.