LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

linking problems while compiling using mingw

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.

 

0 Kudos
Message 1 of 3
(3,733 Views)
0 Kudos
Message 2 of 3
(3,710 Views)

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

0 Kudos
Message 3 of 3
(2,822 Views)