visual C++ 6.0

Feb 13, 2008 at 7:27am

visual C++ 6.0

Hi,

I’m very new to creating externals. I have trying to do it using C++. I am trying to compile it on visual studio C++ 6.0. I have tried graham wakefield template… but that seems to open in VC++ 2005. I am not sure how to configure it so that the file works in VC++ 6.0. Does anyone have a template that opens in VC++ 6.0?

Also, I have looked the SDK tutorials. Reading some threads on the forum, some have suggested using extern “C” int main(void) instead of just void main(void) in order to code in C++. What does this do?

I have tried to change this line and simply change the code for one of the SDK tutorial but it doesn’t seem to work. I got a syntax error : ‘string’

Thanks.

#35793
Feb 13, 2008 at 8:14am

Hi,

Don’t know much about windows, but my example is just plain C++,
should work in any decent compiler.

If the standard Max SDK projects will open in VS6 (import & convert
or whatever it is), then you should be able to add my C++ examples to
one of these projects and get it to compile (probably need to replace
the old .c file and rename a thing or two). I think I did that once,
not sure which version of visual studio it was.

Sorry I can’t help further – I really don’t use windows much these days.

G

On Feb 12, 2008, at 11:27 PM, Wei Min wrote:

>
> Hi,
>
> I’m very new to creating externals. I have trying to do it using C+
> +. I am trying to compile it on visual studio C++ 6.0. I have tried
> graham wakefield template… but that seems to open in VC++ 2005. I
> am not sure how to configure it so that the file works in VC++ 6.0.
> Does anyone have a template that opens in VC++ 6.0?
>
> Also, I have looked the SDK tutorials. Reading some threads on the
> forum, some have suggested using extern “C” int main(void) instead
> of just void main(void) in order to code in C++. What does this do?
>
> I have tried to change this line and simply change the code for one
> of the SDK tutorial but it doesn’t seem to work. I got a syntax
> error : ‘string’
>
> Thanks.
>
>

Be seeing you

grrr waaa
http://www.grahamwakefield.net

#122408
Feb 13, 2008 at 9:27am

Hi,

I don’t know much about how Max objects compile in VS as I’m on Mac for
a while, but I remember from my old days when I used to work with VS
that the Microsoft compiler is not full compatible with the gcc compiler
(at least this was the case a few years ago), which is used by default
for building the Max externals (at least this is the case on Mac, as far
as I know). Maybe you could give a try to cygwin + gcc. Again, this is
just a suggestion which I never tried, but I think it should work pretty
well.
For the compiling error you get, maybe it would help if you could give a
short extract of the source code that makes that syntax error. Without
having a portion of the code, it would be quite hard to guess the reason
why you’re getting the error.

Bye,
Adam

________________
Siska Ádám
+36 (70) 207-63-85

http://www.sadam.hu/

Wei Min wrote:
> Hi,
>
> I’m very new to creating externals. I have trying to do it using C++. I am trying to compile it on visual studio C++ 6.0. I have tried graham wakefield template… but that seems to open in VC++ 2005. I am not sure how to configure it so that the file works in VC++ 6.0. Does anyone have a template that opens in VC++ 6.0?
>
> Also, I have looked the SDK tutorials. Reading some threads on the forum, some have suggested using extern “C” int main(void) instead of just void main(void) in order to code in C++. What does this do?
>
> I have tried to change this line and simply change the code for one of the SDK tutorial but it doesn’t seem to work. I got a syntax error : ‘string’
>
> Thanks.
>
>
>
>
>

#122409
Feb 13, 2008 at 9:43am

VS2005 has massive issues with templates. What are the exact errors?
wes

On Feb 12, 2008 11:27 PM, Wei Min wrote:
>
> Hi,
>
> I’m very new to creating externals. I have trying to do it using C++. I am trying to compile it on visual studio C++ 6.0. I have tried graham wakefield template… but that seems to open in VC++ 2005. I am not sure how to configure it so that the file works in VC++ 6.0. Does anyone have a template that opens in VC++ 6.0?
>
> Also, I have looked the SDK tutorials. Reading some threads on the forum, some have suggested using extern “C” int main(void) instead of just void main(void) in order to code in C++. What does this do?
>
> I have tried to change this line and simply change the code for one of the SDK tutorial but it doesn’t seem to work. I got a syntax error : ‘string’
>
> Thanks.
>
>
>

#122410
Feb 13, 2008 at 2:57pm

Hi,

Thanks all for your suggestions. I’ll try it out tomorrow and see how it goes.

The reason why i am using this compiler and not gcc is because there was some kind of library that was done by earlier students which works on VS 6.0.

#122411
Feb 13, 2008 at 4:36pm

as far as VC goes, i’d suggest looking at their newest free “express” version. it’ll have pretty much everything you’ll need to write externals. the features they took out are mostly centered around windows development (MFC and such).
(with the ‘string’ thing… is it an stl string? if so, ‘using namespace std;’)

#122412
Feb 13, 2008 at 5:18pm

yeah, exactly.
vs8 express fixed several of the standards compliant discrepancies from vc6.
you should be able to convert any vc6 project to vc8 or vc9.
and the express versions are free and completely adequate for development, so….

#122413
Feb 14, 2008 at 3:38am

Visual Studio 6.0 was released 10 years ago in 1998. I’m not sure if
this was before or right after the ISO/IEC C++ standard was
released–but I know for a fact that this compiler is horribly broken
and compiles all kinds of broken constructs and non-standard C/C++
code. VC7 & VC8 are major improvements so you’re really better off
downloading one of the free Express Editions.

Brandon.

On Feb 13, 2008 6:57 AM, Wei Min wrote:
>
> Hi,
>
> Thanks all for your suggestions. I’ll try it out tomorrow and see how it goes.
>
> The reason why i am using this compiler and not gcc is because there was some kind of library that was done by earlier students which works on VS 6.0.
>
>
>
>

#122414
Feb 14, 2008 at 8:15am

Wei Min wrote:
> The reason why i am using this compiler and not gcc is because there was some kind of library that was done by earlier students which works on VS 6.0.

Actually it might be a good idea to port the library to standard C++.
IMHO if a C++ code doesn’t get compiled with gcc, then there might be
quite serious problems with it… (I wouldn’t ever call a code a C++
source if it doesn’t get compiled with gcc, anyway…)
So if I were you, I would ask for the library’s source and have a look
on it to see what’s wrong (if it was made by students at your university
then I’m pretty sure that the code is available somewhere).

Bye,
Adam

#122415
Feb 14, 2008 at 11:24am

#122416
Feb 14, 2008 at 12:06pm

Hi,

Peter Castine wrote:
> Tangentially, my pet peeve with gcc in both C and C++ is that the following:
>
> —
> const int kArraySize = 42;
> float myArray[kArraySize];
> —
>
> generates a compiler error with gcc. The code is fine with other compilers I’ve used. My reading of A8.6.2 in K&RII/ANSI is that it ought to go–kArraySize is a pretty constant expression. (The fine print of A8.2 may be a loophole, however).
>
>

I’m not quite sure I understood well what you wrote, but for me the
following code:

—-
#include

const int kArraySize = 42;
float myArray [ kArraySize ];

int main ( int argc, char * const argv [ ] ) {
myArray [ 0 ] = 1.0;
cout < < myArray [ 0 ];
return 0;
}
—-

would compile and run without any problem. I’m using the built-in gcc
compiler which ships with XCode 2.5, and I tried the above code with
every possible compiler dialect for it, but it compiles fine with all of
them…
(Well, I know that the gcc for XCode is some co-production with Apple,
so it might be different than the ‘classical’ gcc for UNIX/Linux, maybe
this makes the difference.)

Bye,
Adam

#122417
Feb 15, 2008 at 12:11am

>
> would compile and run without any problem. I’m using the built-in gcc
> compiler which ships with XCode 2.5, and I tried the above code with
> every possible compiler dialect for it, but it compiles fine with all of
> them…
> (Well, I know that the gcc for XCode is some co-production with Apple,
> so it might be different than the ‘classical’ gcc for UNIX/Linux, maybe
> this makes the difference.)
>

I think this is mostly for ObjC support and some of the infrastructure
quirks of OSX like Frameworks and Bundles. I’d be very surprised if
Apple touched the template compilation code.

wes

#122418
Feb 15, 2008 at 5:12am

#122419
Feb 15, 2008 at 7:57am

hi,

Thanks everyone. I think i’ve decided to use the 2005 express edition for VC. I’ve managed to get the previous library to work on that version.

I then tried to compile graham wakefields template code on VC 2005. However, i got the error “LINK : fatal error LNK1181:cannot open input file ‘……externalc74supportmax-includesMaxAPI.lib’”

why is this so?

Cheers,
wm

#122420
Feb 15, 2008 at 9:00am

This means it can’t find the MaxAPI.lib to link against. One thing you
can do is replace:
“……externalc74supportmax-includesMaxAPI.lib’” with an
explicit path pointing to where your MaxAPI.lib file is. You may or
may not have to do the same thing for MaxAudio.lib for compiling MSP
externals. Hope this helps.

On Thu, Feb 14, 2008 at 11:57 PM, Wei Min wrote:
>
> hi,
>
> Thanks everyone. I think i’ve decided to use the 2005 express edition for VC. I’ve managed to get the previous library to work on that version.
>
> I then tried to compile graham wakefields template code on VC 2005. However, i got the error “LINK : fatal error LNK1181:cannot open input file ‘……externalc74supportmax-includesMaxAPI.lib’”
>
> why is this so?
>
> Cheers,
> wm
>
>
>
>
>

#122421
Feb 20, 2008 at 7:40am

Hey,

I’ve managed to get it to work. Thanks for your help. I’m really impressed by all the quick replies from the community.

However, I’ve a couple of questions. How can i add extra inlets/outlets?

Also. how can i program such that it takes in messages in order to decide the parameter to change? (eg. like the vst object where u can prepend the relevant parameters in order to change the value.)

Cheers,
Wm

#122422
Feb 20, 2008 at 11:02am

There’s an entire chapter about this in WritingExternals.pdf (Chapter
6)–it lists all inlet/outlet creation routines called within the
instance creation function as defined in the API. You’ll want to read
it.

On Feb 19, 2008 11:40 PM, Wei Min wrote:
>
> Hey,
>
> I’ve managed to get it to work. Thanks for your help. I’m really impressed by all the quick replies from the community.
>
> However, I’ve a couple of questions. How can i add extra inlets/outlets?
>
> Also. how can i program such that it takes in messages in order to decide the parameter to change? (eg. like the vst object where u can prepend the relevant parameters in order to change the value.)
>
>
> Cheers,
> Wm
>

#122423
Feb 26, 2008 at 10:09am

I read the chapter and looked at the examples but am still very confused. It looks so different from the graham example which uses obex and MAXCPP class. I tried to use addinx((method)t_class, index) but it doesn’t seem to work.

#122424
Feb 26, 2008 at 2:45pm

A C++ template wrapper around a Max external is going to look different from the actual C code as published in the SDK.

No surprises there.

Frankly, I would start from the SDK. It’s not particularly difficult and the SDK gives instructions for setting up under Virtual Studio.

I’m sure Graham’s C++ wrapper has some conveniences, but with most wrapper frameworks things make a lot more sense if you’ve gone through at least a simple example in the underlying API.

– P.

#122425
Feb 27, 2008 at 3:17am

I have looked and tried a couple of SDK examples. However, I want to make the external in C++ and so i’m using the template. I’m not sure how else to get started on it. The template seems to use obex.h and i’m really confused on how attr are allocated in this case as compared to a normal SDK. My understanding is that it just adds an attribute for the class and allocate memory accordingly. However, I can’t seem to add inlets/outlets. Can someone explain how the C++ wrapper template work or how to add inlets/outlets on it.

Thanks.

#122426
Feb 27, 2008 at 6:33am

I get this error check failed:getfn(in1):corrupt object. what does this mean?

#122427
Feb 27, 2008 at 7:04am

or does anyone have a simple C++ external compiled with just SDK and no obex?

#122428
Feb 27, 2008 at 8:54am

I’ve been reading the pattrsdk manual and i’m convinced that intin(this, 1); in the constructor would work. But it doesn’t and I get this error “check failed:getfn(in1):corrupt object”.

I’m currently rushing this project for school. I’ll appreciate if someone can look through the graham wakefield’s template and let me know how i can add inlets/outlets. I think i should have no problem binding methods to them. My understanding is that i just class_addmethod(c, (method)CPPMaxExample::Methodname, “in1
, A_LONG, 0);.

Thanks.

#122429
Feb 27, 2008 at 9:10am

Try throwing this in your constructor:

myoutlet = outlet_new(this, 0);

wes

On Wed, Feb 27, 2008 at 12:54 AM, Wei Min wrote:
>
> I’ve been reading the pattrsdk manual and i’m convinced that intin(this, 1); in the constructor would work. But it doesn’t and I get this error “check failed:getfn(in1):corrupt object”.
>
> I’m currently rushing this project for school. I’ll appreciate if someone can look through the graham wakefield’s template and let me know how i can add inlets/outlets. I think i should have no problem binding methods to them. My understanding is that i just class_addmethod(c, (method)CPPMaxExample::Methodname, “in1
> , A_LONG, 0);.
>
> Thanks.
>
>
>

#122430
Feb 27, 2008 at 9:25am

It worked. I’ve been so stupid. All along the msg occured because i bind a method to in1 but the inlet wasn’t created. This is because i was testing the wrong external. I had an object with the same name in Max startup. And so when i click on the release file, it somehow loaded the old version still.. lol

#122431

You must be logged in to reply to this topic.