fCWT icon indicating copy to clipboard operation
fCWT copied to clipboard

fCWT in C++

Open Arpit-1996 opened this issue 2 years ago • 7 comments

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

Arpit-1996 avatar Jun 23 '23 04:06 Arpit-1996

@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/

felixdollack avatar Jun 27 '23 06:06 felixdollack

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

fastlib avatar Jul 06 '23 15:07 fastlib

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.

stellarpower avatar Jul 29 '23 06:07 stellarpower

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?

arpitomar avatar Aug 07 '23 07:08 arpitomar

@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/

felixdollack avatar Aug 30 '23 13:08 felixdollack

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?

Arpit-1996 avatar Sep 15 '23 12:09 Arpit-1996

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.

stellarpower avatar Sep 15 '23 12:09 stellarpower