-
Notifications
You must be signed in to change notification settings - Fork 78
Open
Description
Hi,
I am trying to compile the library for further MATLAB usage. However, during the building step the following error occurs
c_mexapi_version.c
LINK : warning LNK4044: unrecognized option '/lm'; ignored [C:\Users\augus\fCWT\build\fCWTmex.vcxproj]
LINK : warning LNK4044: unrecognized option '/lm'; ignored [C:\Users\augus\fCWT\build\fCWTmex.vcxproj]
Creating library C:/Users/augus/fCWT/build/Debug/../MATLAB/fCWT.lib and object C:/Users/augus/fCWT/build/Debug/../
MATLAB/fCWT.exp
fcwtmex.obj : error LNK2001: **unresolved external symbol "public: virtual void __cdecl Morlet::generate(int)" (?generate
@Morlet@@UEAAXH@Z) [C:\Users\augus\fCWT\build\fCWTmex.vcxproj]**
fcwtmex.obj : error LNK2001: **unresolved external symbol "public: virtual void __cdecl Morlet::generate(float *,float *,
int,float)" (?generate@Morlet@@UEAAXPEAM0HM@Z) [C:\Users\augus\fCWT\build\fCWTmex.vcxproj]**
fcwtmex.obj : error LNK2001: **unresolved external symbol "public: virtual void __cdecl Morlet::getWavelet(float,class st
d::complex<float> *,int)" (?getWavelet@Morlet@@UEAAXMPEAV?$complex@M@std@@H@Z) [C:\Users\augus\fCWT\build\fCWTmex.vcxproj]**
C:\Users\augus\fCWT\build\Debug\fCWT.mexw64 : fatal error LNK1120: 3 unresolved externals [C:\Users\augus\fCWT\build\fC
WTmex.vcxproj]
Building Custom Rule C:/Users/augus/fCWT/CMakeLists.txt
cl : command line warning D9002: ignoring unknown option '-g' [C:\Users\augus\fCWT\build\fCWTmexplan.vcxproj]
fcwtplan.cpp
cl : command line warning D9025: overriding '/W1' with '/w' [C:\Users\augus\fCWT\build\fCWTmexplan.vcxproj]
cl : command line warning D9002: ignoring unknown option '-g' [C:\Users\augus\fCWT\build\fCWTmexplan.vcxproj]
c_mexapi_version.c
LINK : warning LNK4044: unrecognized option '/lm'; ignored [C:\Users\augus\fCWT\build\fCWTmexplan.vcxproj]
LINK : warning LNK4044: unrecognized option '/lm'; ignored [C:\Users\augus\fCWT\build\fCWTmexplan.vcxproj]
Creating library C:/Users/augus/fCWT/build/Debug/../MATLAB/fCWT_create_plan.lib and object C:/Users/augus/fCWT/bui
ld/Debug/../MATLAB/fCWT_create_plan.exp
fcwtplan.obj : error LNK2001: **unresolved external symbol "public: virtual void __cdecl Morlet::generate(int)" (?generat
e@Morlet@@UEAAXH@Z) [C:\Users\augus\fCWT\build\fCWTmexplan.vcxproj]**
fcwtplan.obj : error LNK2001: **unresolved external symbol "public: virtual void __cdecl Morlet::generate(float *,float *
,int,float)" (?generate@Morlet@@UEAAXPEAM0HM@Z) [C:\Users\augus\fCWT\build\fCWTmexplan.vcxproj]**
fcwtplan.obj : error LNK2001: **unresolved external symbol "public: virtual void __cdecl Morlet::getWavelet(float,class s
td::complex<float> *,int)" (?getWavelet@Morlet@@UEAAXMPEAV?$complex@M@std@@H@Z) **[C:\Users\augus\fCWT\build\fCWTmexplan.
vcxproj]
C:\Users\augus\fCWT\build\Debug\fCWT_create_plan.mexw64 : fatal error LNK1120: 3 unresolved externals [C:\Users\augus\f
CWT\build\fCWTmexplan.vcxproj]The key is the unresolved external symbol "public: virtual void __cdecl Morlet::generate part. Apparently it is because the symbol implemented in the fcwt.cpp file is not visible to the user, which is further confirmed by viewing the compiled .dll file:
(No member functions like Morlet::generate)
I checked the code
Lines 81 to 90 in 49cb5a9
| class Morlet : public Wavelet { | |
| public: | |
| FCWT_LIBRARY_API Morlet(float bandwidth); //frequency domain | |
| ~Morlet() { free(mother); }; | |
| void generate(int size); //frequency domain | |
| void generate(float* real, float* imag, int size, float scale); //time domain | |
| int getSupport(float scale) { return (int)(fb*scale*3.0f); }; | |
| void getWavelet(float scale, complex<float>* pwav, int pn); | |
| float fb; |
and found these member functions are not exported under Windows (missing
FCWT_LIBRARY_API in the front).
After adding the annotation, I solved the problem, as follows,
diff --git a/src/fcwt/fcwt.h b/src/fcwt/fcwt.h
index d299b13..140bf44 100644
--- a/src/fcwt/fcwt.h
+++ b/src/fcwt/fcwt.h
@@ -83,10 +83,10 @@ public:
FCWT_LIBRARY_API Morlet(float bandwidth); //frequency domain
~Morlet() { free(mother); };
- void generate(int size); //frequency domain
- void generate(float* real, float* imag, int size, float scale); //time domain
- int getSupport(float scale) { return (int)(fb*scale*3.0f); };
- void getWavelet(float scale, complex<float>* pwav, int pn);
+ void FCWT_LIBRARY_API generate(int size); //frequency domain^M
+ void FCWT_LIBRARY_API generate(float* real, float* imag, int size, float scale); //time domain^M
+ int FCWT_LIBRARY_API getSupport(float scale) { return (int)(fb*scale*3.0f); };^M
+ void FCWT_LIBRARY_API getWavelet(float scale, complex<float>* pwav, int pn);^M
float fb;
private:
I wonder if this is a bug or something environment dependent. If this is a confirmed bug, I will be happy to create a pull request.
Environment Information
c:\Users\augus\fCWT\build>cmake -G "Visual Studio 17 2022" -DBUILD_MATLAB=ON ..
Build type is Release
-- Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.19045.
-- The C compiler identification is MSVC 19.43.34808.0
-- The CXX compiler identification is MSVC 19.43.34808.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.43.34808/bin/Hostx64/x64/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC/14.43.34808/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
Building of shared library is enabled.
-- Found OpenMP_C: -openmp (found version "2.0")
-- Found OpenMP_CXX: -openmp (found version "2.0")
-- Found OpenMP: TRUE (found version "2.0")
Building for Windows
C:/Users/augus/fCWT
STATUS OF LIBRARY: FFTW: [C:/Users/augus/fCWT/libs/fftw3f.lib]
-- Found Matlab: C:/Program Files/MATLAB/R2022b (found version "9.13.0.2502115")
-- Configuring done (6.6s)
-- Generating done (0.1s)
-- Build files have been written to: C:/Users/augus/fCWT/buildMetadata
Metadata
Assignees
Labels
No labels
