#"g++ -fPIC -shared -o main.so main.cpp" its giving "opencv2/opencv.hpp: No such file or directory"

14 messages · Page 1 of 1 (latest)

shut pasture
#

When i run the main.cpp in codeblocks it works and it includes the opencv but running that command in the terminal gives the error opencv2/opencv2.hpp not found.

I wanna connect c++ + opencv2 in it to python with ctypes.

main parcelBOT
#

When your question is answered use !solved to mark the question as resolved.

Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.

quiet cedar
shut pasture
#

`
#include <opencv2/opencv.hpp>

int main() {
return 0;
}

extern "C" {
int test() {
return 12;
}
}
`

quiet cedar
#

The command, not the file

#

g++ yourFile.cpp -o yourFile

shut pasture
#

g++ -fPIC -shared -o main.so main.cpp

quiet cedar
#

right I didnt notice its in the thread's name lol

Where is your opencv2 located

shut pasture
#

im using msys there are alot of opencv2 folders

quiet cedar
#

Try providing include directories manually

#

-IpathToYourFolder

shut pasture
#

it did work!

#

thanks although now im getting errors in the c++ itself but atleast now it knows where opencv is

main parcelBOT
#

@shut pasture Has your question been resolved? If so, type !solved :)