Compiling and linking with G++

greg kellum's icon

Hi all,

I usually work on OS-X, but I've been trying to build a Windows version of one of my objects that was written in C++ using G++ in Cygwin. There are instructions on how to do this in the Windows SDK for gcc but not for g++. Um... I had no problem figuring out which command I needed to use to get g++ to compile the files, but when I tried to link the files, unfortunately g++ is unable to find the Max libraries that I gave as arguments.

For example when trying to compile the example MSP application plussz~ with the command:

g++ -shared -mno-cygwin -L../../c74support/max-includes -lMaxAPI -L../../c74support/msp-includes -lMaxAudio -o plussz~.mxe plussz~.o plussz~.def

I got the error message:
Cannot export ⌂MaxAudio_NULL_THUNK_DATA: symbol not found
plussz~.o:plussz~.c:(.text+0x4e): undefined reference to `_z_dsp_free'

plussz~.o:plussz~.c:(.text+0x62): undefined reference to `_setup'
plussz~.o:plussz~.c:(.text+0x86): undefined reference to `_addmess'
... and so on...

I'm sure that I'm going some little thing wrong. Missing some flag or something along those lines. Does anyone know what it is that I might have done wrong here?

Thanks,
Greg

Brad Garton's icon

Greg --

You might take a look at the Makefiles I used to compile rtcmix~ for
windows (source is here, down towards the bottom of the page):

I was able to use g++ to compile the main RTcmix code and then drag
it into the rtcmix~ object. It's pretty grungy code, though.

Quoting Greg Kellum :

>
> Hi all,
>
> I usually work on OS-X, but I've been trying to build a Windows
> version of one of my objects that was written in C++ using G++ in
> Cygwin. There are instructions on how to do this in the Windows
> SDK for gcc but not for g++. Um... I had no problem figuring
> out which command I needed to use to get g++ to compile the
> files, but when I tried to link the files, unfortunately g++ is
> unable to find the Max libraries that I gave as arguments.
>
> For example when trying to compile the example MSP application
> plussz~ with the command:
>
> g++ -shared -mno-cygwin -L../../c74support/max-includes -lMaxAPI
> -L../../c74support/msp-includes -lMaxAudio -o plussz~.mxe
> plussz~.o plussz~.def
>
> I got the error message:
> Cannot export ⌂MaxAudio_NULL_THUNK_DATA: symbol not found
> plussz~.o:plussz~.c:(.text+0x4e): undefined reference to
> `_z_dsp_free'

> plussz~.o:plussz~.c:(.text+0x62): undefined reference to `_setup'
> plussz~.o:plussz~.c:(.text+0x86): undefined reference to
> `_addmess'
> ... and so on...
>
> I'm sure that I'm going some little thing wrong. Missing some
> flag or something along those lines. Does anyone know what it is
> that I might have done wrong here?
>
> Thanks,
> Greg
>
>

greg kellum's icon

Hi,

Thanks, Brad. After looking at your makefile I was able to figure out what I did wrong. I didn't create a def file, and my arguments were apparently ordered incorrectly.

Best,
Greg