fastlib / fCWT

The fast Continuous Wavelet Transform (fCWT) is a library for fast calculation of CWT.
Apache License 2.0
263 stars 53 forks source link

fCWT in C++ #39

Open Arpit-1996 opened 1 year ago

Arpit-1996 commented 1 year ago

This error comes when we run C++ code of fCWT. Screenshot 2023-06-23 001013

felixdollack commented 1 year ago

@Arpit-199 you need to build the fCWT library or include the source files. Your custom code in cwt.cpp is not enough. In your code you include fcwt.h somewhere at the beginning of the file right? Then you need to tell the compiler to include this file and also add the implementation in fcwt.cpp.

You maybe have to adjust the path to the files but something like the following should work:

g++ cwt.cpp src/fcwt/fcwt.cpp -I src/fcwt/
fastlib commented 1 year ago

@Arpit-1996, is your question/issue answered/solved? If yes, than this issue can be closed.

stellarpower commented 1 year ago

It's a linker error, not compiler, so you need to add the library with -l (the addition of headers above won't solve it because it's already compiled). Better than manualy adding flags would be to use CMake to build.

arpitomar commented 1 year ago

Screenshot 1 Screenshot 2 I run this command in the command terminal and we make CMake files. I do not understand where I save the C++ Example and run this code Screenshot 3 If I run C++ code in any folder this error happens. What should I do?

felixdollack commented 1 year ago

@arpitomar you are not telling the compiler where to find fcwt.h

@Arpit-199 you need to build the fCWT library or include the source files. Your custom code in cwt.cpp is not enough. In your code you include fcwt.h somewhere at the beginning of the file right? Then you need to tell the compiler to include this file and also add the implementation in fcwt.cpp.

You maybe have to adjust the path to the files but something like the following should work:

g++ cwt.cpp src/fcwt/fcwt.cpp -I src/fcwt/
Arpit-1996 commented 1 year ago

I include fcwt.h file in main.cpp and fcwt.cpp file but error remains same.

Screenshot 2023-09-15 173650 111

2023-09-15 173746 Then how to remove error?

stellarpower commented 1 year ago

It is a linker error you are seeing. You need to tell g++ where the library was installed to (-L can be used for this), and then link against it with -lfCWT. As it stands, you aren't linking against the library you built earlier, so the error is saying that the functions decalred in the header don't have implementations in your code, and can't be found elsewhere.