U++ Forum - RDF feed
type: channel
description: Main place for discussions about U++ cross platform development framework.
items: undefined reference errors when building
items: Re: undefined reference errors when building

undefined reference errors when building
type: item
description: Hello, I get error messages when building this upp example: https:// www.ultimatepp.org/srcdoc$ArrayFire_demo$ArrayFire$en-us.htm l I followed the instructions included about lib, path and include. MS Visual studio community 2015 is installed and compiles Arrayfire example 'helloworld_vs2013.sln' and others without error. I reread this https://www.ultimatepp.org/app$ide$GettingStarted$en-us.html#5_3 and this https://www.ultimatepp.org/app$ide$install$en-us.html how to get rid of the errors having the example run? the TheIDE installation page says "we really recommend using VS2015 C++ compiler (...) better supported by 3rd party libraries" , I followed instructions on this page but only MinGW and MinGWx64 show up in the builds method. How to configure this ? should the last "visual studio code" be installed instead as recommended by MS ? (The screenshot there https://www.ultimatepp.org/app$ide$install$en-us.html is obsolete.) Below is the error as displayed by TheIDE U++ version 11390 (64bits)(GCC)(C++11) on win8.1 64bits intel x64: Toggle Spoiler (): Linking has failed (): O:/PROGS/upp/out/examples-bazaar/ArrayFire_demo/MINGWx64.Af_Cpu.Debug.Debug_Full.Main.Noblitz\ArrayFire_demo.o: In function `ConsoleMainFn_()': O:/PROGS/upp/bazaar/ArrayFire_demo/ArrayFire_demo.cpp (20): undefined reference to `__imp__ZN2af9setDeviceEi' O:/PROGS/upp/bazaar/ArrayFire_demo/ArrayFire_demo.cpp (21): undefined reference to `__imp__ZN2af4infoEv' (): O:/PROGS/upp/out/examples-bazaar/ArrayFire_demo/MINGWx64.Af_Cpu.Debug.Debug_Full.Main.Noblitz\matrix.o: In function `MatMult_device': O:/PROGS/upp/bazaar/ArrayFire_demo/matrix.cpp (12): undefined reference to `__imp__ZN2af6matmulERKNS_5arrayES2_11af_mat_propS3_' O:/PROGS/upp/bazaar/ArrayFire_demo/matrix.cpp (13): undefined reference to `__imp__ZNK2af5array4evalEv' O:/PROGS/upp/bazaar/ArrayFire_demo/matrix.cpp (12): undefined reference to `__imp__ZN2af5arrayD1Ev' O:/PROGS/upp/bazaar/ArrayFire_demo/matrix.cpp (12): undefined reference to `__im…
creator: Y ++
date: 2017-10-22T18:56:09-00:00

Re: undefined reference errors when building
type: item
description: If you have MS Visual Studio 20xx installed (it works with 2017 just as nice as with 2015 on my PC) try using U++ for Windows without toolchain downloads and not the U++ for Windows with MinGW-w64 toolchain. That should work then.
creator: rafiwui
date: 2017-10-23T06:54:47-00:00

Re: undefined reference errors when building
type: item
description: If you need the MinGW edition and just need the VS20xx compiler as well then the reason that U++ is not finding the compiler location automatically could be that you may not have installed VS on your system hard disk. That happened to me when I installed VS on a secondary. I had to give U++ the paths manually.
creator: rafiwui
date: 2017-10-23T07:36:01-00:00

Re: undefined reference errors when building
type: item
description: Dear Y++ In ArrayFire in U++ page there are some explanations about how to use ArrayFire in U++. Following the messages you have included it seems that Include files are included, but compiler does not find Library files. Have you set all folders as indicated?
creator: koldo
date: 2017-10-23T08:16:16-00:00

Re: undefined reference errors when building
type: item
description: Quote: If you have MS Visual Studio 20xx installed (it works with 2017 just as nice as with 2015 on my PC) Ok, I leave it as it is (2015) This answered the question 3. Thanks rafiwui. Quote: try using U++ for Windows without toolchain downloads and not the U++ for Windows with MinGW-w64 toolchain. That should work then. Just tried (upp-win-11405) It does not show any build method too. I tried filling manually the "build methods" panel. The documentation https://www.ultimatepp.org/app$ide$GettingStarted$en-us.html#5_3 is not very helpful and this post https:// www.ultimatepp.org/forums/index.php?t=msg&goto=46601&amp ; is confusing to me. I re-tried what it is said with the U++ without toolchain and I get this error: o:\progs\upp\uppsrc\core\Core.h (45): fatal error C1189: #error : This version of U++ REQUIRES C++11 May I ask a screenshot of a working MSC (x64) configuration ? Quote: you may not have installed VS on your system hard disk Yes it can't. (disk space usage) Quote: I had to give U++ the paths manually. That would partially answer the question 2. How to do it ? TheIDE documentation is not verbose on this. I unsuccessfully tried many paths. I need help on this if we can't figure why MinGWx64 doesn't work here. Quote: it seems that Include files are included, but compiler does not find Library files. I trust you and I can't figure out how you see this. Is it because of the .o files ? Quote: Have you set all folders as indicated? There isn't much error to do here as there are only two folder. I checked twice (more in fact). Can you confirm that it's anormal MinGWx64 cannot compile it as it's an example included in U++? And, should I take care about the All static/Shared libs/All shared settings in the "build methods" panel ?
creator: Y ++
date: 2017-10-23T16:58:15-00:00

Re: undefined reference errors when building
type: item
description: This should be a working example of an edited configuration. I have it installed on an secondary as well so feel free to copy it to the folder where the exe of TheIDE is and edit the variables to your locations. The parts starting with C:\ you probably don't have to change because windows is always installing these parts at the same location no matter where you install VS
creator: rafiwui
date: 2017-10-23T17:47:51-00:00

Re: undefined reference errors when building
type: item
description: Quote: edit the variables to your locations. The parts starting with C:\ you probably don't have to change Done, I had to change all locations : "C:\..." locations aren't the same as I have VS2015 installed instead of your VS2017. In consequence I'm not sure as some specified folders where empty, I tried to find the more accurate. And It's seems there is some progress I get this error now (Helloworld example) (): Linking has failed (): O:\upp-win-11405\upp\out\examples\AnimatedHello\MSVS17x64.Debug.Gui.Main.Noblitz\Hello.obj : fatal error LNK1112: module machine type 'X86' conflicts with target machine type 'x64'
creator: Y ++
date: 2017-10-24T07:21:14-00:00

Re: undefined reference errors when building
type: item
description: Maybe something about MinGWx64 (the first question) : when compiling it writes GUI GCC DEBUG DEBUG_FULL WIN32 why "WIN32" ?
creator: Y ++
date: 2017-10-24T07:34:31-00:00

Re: undefined reference errors when building
type: item
description: Hmm I don't know about the MinGW toolchain so I guess I can't help you there. But I may can send you my x86 config file this evening so you can try it with this.
creator: rafiwui
date: 2017-10-24T08:20:08-00:00

Re: undefined reference errors when building
type: item
description: Quote: Quote: edit the variables to your locations. The parts starting with C:\ you probably don't have to change Done, I had to change all locations : "C:\..." locations aren't the same as I have VS2015 installed instead of your VS2017. In consequence I'm not sure as some specified folders where empty, I tried to find the more accurate. And It's seems there is some progress I get this error now (Helloworld example) (): Linking has failed (): O:\upp-win-11405\upp\out\examples\AnimatedHello\MSVS17x64.De bug.Gui.Main.Noblitz\Hello.obj : fatal error LNK1112: module machine type 'X86' conflicts with target machine type 'x64' You need to build it in 64bit mode and link it with x64 libs (or 32-32bits, if that's what you intend. In short there is mismatch between the object file and library). Could you post your build method file (with *.bm extension) (if you are using Visual Studio to compile and link the external library, there is a notoriously overlooked switch that results in this error, if not; I may be able to help you if you provide your build)? Best regards, Oblivion
creator: Oblivion
date: 2017-10-24T08:53:44-00:00

Re: undefined reference errors when building
type: item
description: Oblivion wrote on Tue, 24 October 2017 10:53 You need to link it with x64 libs. But shouldn't that be set correct because I am working with basically the same paths and it works?
creator: rafiwui
date: 2017-10-24T08:57:12-00:00

Re: undefined reference errors when building
type: item
description: Quote: Re: undefined reference errors when building Tue, 24 October 2017 11:57 rafiwui Oblivion wrote on Tue, 24 October 2017 10:53 You need to link it with x64 libs. But shouldn't that be set correct because I am working with basically the same paths and it works? Not sure... There may be a left-over object (sometimes it is simply a matter of cleaning upp.out.) Or usually it is about wrong -or messed up for some reason- paths. (I can't really say more without seeing the bm file.) Best regards, Oblivion
creator: Oblivion
date: 2017-10-24T09:10:59-00:00

Re: undefined reference errors when building
type: item
description: Did you check this: .../windows kits/10/bin/x86 --- ^ | You seem to be using wrong toolchain? Shoudn't it be x64?
creator: Oblivion
date: 2017-10-24T12:31:58-00:00

Re: undefined reference errors when building
type: item
description: Interesting. I thought I changed all but seems like I missed that one. And also interesting that it works on my PC
creator: rafiwui
date: 2017-10-24T12:35:15-00:00

Re: undefined reference errors when building
type: item
description: Hello, Quote: There may be a left-over object (sometimes it is simply a matter of cleaning upp.out.) Cleaned. Then : attached : up.zip console + errors + MINGWx64.bm from U++ for Windows with MinGWx64 toolchain (arrayfire example) console + errors + MSVS17x64.bm from U++ for Windows without toolchain (.bm file from rafiwui with edited paths) (animatedHello exemple) But you, are you able to run the "examples-bazaar\ArrayFire_demo" example, if yes with MinGWx64 or/and the VS compiler ? I would prefer to do without VS if we can make MinGWx64 work. Since the build rafiwui shared is for vs2017, I consider removing vs2015 and install the "Build Tools for Visual Studio 2017" instead. It would free me disk space and (I think) make it easier to match configuration. Hence I wait for your advice about that before attempting it. Why this error: "O:\PROGS\ArrayFire\v3\include/af/defines.h (29): warning: "DEPRECATED" redefined" since there is the "using namespace" instruction ? Best regards, Y ++
creator: Y ++
date: 2017-10-25T16:10:29-00:00

Re: undefined reference errors when building
type: item
description: Oblivion wrote on Tue, 24 October 2017 14:31 Did you check this: .../windows kits/10/bin/x86 --- ^ | You seem to be using wrong toolchain? Shoudn't it be x64? And, I get the same error message when changing the path
creator: Y ++
date: 2017-10-25T17:11:10-00:00

Re: undefined reference errors when building
type: item
description: Hello Y ++ I have a litte experience with arrayfire (on OpenCL). IIRC, ArrayFire does not yet work with MinGW C++ (it has some problem with name mangling if you are using precompiled binaries, so you'll get a lot of linker error ("undefined reference" errors.).). (Unless you also compile the libs from arrayfire source) On the other hand, both Build Tools, and Visual Studio 2017 will work with it. You should consider upgrading. Please find attached a MSC bm file for Visual Studio 2017. Check out the paths, it'll give you the idea for also MS Build Tools (they are mostly same.). No other setting is required on my machine: (To speed-up, just download the binaries. I used them.) Best Regards, Oblivion
creator: Oblivion
date: 2017-10-25T19:09:16-00:00

Re: undefined reference errors when building
type: item
description: Thank you Oblivion and rafiwui for your help it works with MS build tools 2017. @ Koldo : do you think it is worth to put a note on this in the doc ? ( I've seen one can edit the srcdoc.tpp ) Quote: ArrayFire does not yet work with MinGW
creator: Y ++
date: 2017-10-26T16:47:22-00:00

Re: undefined reference errors when building
type: item
description: Sorry for the delay. Comment is just updated. It will be visible tomorrow.
creator: koldo
date: 2017-11-08T12:23:39-00:00