Sign in to follow this  
jcboliveira

Visual C++ .NET help

Recommended Posts

Hi,Has anyone compiled a running gauge with Visual C++ .NET and then had it not work on other computers that don't have Visual C++ .NET? I have experienced this many times and have had to resort to having someone else compile for me. Does anyone know what causes this and/or a way around it?-Jon

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

A way around the problem?Use Borland BCC55 or MinGW to compile the gauge(s)...

Share this post


Link to post
Share on other sites

Jon,I compile my gauge with VC++ .NET all the time and had no problems at all. No special settings needed.Did you add a yourgauge.def file in your project? That's absolutely necessary to make the gauge work in FS. I'm in office so I can't tell you how it has to look (I just copy and modify the one from the last project ;-) ) but I can post one later today.@Bill:Would you really use a command line compiler when you have on with IDE and integrated debugger? I don't think so. BC55 and MinGW can't even be compared to VC.NET.

Share this post


Link to post
Share on other sites

Hey guys,As a side note, me and the IDE do not get along very well. I used it for about a year, but after switching to the Visual C linecompiler through the use of makefile and VCVARS32.bat, I am not going back. I do all my coding in TextPad (thanks Matt), then go to a command window and type 1, copying the idea Matt used. 1.bat is a file that simply calls VCVARS32.bat, so I don't have to type that.Sure, press F7 in the IDE, also a one key deal, but for me, the line compiler uses way less resources, and TextPad even highlights the code just like the IDE by recognizing file extensions .c or .cpp or .h, so overall I believe it boils down to preference, not speed.

Share this post


Link to post
Share on other sites

@Jon: Here's the .def file:LIBRARY YOURGAUGE.GAUEXPORTS Linkage ImportTable@Fabio: I never had any problems with the IDE. I really can't understand what could be the problem. There's no way to do gauges more comfortable and efficient.

Share this post


Link to post
Share on other sites

Hey Hans,Never had any problems either, just find TextPad more comfortable.

Share this post


Link to post
Share on other sites

>Would you really use a command line compiler when you have on>with IDE and integrated debugger? I don't think so. BC55 and>MinGW can't even be compared to VC.NET.Being poor as dirt, I cannot afford "fancy schmanzy" stuff like VC.NET... :( Besides which, real programmers use EDLIN to create Windows apps! :)I am sort of visually oriented though, since i use the programmer's edition of Easy Gauge to build do all the 'hard stuff' of element placement and mouse areas, then add the real code using notepad.exe...

Share this post


Link to post
Share on other sites

>I am sort of visually oriented though, since i use the>programmer's edition of Easy Gauge to build do all the 'hard>stuff' of element placement and mouse areas, then add the real>code using notepad.exe...Better learn vector graphics

Share this post


Link to post
Share on other sites

>>I am sort of visually oriented though, since i use the>>programmer's edition of Easy Gauge to build do all the 'hard>>stuff' of element placement and mouse areas, then add the>real>>code using notepad.exe...>>Better learn vector graphicsI learn something new everyday. That is one among many things I'm working on. No one is born with all this knowledge; it requires a lot of study and practice...One thing I learned early on though is that no "tool" is better than the hands of the artist who wields it. If the artist has no 'native talent,' that will be reflected in their finished product... :)

Share this post


Link to post
Share on other sites

Hi,I have always seen that .def file in the project folder and still haven't had any luck. Do I need to add it somewhere in the solution explorer? -Jon

Share this post


Link to post
Share on other sites

I'm not familiar with .NET, but the .def file is normally for other applications/dlls to load functions out of the compiled dll/gau. It is needed for compiling other modules. Since FS gauges re usually only loaded by FS itself with a standard interface (_ImportTable,_Linkage), you normally don't need to bother about the .def file. Apart from that, with the use of "dllimport" in the gauges.h the .defs aren't needed at all (a t least for VC6.0,GCC, don't know about BCC).Arne Bartels

Share this post


Link to post
Share on other sites

BCC requires a file like this which reads (well in my setup):EXPORTS Linkage=_Linkage ImportTable=_ImportTableHowever, with VC, it shouldn't be necessary from what I've been told, since the gauge.h defines the exported entries properly, and the linker uses this alright.As for the editor, the IDE etc..., to each is own! I know great projects done without the VC IDE... :-)I personaly have enjoyed the LCC Win32 IDE, and the BCC command line compiler with makefile. Sure the VC IDE is nice, manages the classes efficiently, but I disagree (and the answers from others seems to as well), that in order to work seriously with gauge development you can't do other than VC IDE...As for debuging? the best I know (free) is:http://home.t-online.de/home/Ollydbg/Hope this helps!

Share this post


Link to post
Share on other sites

I have been using VS .NET myself for a while making C gauges. With the recent release of the panel sdk I wanted to try to get AI traffic data through ITrafficInfo interface. But I don't know how to make gauges using C++. It would be great if someone could post (or e-mail me at arnthelge@mostrealisticai.com) the complete source code of a simple VS .NET C++ gauge project.Many thanks in advance!Regards,Arnt Helge Haaland

Share this post


Link to post
Share on other sites

Don't know about .NET, but for C++ instead of C compilation with C/C++ compilers you only need to rename the source to .cpp. In principle the new gauges.h should be able to compile with C++, but I haven't checked yet.Arne Bartels

Share this post


Link to post
Share on other sites

YesJust dis a makefile and compile the gauge with it just before release. I have a feelling that some "can't load" that appear from time to time in the foruns are due to this problem.Jos

Share this post


Link to post
Share on other sites

You don't have to, C code in cpp files is (more or less) treated as C code. No classes needed. Ther could be some incompabilities, but the gauges.h is prepared to deal with them. Apart from that it's impossible to rewrite the gauge sceleton code to pure C++ in my opinion.So to enable C++ parts just rename to .cpp, the main C code in the gauge isn't touched by this.As a "COM" related interface in the Trafficc example it might be possible to use it also in pure C-code (via the vtbl->... stuff), but I haven't checked.Arne Bartels

Share this post


Link to post
Share on other sites

My personal way is to separate the gauge macros from C++ code. That's why you can find C files and CPP files. The CPP files in the example have one class (waveread.cpp) and Direct Sound code (sound.cpp) that also use that class. And pure Direct Input code (Joystick.cpp) That needs to be in a CPP file.Then when I need to call c++ functions from C just declare it has extern "C".Now I'm trying to do the same by putting C++ code in a dll but don't know why the dll is not loaded by the gauge. But since is only an exercise I didn't see deeply why. The functions are declared has:extern "C" _declspec(dllexport)Jos

Share this post


Link to post
Share on other sites

Hans,why is it necessary you use a .def? it looks like the gauges.h uses its own EXTERN_C DECLSPEC_EXPORT for it?could you shed some light about this?

Share this post


Link to post
Share on other sites

>Hans,>>why is it necessary you use a .def? it looks like the gauges.h>uses its own EXTERN_C DECLSPEC_EXPORT for it?Well, neither Ike Slack nor I need the .def file at all. We're both using Visual Studio C++ .NET (although I use the v7.x optimized compiler now).

Share this post


Link to post
Share on other sites

Thanks! this is what I thought but reading this thread I was not sure. Now I am!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this