0
$\begingroup$

I am trying to use WSTP and started with the addtwo demo. I converted the template file to C using wsprep, then in Visual Studio 2013, added that, the addtwo.c file, the wstp libraries and the header file to the project. It compiled as a console app but would not link, reporting that it could not find main().

The error can be seen here:

enter image description here

What am I doing wrong?

$\endgroup$
  • $\begingroup$ Note, I'm not a windows guy! But it seems that you don't have configured your project correctly. AddTwo is a simple console application and as it looks, the project you created is not a console application. You can change that in the solution settings somewhere. Can you check that? $\endgroup$ – halirutan Feb 20 '15 at 21:56
  • $\begingroup$ Please read carefully the instructions here in the WSTP documentation. $\endgroup$ – halirutan Feb 20 '15 at 22:00
  • $\begingroup$ @halirutan addtwo is in fact not supposed to be a console application on Windows, but the fact that it complains about _main missing suggests that either the wrong source code is being compiled (not the Windows version of addtwo) or it's compiled with the wrong defines. @Michael, also, as I said in an earlier comment, you need to include one version of the library, presumably i4 for Mma 10, not all versions. $\endgroup$ – Szabolcs Feb 20 '15 at 23:28
  • $\begingroup$ Take a look here too: mathematica.stackexchange.com/q/67787/12 $\endgroup$ – Szabolcs Feb 20 '15 at 23:29
  • $\begingroup$ @Szabolcs so is this a simple mistake (for someone who is interested and read WSTP documentation)? $\endgroup$ – Kuba Dec 17 '15 at 22:14
1
$\begingroup$

It has been over a year since I asked this question and I have since gotten the demo code to compile and have built and deployed several WSTP projects of my own. I suspect that the key problem above is that I was trying to compile a console application rather than a Win32 application.

I also notice that in the Solution Explorer above I've included several unnecessary libraries. wstp32i4.lib should suffice. @Szabolcs had both of these things right at the time.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.