0

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.

JayK
  • 31
  • 5
  • Related : [Why do C compilers prepend underscores to external names?](http://stackoverflow.com/questions/2627511/why-do-c-compilers-prepend-underscores-to-external-names) – tux3 Apr 16 '15 at 16:22

1 Answers1

0

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.

JayK
  • 31
  • 5