简体   繁体   中英

QtCreator and Matlab libraries in Windows

I'm trying to build an application in Windows using QtCreator and the external Matlab libraries. I can add the libraries and include directories, but when it tries to link, I get "unresolved external symbol" for all the Matlab functions. QtCreator is looking for _matOpen, but the function is matOpen. I used "dumpbin" to look at the symbols, and sure enough the symbol in the qt obj file is

...
00000294  REL32                      00000000       149  _matOpen
...
149 00000000 UNDEF  notype ()    External     | _matOpen
...

and in the matlab library:

...
77B8 __imp_matOpen
77B8 matOpen
...
4B matOpen
...
  Version      : 0
  Machine      : 8664 (x64)
  TimeDateStamp: 5009E1D3 Fri Jul 20 15:55:15 2012
  SizeOfData   : 00000013
  DLL name     : libmat.dll
  Symbol name  : matOpen
  Type         : code
  Name type    : name
  Hint         : 97
  Name         : matOpen

Why is QtCreator adding the underscore, and how do I get it to stop?

I'm using Matlab 2012b, Qt 5.4, and QtCreator 3.3.2.

Make sure you link to the right architecture. There is NO leading underscore in the 64-bit version, but there IS in the 32-bit version.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM