Last active
June 14, 2023 11:59
-
-
Save treastrain/11bb810fda45f1b7d7bbbc041eddbd6a to your computer and use it in GitHub Desktop.
✅ A C++ project using OpenCV that can be compiled with Clang but not with GCC
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// main.cpp | |
// | |
// Created by treastrain / Tanaka Ryoga on 2021/01/25. | |
// | |
#include "main.hpp" | |
int main(int, char**) { | |
std::cout << "Hello, OpenCV World!" << std::endl; | |
std::cout << "OpenCV version: " << CV_VERSION << std::endl; | |
cv::Mat sourceImage = cv::imread("./image.jpg"); | |
if (!sourceImage.data) { | |
std::cerr << "Data cannot be read." << std::endl; | |
exit(-1); | |
} | |
return 0; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// main.hpp | |
// | |
// Created by treastrain / Tanaka Ryoga on 2021/01/25. | |
// | |
#include <iostream> | |
#include <opencv2/opencv.hpp> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
OpenCV-Playground: | |
echo OpenCV-Playground | |
buildclang: | |
clang++ -Wall -std=c++17 -O0 \ | |
-I../Libraries/opencv/include/opencv4 -L../Libraries/opencv/lib \ | |
-lopencv_core -lopencv_videoio -lopencv_imgproc -lopencv_imgcodecs \ | |
-o OpenCV-Playground \ | |
main.cpp | |
buildgcc: | |
g++ -Wall -std=c++17 -O0 \ | |
-I../Libraries/opencv/include/opencv4 -L../Libraries/opencv/lib \ | |
-lopencv_core -lopencv_videoio -lopencv_imgproc -lopencv_imgcodecs \ | |
-o OpenCV-Playground \ | |
main.cpp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@Qs-F You're my sunshine!