PDA

View Full Version : VC++ Express?



colkai
04-06-2006, 03:30 AM
Hi,
I've got a copy of VC++ Express 2005 which is (according to MS) free to register and I wondered if it was worth me doing so?
I'm only really interested in it if I can create plugins with the LW SDK using it.

So, in a nutshell, is it possible?

Lightwolf
04-06-2006, 04:42 AM
So, in a nutshell, is it possible?
Yes, it is. In a nutshell.

Make sure you install the Platform SDK as well (check out the MS on how to do that) and you should be all set.

I've been using it for 6 months now to develop LW plugins (even 64bit versions with a bit of trickery). Having an optimizing compiler for free is nice!

Cheers,
Mike

colkai
04-06-2006, 05:09 AM
I've selected just the core SDK and debugger (X86 only as I'm non-64 bit). Is this going to be enough?

Lightwolf
04-06-2006, 05:19 AM
I've selected just the core SDK and debugger (X86 only as I'm non-64 bit). Is this going to be enough?
That should be enough. You don't need the debugger since MSVC++ Express already includes a 32bit debugger.

This link should help you install the PSDK: http://msdn.microsoft.com/vstudio/express/visualc/usingpsdk/

Cheers,
Mike

colkai
04-06-2006, 06:10 AM
thanks! :) i'll have a read whilst i'm on me lunch break.

Elmar Moelzer
04-06-2006, 06:12 AM
Hey Michael!
How did you get it to do 64bit compiles?
CU
Elmar

Lightwolf
04-06-2006, 06:13 AM
thanks! :) i'll have a read whilst i'm on me lunch break.
Well, most of the work is finding the proper files and editing them.

then again, I've done it on three machines so far, and it actually works ;)

Cheers,
Mike

Lightwolf
04-06-2006, 06:24 AM
Hey Michael!
How did you get it to do 64bit compiles?
CU
Elmar
You need the 64bit PSDK which includes it, and set a couple of environment variables and then start MSVC++ from a batch file.

Let me just look for the link... can't find it, sorry.
Basically, You need the free MS Server 2003 SP1 PSDK which includes the 64bit compiler http://www.microsoft.com/downloads/details.aspx?FamilyID=a55b6b43-e24f-4ea3-a93e-40c0ec4f68e5&DisplayLang=en.

Then, depending on what target you want to compile to, you open the IDE using either batch file:
64 bit version:


call "f:\Program Files\Microsoft Platform SDK\SetEnv.Cmd" /XP64 /RETAIL
start "" "F:\Program Files (x86)\Microsoft Visual Studio 8\Common7\IDE\VCExpress.exe" /useenv
32 bit version:


call "F:\Program Files (x86)\Microsoft Visual Studio 8\VC\vcvarsall.bat" x86
start "" "F:\Program Files (x86)\Microsoft Visual Studio 8\Common7\IDE\VCExpress.exe" /USEENV

...adjust the paths to your linking.

Cheers,
Mike

Elmar Moelzer
04-06-2006, 06:26 AM
Hey Michael!
Thanks a lot!
Gonna try it!
CU
Elmar

Lightwolf
04-06-2006, 06:27 AM
Hah, I found the original link:

http://www.toymaker.info/Games/html/64_bit.html

Edit: It only talks about MSVC 2003, but it works just as well with 2005 Express.

Cheers,
Mike

Elmar Moelzer
04-06-2006, 06:31 AM
Cool! Thanks!
CU
Elmar

Lightwolf
04-06-2006, 06:40 AM
Cool! Thanks!

You're very welcome...

Oh, and it works as well ;)

Cheers,
Mike

colkai
04-07-2006, 06:49 AM
Ok,
I've got VCExpress running ... kinda... sorta. :p
I edited the lines in the text files as advised in the setup data.
I've tried to follow Aurora's tutorial for creating a 'Hello World' plugin but it isn't working. I'm almost 100% sure it's because I've done / not done something.

I've attached my sad attempt at a project. If someone could look at it, and once they have picked themselves up of the floor and wiped the tears of laughter away, maybe I could get some help please? ;) :p

Lightwolf
04-07-2006, 06:55 AM
Well, maybe if you post a part of your error log it would be easier to help.
I can get the code to compile here, but I had to change some paths to make it work (and it wouldn't work on your side).

Cheers,
Mike

Lightwolf
04-07-2006, 07:05 AM
Sorry, I forgot to ask... which version of the LW SDK are you using?

Cheers,
Mike

colkai
04-07-2006, 07:36 AM
This is what I get as an error


------ Build started: Project: PLUG01, Configuration: Debug Win32 ------
Compiling...
hello.cpp
f:\colkaicode\msvce_projects\plug01\plug01\hello.c pp(121) : error C2857: '#include' statement specified with the /Ycstdafx.h command-line option was not found in the source file
Build log was saved at "file://f:\ColKaiCode\MSVCE_PROJECTS\PLUG01\PLUG01\Debug\B uildLog.htm"
PLUG01 - 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


The SDK is the one linked to: Windows® Server 2003 SP1 Platform SDK

What's odd is, the first time I compiled it, I'm sure it came up with 5 errors

Lightwolf
04-07-2006, 07:39 AM
I actually meant the LW SDK... sorry.

But we're getting there. In your Project Settings -> C/C++ -> Precompiled Headers : Set "Create/Use Precompiled Header" to "Not using..."

Then try again.

Cheers,
Mike

colkai
04-07-2006, 07:43 AM
Ahh, LW SDK is the one from the LW8.5 install - at least, it's the LW8 SDK for sure

Now get:


Compiling...
hello.cpp
Compiling manifest to resources...
Linking...
servdesc.obj : error LNK2005: _ServerDesc already defined in hello.obj
servdesc.obj : error LNK2001: unresolved external symbol _Activate
servdesc.obj : error LNK2001: unresolved external symbol _ServerName
servdesc.obj : error LNK2001: unresolved external symbol _ServerClass
F:\ColKaiCode\MSVCE_PROJECTS\PLUG01\Debug\PLUG01.d ll : fatal error LNK1120: 3 unresolved externals
Build log was saved at "file://f:\ColKaiCode\MSVCE_PROJECTS\PLUG01\PLUG01\Debug\B uildLog.htm"
PLUG01 - 5 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========


I've not got a server.lib file, I'm just including the source files - is that relevant, it sorta looks like it may be?

Lightwolf
04-07-2006, 07:46 AM
Ahh, LW SDK is the one from the LW8.5 install - at least, it's the LW8 SDK for sure

Now get:
Now we're progressing (btw, you can use code instead of quote... and I'll be able to quote your code ! ... ? *puzzled* ;) ).

Remove serverdesc.c from your project, try again.

edit: I don't use the server.lib either. It should work o.k. without it.

Cheers,
mike

Lightwolf
04-07-2006, 07:48 AM
You should also add the serv.def to your source files to make sure that _mod_descrip will get exported.

Cheers,
Mike

colkai
04-07-2006, 08:05 AM
Getting closer for sure, now there are no errors, but I don't end up with a DLL either


Compiling...
servmain.c
shutdown.c
startup.c
username.c
Generating Code...
Compiling...
hello.cpp
Compiling manifest to resources...
Linking...
LINK : F:\ColKaiCode\MSVCE_PROJECTS\PLUG01\Debug\PLUG01.d ll not found or not built by the last incremental link; performing full link
Embedding manifest...
..But it doesn't seem to do anything, this is so close I know it!
Here's the full debug text..

aurora
04-07-2006, 09:03 AM
Hey Colkai and Kyla, This is cool you 'finally' ventured into plugin programming. Sorry your having problems so soon. Can you zip up what you have an Email it to me? I'll be more then happy to look at it. Also let me know the directory setup you have for you library and include directories so I can recreate them exactly on my side.

Lightwolf
04-07-2006, 09:10 AM
We got the plugin to compile, and the last culprit seems to be

Project Properties -> C/C++ -> Code Generation -> Turn off Basic Runtime checks to "Default"

I got it to work, and I think Colkai will as well...

Cheers,
Mike

colkai
04-07-2006, 09:12 AM
Hehe, famous last words :p

Well, here are my source files and such.
I'll be winging my way south in a bit so please don't bust a gut over this - I really appreciate all the effort so far in helping a floundering SDK virgin. :thumbsup:

I'm only back on Monday so please don't think I'm ignoring you if you post meantimes. :)

Lightwolf
04-07-2006, 09:14 AM
Hehe, famous last words :P
:twak: welcome to the wonderful world of plugin programming ;)

Cheers,
Mike

aurora
04-07-2006, 09:33 AM
Well then Bravo, and sorry I was late to the game Colkai.
Hehe, Mikes interpretation of SDK programming is only partly true. You seldom get the chance to shack it all off :D

Lightwolf
04-07-2006, 09:41 AM
Hehe, Mikes interpretation of SDK programming is only partly true. You seldom get the chance to shack it all off :D
That is true... but you get used to the pain after some time ;)

Cheers,
Mike

GregMalick
04-07-2006, 09:49 AM
Aloha colkai,

Why don't you use the project files that come with the SDK.
You only have to change the plugin name (as I recall) and probably the directory to place the plugin. And that's all within the VC++ IDE properties panel. The SDK vcproj files work (almost) perfectly with VC++ 2005.

I was up and running within hours.

Learning the nuances of the SDK is another story for me :stumped:


(oh Aurora - I got the non-nodal panel working - now I'm working on TREE_CTL)

colkai
04-10-2006, 02:22 AM
Ok, colour me stupid, I didn't even realise there were any project files.
I'm "back" for a couple of days, before off for my Easter work-break.

OT: Tim, you should of seen the wild Peregrine we had in - awesome she was, gonna upload a pic to send you soon. :D

Lightwolf
04-10-2006, 03:30 AM
Ok, colour me stupid, I didn't even realise there were any project files.
Well, I saw them but forgot about them instantly again. Especially since by now I have my own way of setting up projects (for various reasons).
Nice to see them in the SDK now though!
Cheers,
Mike

colkai
04-10-2006, 03:49 AM
Interesting, I loaded up the Capsule SDK example project and it compiles and runs fine. Going to try a layout plugin and see if that works.

colkai
04-10-2006, 04:20 AM
OK - Layout "scene info" works, but my test does not. However, if I set SceneInfo to include serv.def but remove it from the Project 'linker->Input->Module Definition File area (normally shown as ../../../source/serv.def) - Then I get the same error about failing to load an external module as per the test I'm trying.

UPDATE: Finally!!!
Got it to compile and load into Layout and work. Seems there is a very specific setup, but now I have it, I should be able to continue to learn the SDK. The only thing I'm going to try now is changing the code from a ".C" to ".Cpp" and make the changes to recognise that and see if I can get it to load and run as I'd expect.
Watch this space...

PS: I'ts just a shame you can't save the Project as a different name so you could start with a known good project file. Or can you? :)

Edit_2
Nuts,
Nope - no workee as CPP code ... get the error:
f:\colkaicode\msvce_projects\plug01\plug01\hello.c pp(84) : error C2059: syntax error : 'string'

which relates to the suggested code change of:


/* The below is only valid for pure C code - not CPP code */
/*
ServerRecord ServerDesc[] =
{
{LWLAYOUTGENERIC_CLASS, "Hello World", HelloworldPanel},
{NULL}
};
*/

/* This is valid for CPP not C */
extern "C" {ServerRecord ServerDesc[] =
{
{(const char*)LWLAYOUTGENERIC_CLASS, (const char*)"Hello World", HelloworldPanel},
{NULL}
};
}

aurora
04-10-2006, 09:08 AM
PS: I'ts just a shame you can't save the Project as a different name so you could start with a known good project file. Or can you?
Sadly M$ Visual Studios still don't allow easy refactoring of projects. Thats one thing I kinda like about the Eclipse IDE its ultra fast and easy to refactor an entire project so you can have a base project, rename it and go all in seconds. But alas I have to admit I'm a hard core VC developer.
But to answer your question, yes you can but the effort to do so is worse then just starting from scratch. What you can do is create a wizard that allow you to create fresh plugin projects just the same as saying you want to create a new .dll project. Just don't ask me how to do it with .NET 2005. While I have it on my machine I only have it for that 'just in case' scenerio. In fact unless specifically requested by a client for a .NET build I always was VC6.
On the bright side after doing a few new projects it becomes second hat for you. One thing you might want to do is just go through the process of creating a generic plugin and write your steps down and save it to be used as a checklist for the next time.

GregMalick
04-10-2006, 09:20 AM
colkai,

When I started, I just copied an entire sample plugin folder to another name and began changing it. I did that mostly so I could always go back to the original in case I accidentally deleted something important.

I suppose you could make a shell for each type - but I personally don't write that many plugins to make it worthwhile.


BTW, if you figure out how to automatically link all the project object files together, let me know. I'm having to add extern funcName() whenever I need access to something in another .c file of the project. It's not a big deal to type that, but I imagine there is a way to do this.

Last bit of advice - join the Lightwave Plugin Developers Group on Yahoo. Ernie & Jarno hang out there and their advice is golden! Past messages are a good place to first search for specific advice on LW plugin development.

Lightwolf
04-10-2006, 09:48 AM
BTW, if you figure out how to automatically link all the project object files together, let me know. I'm having to add extern funcName() whenever I need access to something in another .c file of the project. It's not a big deal to type that, but I imagine there is a way to do this.

Not really, that's the way it should be in C...
What I do is I create one server.c which houses the ServerRecord for all plugins, and also extern my init functions in there. Then I can just link all plugins to one .p.

Cheers,
mike

aurora
04-10-2006, 10:55 AM
I agree, thats pretty much the way I do it to. It also works when dealing with classes in sep files.

colkai
04-10-2006, 11:01 AM
Thanks guys, dunno why the error message is happening when I compile as C++ but hey hoo, it may come to light as I get into it.

If I have to operate in 'pure C' for now, so be it. I'll probably find a point where I wonder why I had a problem if I do make a concerted effort to learn this stuff.
(Beats my day-job code for sure).

BTW Tim, dunno if non-members can see the thread, but...

http://www.falconryforum.co.uk/showthread.php?t=12822&page=2

If you can't see the images, let me know :)

Lynx3d
04-11-2006, 05:46 AM
My i ask which line is 84 in the above code snippet? I don't see any 'string' in what you posted...and could it be it should've been 'std::string'?

colkai
04-11-2006, 06:37 AM
oops, my bad, the line in question was:


{(const char*)LWLAYOUTGENERIC_CLASS, (const char*)"Hello World", (ActivateFunc*)HelloworldPanel},


Though I noted that '(ActivateFunc*)' was not colour code as I'd expect so my gut feeling was that was somehow implcated. In the above code I showed, I missed out that little bit.

Lightwolf
04-11-2006, 06:42 AM
In my C++ plugins I don't need to cast any of these, since the strings "..." are const char * anyhow. Weird.

Also, if the HelloworldPanel function has exactly the same syntax as ActivateFunc (and is extern "C"'d) you wouldn't need to cast it either.

Cheers,
Mike

colkai
04-11-2006, 07:08 AM
So how would you write that particaular line Mike?

Lightwolf
04-11-2006, 07:23 AM
So how would you write that particaular line Mike?
Oops, sorry:


HelloworldPanel(long version, GlobalFunc *global, void *l, void *serverData)
{
LWLayoutGeneric *local = (LWLayoutGeneric *)l;
// or as a proper C++ cast:
LWLayoutGeneric *local = static_cast<LWLayoutGeneric *> (l);
/* snip */
}
extern "C" ServerRecord ServerDesc[] =
{
{LWLAYOUTGENERIC_CLASS, "Hello World", HelloworldPanel},
0
};

Basically, since I replaced the LWLayoutGeneric *local in the HelloworldPanel() function declaration with void *l and then cast within the function, I don't have to cast later on in the ServerRecord.

Otherwise the C++ compiler complains beacuse it expects:
Activatefunc(long version, GlobalFunc *global, void *l, void *serverData);
but gets
Activatefunc(long version, GlobalFunc *global, LWLayoutGeneric *l, void *serverData);
C is a lot more forgiving in this case (and yes, I prefer the strictness of C++).

Cheers,
Mike

colkai
04-11-2006, 07:40 AM
Sir, you are, without any doubt, most kind. :D :D

Of course, it may take me a few days to actually understand all this :p

Geez, I actually used to know C++ honest, my day-job is making me dumb I swear! ;)

Of course, I never did get to grips with the SDK so thats a whole new ball of wax. :)

Lightwolf
04-11-2006, 07:45 AM
Sir, you are, without any doubt, most kind. :D :D

Lol, nah, I just had the time ;)


Of course, it may take me a few days to actually understand all this :p

Geez, I actually used to know C++ honest, my day-job is making me dumb I swear! ;)

Of course, I never did get to grips with the SDK so thats a whole new ball of wax. :)
Actually, that is more of a C vs. C++ issue than an SDK issue. Unfortunately the SDK samples use some "dirty" tricks that are perfectly legal in C, but cause problems compiling as C++.

Since you brought it up... what is your day job anyhow? And what do you transform into once the sun sets? ;)

Cheers,
Mike

colkai
04-11-2006, 07:50 AM
Hehe, sad to say my day job involves coding in a tiresome 4GL system, I have used C++ / C in the past, but now I only get to use them on the odd occasion, which inevitably means a period of "re-ajdustment". :p

At night, I turn into a zombie after a long day at work ;)
Or I plonk down at a computer, (hey ..imagine that) and try and get some LW done, or some promotional work for the Centre.
At weekends, I get to act as falconers assistant, which makes up for the day job somewhat. :D
This weekend, I am hopefully going to be run off my feet as we beat last Easters attendance figures. (Hey, gotta aim high!)

EDIT
What is the purpose of the LWLayoutGeneric *local = static_cast<LWLayoutGeneric *> (l); as I don't see any reference to a variable 'local' or am I mis-interpeting the code.
(Apologies for my idiocy, been too long away from C++)

ReEdit - Now getting an error on the line...
extern "C" ServerRecord ServerDesc[] =

which reads...
f:\colkaicode\msvce_projects\plug01\plug01\hello.c pp(93) : error C2059: syntax error : 'string'

Urrgh, I just know this is something silly.

Lightwolf
04-11-2006, 11:46 AM
What is the purpose of the LWLayoutGeneric *local = static_cast<LWLayoutGeneric *> (l); as I don't see any reference to a variable 'local' or am I mis-interpeting the code.

In this case it does have no pupose. Normally this is a plugin specific structure passed by LW for you to fill in with pointers to your actual function calls, the ones that make up your plugin (i.e. load, save, evaluate etc.).


ReEdit - Now getting an error on the line...
extern "C" ServerRecord ServerDesc[] =

which reads...
f:\colkaicode\msvce_projects\plug01\plug01\hello.c pp(93) : error C2059: syntax error : 'string'

I really wonder why, because I don't. I'd almost say this is a compiler setting, but I don't know which one.
You might want to re-add the (const char *) casts, even though they shouldn't be necessary.

Cheers,
Mike

Lynx3d
04-11-2006, 12:29 PM
Err...stupid question, two times now the error message says "hello.c pp"...did you perhaps accidently put a white space in the extension?
The compiler may actually think it is a C source and hence clueless about the 'extern "C"' stuff...

colkai
04-11-2006, 12:38 PM
Err...stupid question, two times now the error message says "hello.c pp"...did you perhaps accidently put a white space in the extension?
The compiler may actually think it is a C source and hence clueless about the 'extern "C"' stuff...
Nope - the code itself is definitely a CPP extension, but you do have me wondering.

colkai
04-11-2006, 12:41 PM
In this case it does have no pupose. Normally this is a plugin specific structure passed by LW for you to fill in with pointers to your actual function calls, the ones that make up your plugin (i.e. load, save, evaluate etc.).
Oh right, I'm sure this will come to me in the fullness of time. :)


I'd almost say this is a compiler setting, but I don't know which one.
You might want to re-add the (const char *) casts, even though they shouldn't be necessary.

I know, it is, as they say, doin' my 'Ead in ;)
I wouldn't be at all surpised to find it's a compiler switch, the fact that it's on the function line seems to me it's somehow mis-interpreting the extern "C" as something else. I'll take another look at this when I get back to work tomorrow as I don't currently have it on my home PC. Though that may change - even if I am reluctant to upgrade this to IE6 hehe.

I hate mucking with my home PC as I use it for video and LW too. :compbeati

GregMalick
04-19-2006, 11:08 AM
Is there anyway to printf variables to the Output window? Something like the debug() statement in VB.

Tracing is can be tedious if you have to write down values and I just don't feel like adding all the code to output to a text file.

Lynx3d
04-19-2006, 12:07 PM
Gregory, i don't know VB, but for simple feedback i mainly use two things, tracefiles (i.e. simply fprintf it to a textfile, ideal if you want to work normally and see afterwards if callbacks were handled as expected or e.g. unexpectedly skipped) and LWMessageFuncs global functions info(...) and error(...) to interrupt stuff.

Of course debuggers have been invented too, but somehow i never find them too usefull except for tracebacks, but may come from my lack of programming education...
My interesting values either end up being in some loop with hundreds of iterations or the errors are so infrequent that breakpoints or stepping through code seems pointless waste of time too...

GregMalick
04-19-2006, 12:54 PM
I assume you open the file in Create() & close it in Destroy() ;)
Well if i must i must.

The VC++ & VB6 IDE has an Output window.
VB6 as a debug() command which allows you to display (and even set) variable values. I would hope that VC++ would have the same capability - but that's not assured.

I suppose I could write the file routines in an #include and use them as necessary. I believe that VC++ closes all files even when you crash - so I wouldn't have to code that. I wonder if I can conditionally include files using an #IFDEBUG. hmmmm.....:question:

Lynx3d
04-19-2006, 01:23 PM
Well, actually there appears to be such a function in the MSVC runtime...
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_CRT__CrtDbgReport.asp

And, i open and close my trace file on each call, because it does not get closed when the program crashes and hence is empty (at least with MinGW which i usually used for LW plugins, though lately i have done quite a bit with the msvc7.1 compiler, however not with the Visual Studio IDE)

Lightwolf
04-19-2006, 01:57 PM
Much easier:

OutputDebugStringA(const char *text);

Edit: This can be traced using the MSVC debugger, as well as http://www.sysinternals.com/Utilities/DebugView.html (you might need to filter there), there is also a little debug tool from MS that just displays the output.
WinDBG should do it as well.

And a C++ class to do the same thing using <<:


#pragma warning (push,1)
#include <Windows.h>
#include <ostream>
#include <sstream>
#include <string>
#include <ios>
#pragma warning (pop)
#pragma warning(disable : 4996)
#pragma warning(disable : 4530)
#pragma warning(disable : 4291) // warning no matching delete operator found

template <class CharT, class TraitsT = std::char_traits<CharT> >
class basic_debugbuf :
public std::basic_stringbuf<CharT, TraitsT>
{
public:
virtual ~basic_debugbuf()
{
sync();
}

protected:
int sync()
{
output_debug_string(str().c_str());
str(std::basic_string<CharT>()); // Clear the string buffer
return 0;
}

void output_debug_string(const CharT *text) {}
};


template<>
void basic_debugbuf<char>::output_debug_string(const char *text)
{
::OutputDebugStringA(text);
}

template<>
void basic_debugbuf<wchar_t>::output_debug_string(const wchar_t *text)
{
::OutputDebugStringW(text);
}

template<class CharT, class TraitsT = std::char_traits<CharT> >
class basic_dostream :
public std::basic_ostream<CharT, TraitsT>
{
public:
basic_dostream() : std::basic_ostream<CharT, TraitsT>(new basic_debugbuf<CharT, TraitsT>()) {}
~basic_dostream()
{
delete rdbuf();
}
};

typedef basic_dostream<char> dostream;
typedef basic_dostream<wchar_t> wdostream;

Original code: http://www.codeproject.com/debug/debugout.asp

Sample usage:


#ifdef _DEBUG // just in case...
dostream dout;
dout << "Panel:" << panel << "\n";
#endif // _DEBUG

This works with MSVC, apparently not with GCC though.

Cheers,
Mike

Lightwolf
04-19-2006, 02:07 PM
While we're at it, if you prefer printf style output:
http://www.toymaker.info/Games/html/debugger.html

Cheers,
Mike
P.S. Before you asked: Yes, I did a bit of research on that topic ;)

GregMalick
04-19-2006, 06:17 PM
Lynx3D,
thanks. I already tried _CrtDbgReport - but although it compiles and goes through the code OK, nothing gets displayed in the Output window.

LightWolf,
The OutputDebugString looks to be perfect. It compiles and the code passes through it - but just like the _CrtDbgReport nothing is showing up in the Output window. Lord knows were this stuff is being passed to. SpinQuad is probably receiving all my debug messages and wondering what the heck all that stuff is....:lol:

Lightwolf
04-19-2006, 06:20 PM
Are you running a debug compile (with the debug libraries linked to it) and launching LW from within MSVC?

If you don't run a debug compile it won't show at all (afaik), and if you don't start LW from the debugger in MSVC it won't show in the MSVC output window (but would show in the other debuggers).

Cheers,
Mike

GregMalick
04-19-2006, 06:49 PM
LightWolf,
Yep - I'm running a debug compile & launching LW from the within MSVC. I even run LW with a special config that loads my Master plugin (lazy guy that I am). I can't imagine any other way of testing my program.

I don't recall adding any special debug libraries to the compile. I just selected the debug compile (well I had to set that up a little).

What libraries should I check for in the Project Properties.
I'm assuming these libraries would be added (if at all) to the Additional Dependencies in the Linker Input area. :D

By the way - I really appreciate the feedback from both of you.
:thumbsup:

GregMalick
04-19-2006, 07:47 PM
Anyway, I ended up writing a scrap of code in myDebug: whihc I can include as needed:



#include <windows.h>
#include <stdio.h>
#include <conio.h>
#include <io.h>
#include <stdlib.h>
#include <string.h>

#include <lwserver.h>
#include <lwio.h>

static LWFileIOFuncs *fiof = NULL;
static LWSaveState *ss = NULL;
static char fileName[] = "c:\\TEMP\\DEBUG.TXT";

void debugLine(GlobalFunc *global, char *strName) {

fiof = global( LWFILEIOFUNCS_GLOBAL, GFUSE_TRANSIENT );
if (!fiof) return;
if (!ss) ss = fiof->openSave( fileName, LWIO_ASCII );
if ( ss ) LWSAVE_STR( ss, strName);
}

void closeDebug(void) {
if (ss) fiof->closeSave( ss );
}

It seems to work fine.
Just include it in a project and add the externs to your header and include the close in your Destroy();
I still wish I didn't have to use NotePad and could use that Output window!

GregMalick
04-19-2006, 08:10 PM
tweaked the close routine:


void closeDebug(void) {
if (ss) {
fiof->closeSave( ss );
ss = NULL;
}
}

Lightwolf
04-20-2006, 01:15 AM
What libraries should I check for in the Project Properties.
I'm assuming these libraries would be added (if at all) to the Additional Dependencies in the Linker Input area. :D

C/C++ -> Code Generation -> Runtime Library: either Multi-threaded Debug or Multi-threaded Debug DLL.
_DEBUG should also (automatically) be define in C/C++ -> Preprocessor -> Preprocessor definitions.

Cheers,
Mike
P.S. Any you're very welcome! :D

GregMalick
04-20-2006, 02:13 AM
C/C++ -> Code Generation -> Runtime Library: either Multi-threaded Debug or Multi-threaded Debug DLL.
Yep I have it

_DEBUG should also (automatically) be define in C/C++ -> Preprocessor -> Preprocessor definitions.
also - I have it.

so it's set up already....

colkai
04-20-2006, 02:29 AM
ooh, ain't I glad I left my "subscription" on for this thread. :D
By all means, let's turn this into a general VC++ thread, most informative! :)

Lightwolf
04-20-2006, 02:47 AM
so it's set up already....
How strange, if I F5 with those settings (having lightwav.exe as my debug executable) MSVC displays the debug outputs in my output window...

Cheers,
Mike

GregMalick
04-20-2006, 02:52 AM
this is what I see in my debug Output window:


'lightwav.exe': Loaded 'C:\Program Files\LightWave [8.5]\Programs\lightwav.exe', No symbols loaded.
'lightwav.exe': Loaded 'C:\WINDOWS\SYSTEM32\ntdll.dll', No symbols loaded.
'lightwav.exe': Loaded 'C:\WINDOWS\SYSTEM32\kernel32.dll', No symbols loaded.
'lightwav.exe': Loaded 'C:\WINDOWS\SYSTEM32\shell32.dll', No symbols loaded.
'lightwav.exe': Loaded 'C:\WINDOWS\SYSTEM32\advapi32.dll', No symbols loaded.
'lightwav.exe': Loaded 'C:\WINDOWS\SYSTEM32\rpcrt4.dll', No symbols loaded.
'lightwav.exe': Loaded 'C:\WINDOWS\SYSTEM32\gdi32.dll', No symbols loaded.
'lightwav.exe': Loaded 'C:\WINDOWS\SYSTEM32\user32.dll', No symbols loaded.
'lightwav.exe': Loaded 'C:\WINDOWS\SYSTEM32\msvcrt.dll', No symbols loaded.
'lightwav.exe': Loaded 'C:\WINDOWS\SYSTEM32\shlwapi.dll', No symbols loaded.
'lightwav.exe': Loaded 'C:\Program Files\LightWave [8.5]\Programs\gcore8.dll', No symbols loaded.
'lightwav.exe': Loaded 'C:\Program Files\LightWave [8.5]\Programs\locus8.dll', No symbols loaded.
'lightwav.exe': Loaded 'C:\Program Files\LightWave [8.5]\Programs\lwtools8.dll', No symbols loaded.
'lightwav.exe': Loaded 'C:\WINDOWS\SYSTEM32\wsock32.dll', No symbols loaded.
'lightwav.exe': Loaded 'C:\WINDOWS\SYSTEM32\ws2_32.dll', No symbols loaded.
'lightwav.exe': Loaded 'C:\WINDOWS\SYSTEM32\ws2help.dll', No symbols loaded.
'lightwav.exe': Loaded 'C:\WINDOWS\SYSTEM32\opengl32.dll', No symbols loaded.
'lightwav.exe': Loaded 'C:\WINDOWS\SYSTEM32\glu32.dll', No symbols loaded.
'lightwav.exe': Loaded 'C:\WINDOWS\SYSTEM32\ddraw.dll', No symbols loaded.
'lightwav.exe': Loaded 'C:\WINDOWS\SYSTEM32\dciman32.dll', No symbols loaded.
'lightwav.exe': Loaded 'C:\WINDOWS\SYSTEM32\comdlg32.dll', No symbols loaded.
'lightwav.exe': Loaded 'C:\WINDOWS\SYSTEM32\comctl32.dll', No symbols loaded.
'lightwav.exe': Loaded 'C:\WINDOWS\SYSTEM32\winmm.dll', No symbols loaded.
'lightwav.exe': Loaded 'C:\Program Files\LightWave [8.5]\Programs\enved8.dll', No symbols loaded.
'lightwav.exe': Loaded 'C:\Program Files\LightWave [8.5]\Programs\lcore8.dll', No symbols loaded.
'lightwav.exe': Loaded 'C:\Program Files\LightWave [8.5]\Programs\surfed8.dll', No symbols loaded.
'lightwav.exe': Loaded 'C:\Program Files\LightWave [8.5]\Programs\cliped8.dll', No symbols loaded.
'lightwav.exe': Loaded 'C:\Program Files\LightWave [8.5]\Programs\iview8.dll', No symbols loaded.
'lightwav.exe': Loaded 'C:\Program Files\LightWave [8.5]\Programs\annex8.dll', No symbols loaded.
'lightwav.exe': Loaded 'C:\Program Files\LightWave [8.5]\Programs\lwaudio8.dll', No symbols loaded.
'lightwav.exe': Loaded 'C:\WINDOWS\SYSTEM32\dsound.dll', No symbols loaded.
'lightwav.exe': Loaded 'C:\WINDOWS\SYSTEM32\ole32.dll', No symbols loaded.
'lightwav.exe': Loaded 'C:\WINDOWS\SYSTEM32\version.dll', No symbols loaded.
'lightwav.exe': Loaded 'C:\WINDOWS\SYSTEM32\avifil32.dll', No symbols loaded.
'lightwav.exe': Loaded 'C:\WINDOWS\SYSTEM32\msacm32.dll', No symbols loaded.
'lightwav.exe': Loaded 'C:\WINDOWS\SYSTEM32\msvfw32.dll', No symbols loaded.
'lightwav.exe': Loaded 'C:\Program Files\LightWave [8.5]\Programs\preview8.dll', No symbols loaded.
'lightwav.exe': Loaded 'C:\Program Files\LightWave [8.5]\Programs\volume8.dll', No symbols loaded.
'lightwav.exe': Loaded 'C:\Program Files\LightWave [8.5]\Programs\vfrb8.dll', No symbols loaded.
'lightwav.exe': Loaded 'C:\Program Files\LightWave [8.5]\Programs\panels8.dll', No symbols loaded.
'lightwav.exe': Loaded 'C:\Program Files\LightWave [8.5]\Programs\crender8.dll', No symbols loaded.
'lightwav.exe': Loaded 'C:\Program Files\LightWave [8.5]\Programs\hwrender8.dll', No symbols loaded.
'lightwav.exe': Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_6.0.2600.2180_x-ww_a84f1ff9\comctl32.dll', No symbols loaded.
'lightwav.exe': Loaded 'C:\WINDOWS\SYSTEM32\Prodmi32.dll', No symbols loaded.
'lightwav.exe': Unloaded 'C:\WINDOWS\SYSTEM32\Prodmi32.dll'
'lightwav.exe': Loaded 'C:\WINDOWS\SYSTEM32\Prodmi32.dll', No symbols loaded.
'lightwav.exe': Loaded 'C:\WINDOWS\SYSTEM32\uxtheme.dll', No symbols loaded.
The thread 'Win32 Thread' (0xa38) has exited with code 0 (0x0).
'lightwav.exe': Loaded 'D:\LightWave\External Plugins\- Modeler\VirtualMirror.p', Binary was not built with debug information.
'lightwav.exe': Loaded 'C:\WINDOWS\SYSTEM32\nview.dll', No symbols loaded.
'lightwav.exe': Loaded 'C:\WINDOWS\SYSTEM32\psapi.dll', No symbols loaded.
'lightwav.exe': Loaded 'C:\WINDOWS\SYSTEM32\oleaut32.dll', No symbols loaded.
'lightwav.exe': Loaded 'C:\WINDOWS\SYSTEM32\ntmarta.dll', No symbols loaded.
'lightwav.exe': Loaded 'C:\WINDOWS\SYSTEM32\wldap32.dll', No symbols loaded.
'lightwav.exe': Loaded 'C:\WINDOWS\SYSTEM32\samlib.dll', No symbols loaded.
'lightwav.exe': Loaded 'C:\WINDOWS\SYSTEM32\TabHook.dll', Binary was not built with debug information.
'lightwav.exe': Loaded 'C:\WINDOWS\SYSTEM32\SSSensor.dll', Binary was not built with debug information.
'lightwav.exe': Loaded 'C:\Program Files\Logitech\SetPoint\gamehook.dll', No symbols loaded.
'lightwav.exe': Loaded 'C:\Program Files\Logitech\SetPoint\lgscroll.dll', Binary was not built with debug information.
'lightwav.exe': Loaded 'C:\WINDOWS\SYSTEM32\MSVCR71.DLL', No symbols loaded.
'lightwav.exe': Loaded 'C:\WINDOWS\SYSTEM32\msvcp71.dll', No symbols loaded.
'lightwav.exe': Loaded 'C:\WINDOWS\SYSTEM32\nvwimg.dll', Binary was not built with debug information.
'lightwav.exe': Unloaded 'C:\WINDOWS\SYSTEM32\nvwimg.dll'
'lightwav.exe': Loaded 'C:\WINDOWS\SYSTEM32\nvwddi.dll', No symbols loaded.
'lightwav.exe': Loaded 'C:\WINDOWS\SYSTEM32\nvwimg.dll', Binary was not built with debug information.
'lightwav.exe': Loaded 'C:\WINDOWS\SYSTEM32\msimg32.dll', No symbols loaded.
'lightwav.exe': Loaded 'C:\WINDOWS\SYSTEM32\nvoglnt.dll', No symbols loaded.
'lightwav.exe': Loaded 'C:\WINDOWS\SYSTEM32\mcd32.dll', No symbols loaded.
'lightwav.exe': Unloaded 'C:\WINDOWS\SYSTEM32\mcd32.dll'
'lightwav.exe': Loaded 'D:\LightWave\External Plugins\MINE ALL MINE\SDK\midiMaster.p', Symbols loaded.
'lightwav.exe': Loaded 'C:\WINDOWS\SYSTEM32\wdmaud.drv', No symbols loaded.
'lightwav.exe': Loaded 'C:\WINDOWS\SYSTEM32\setupapi.dll', No symbols loaded.
'lightwav.exe': Loaded 'C:\WINDOWS\SYSTEM32\wintrust.dll', No symbols loaded.
'lightwav.exe': Loaded 'C:\WINDOWS\SYSTEM32\crypt32.dll', No symbols loaded.
'lightwav.exe': Loaded 'C:\WINDOWS\SYSTEM32\msasn1.dll', No symbols loaded.
'lightwav.exe': Loaded 'C:\WINDOWS\SYSTEM32\imagehlp.dll', No symbols loaded.
'lightwav.exe': Unloaded 'C:\WINDOWS\SYSTEM32\setupapi.dll'
'lightwav.exe': Unloaded 'C:\WINDOWS\SYSTEM32\wdmaud.drv'
'lightwav.exe': Loaded 'C:\WINDOWS\SYSTEM32\wdmaud.drv', No symbols loaded.
'lightwav.exe': Loaded 'C:\WINDOWS\SYSTEM32\setupapi.dll', No symbols loaded.
'lightwav.exe': Unloaded 'C:\WINDOWS\SYSTEM32\setupapi.dll'
'lightwav.exe': Loaded 'C:\WINDOWS\SYSTEM32\msacm32.drv', No symbols loaded.
'lightwav.exe': Loaded 'C:\WINDOWS\SYSTEM32\midimap.dll', No symbols loaded.


What command are you using to display text/variables in the Output window?

Lightwolf
04-20-2006, 03:54 AM
What command are you using to display text/variables in the Output window?
I'm using OutputDebugString(const char *text); - or the class copied below that uses the same function.

Weird stuff...

edit: maybe this will help http://msdn.microsoft.com/library/default.asp?url=/library/en-us/debug/base/outputdebugstring.asp

Cheers,
Mike

GregMalick
04-20-2006, 09:11 AM
OutputDebugString();
displays in the Immediate Window not the Output Window.

Me :foreheads
You :foreheads

Lightwolf
04-20-2006, 10:48 AM
OutputDebugString();
displays in the Immediate Window not the Output Window.

Me :foreheads
You :foreheads
D'oh, that should teach me not to post from memory :foreheads

Cheers,
Mike

GregMalick
04-20-2006, 12:20 PM
D'oh, that should teach me not to post from memory :foreheads

Cheers,
Mike

It was a good discussion.
Now I have both techniques. :D

If there are only a few variables to look at - breakpoints & hovering (or setting a watch) is best.
If I have less than 20 or so (like channelNames)- the immediate window is best.

If I have over 20 that I have to peruse through and consider - the file could be good. Althought the Immediate Window also allows Select All & Cut & Paste - so the file technique may be just unneeded overhead.


BTW, colkai - did you know you can hover-over a value/right-click/edit-change variable values - even in arrays? It's cool.

Lightwolf
04-20-2006, 12:33 PM
It was a good discussion.
Now I have both techniques. :D

It never hurts to ask and discuss :D

Cheers,
Mike - who'd like to see more of that.

ercaxus
04-20-2006, 03:18 PM
Hey guys, does LWPP remind you of anything? :D

Lightwolf
04-20-2006, 04:30 PM
Hey guys, does LWPP remind you of anything? :D
Well, it surely reminds me of something ;)

Cheers,
Mike

ercaxus
04-20-2006, 05:49 PM
Just checking. Good to see that at least someone remembers it. You know the official forum has been quite dead for a while. I just checked if there was some secret stuff going on on berlios but no luck. Hopefully you still remember what it was too. :lol:

Lightwolf
04-20-2006, 05:56 PM
Just checking. Good to see that at least someone remembers it. You know the official forum has been quite dead for a while. I just checked if there was some secret stuff going on on berlios but no luck. Hopefully you still remember what it was too. :lol:
Hehe.. yeah I do. I also have built up my internal version of lwpp quite a bit (it is the base for infiniMap Pro)... _however_ I want to at least implement every basic element once so it gives people an idea of how to implement other parts of it before releasing anything. Basically fix up the initial design.
Currently it wraps quite a bunch of globals, but doesn't yet allows for C++ classes as a LW plugin (in a simple way).
Once I get that done I'll clean up the source and release for others to join in (and believe me, it will need loads of help to fully wrap the SDK).

Cheers,
Mike

ercaxus
04-20-2006, 06:05 PM
Thanks for the info, and good luck. I think I will stop bothering you for a while :)

GregMalick
04-20-2006, 06:05 PM
Hey guys, does LWPP remind you of anything? :D
nope. I'm too new I guess....

Lightwolf
04-20-2006, 06:12 PM
Thanks for the info, and good luck. I think I will stop bothering you for a while :)
No worries... :D I keep reminding myself, I'm just not happy with the current state, and it also seems that the discussions on SplineCage were insightful... but not very productive in terms of deciding on an approach.

Greg: lwpp is short for LightWrap++, an attempt to create an open source C++ wrapper for the LW SDK. (that never really made it beyond a couple of ideas publicly).

Cheers,
Mike