01-18-2013 04:33 AM
Hello,
Thanks to several tricks, I have managed to make CVI use mingw as an external compiler on CVI 8.5.0.
I still have some troubles that I can bypass, but I would like to understand why do I need to do things the way I'm doing it.
There are 2 linking problems. Here are the original messages:
Undefined symbol '___chkstk_ms' referenced in "some_file.c".
Undefined symbol '___main' referenced in "Main.c".
Concerning the first one, the only way I found to avoid the problem is to use "-mno-stack-arg-probe" when compiling using mingw.
Suprisingly, I haven't found any other way such as adding some .lib (or .a because of mingw). Maybe I have done something wrong but I just don't get it.
Concerning the second problem, the only way I found (thanks to many searches with google) to avoid the problem is to define such a function:
int __main(void) { return 0; }
This one is totally mysterious to me...
I know that mingw is not supposed to be a supported compiler (I will make another thread to explain how I managed to use it), but I want to understand my quite stange (at least, to me) linking problems.
If any CVI guru can give me some links/explanation, I would be grateful.
Most likely, I will also ask similar questions to some gcc/mingw guru, but let's try here first. 🙂
Please note that these problems only occur if I do the linking in the CVI IDE (for practical reasons, this is my prefered way). If I build a separate project in CodeBlocks for instance, the linking goes fine.
This is why I do suspect some incompatibility between mingw compiler and CVI linker.
Best regards,
Frédéric Lochon.
01-22-2013 07:41 AM
Hi Fédéric,
Since it is not a supported compiler, it will be hard to answer you. Maybe the following links can give you some informations :
http://zone.ni.com/reference/en-XX/help/370051M-01/cvi/programmerref/extcompilerversionssup/
http://zone.ni.com/reference/en-XX/help/370051M-01/TOC34.htm
http://zone.ni.com/reference/en-XX/help/370051M-01/cvi/programmerref/compwithextcompilers/
Best Regards
Jean-Luc D. NI France
National Instruments France
11-14-2017 11:45 AM
Hello Frédéric,
You just said that you can compile with MinGW and link with CodeBlocks. Well this is exactly what I looking for but I keep geting 'undefined references' at compile time on the trial functions I am trying to use. I use MinGW 4.8.1 and CodeBlocks 16.01. Can you send the some more info on this subject ?
Thanks
GPinto