Jump to content

Welcome to eMastercam

Register now to participate in the forums, access the download area, buy Mastercam training materials, post processors and more. This message will be removed once you have signed in.

Use your display name or email address to sign in:

Recommended Posts

hi, im trying to get started with some basic chooks. unfortunatly i dont have microsoft visual c++, so i am trying to use borland. when i go to compile my program, it tells me it can not open the header file windows.h. where can i get this file from, or why am i getting this error? thanks.

Link to comment
Share on other sites

never mind, i found that file, sorry. but now i am getting 3 other errors. the first two are from the m_vars.h file, and they say:

"redefinition of 'FALSE' is not identical", and i get the same error for true.

the third error i get is from the m_lvars.h file, and it says:

"undefined symbol in 'PATH_MAX'"

is there anyway i can fix these errors? thanks again.

Link to comment
Share on other sites

To use extern, it looks something like this:

code:


// include Mastercam headers

extern "C"

{

#include "m_vars.h"

#include "m_ncvars.h"

#include "m_menu.h"

#include "m_io.h"

#include "m_dbm.h"

#include "m_init.h"

}

// now declare other C++ headers that

// you need like "limits.h", "math.h", etc...


Because the Mastercam headers are C-based, most (if not all) C++ compilers will usually mangle them and report errors in those headers; hence the need for extern. Hope this helps.

[This message has been edited by Bullines (edited 07-10-2001).]

Link to comment
Share on other sites

That's odd that PATH_MAX isn't defined in your "limits.h" header file. In my "limits.h" file that shipped with Borland C++ Builder 3 SP1 and Microsoft Visual C++ 6 SP5, PATH_MAX are defined as follows:

#define PATH_MAX 512

However, in "m_lvars.h" that ships with the Mastercam SDK, it's defined as follows:

#define PATH_MAX 259

You could try these to see which one makes the compiler happy. But are you actually using PATH_MAX in your C-Hook? PATH_MAX defines the maximum number of bytes in a pathname. If you are using it and you still have problems, maybe try hard-coding a path size instead, like this:

code:


char* szYourPath[256]; // instead of char* szYourPath[PATH_MAX]


Also, since you're using an old compiler, you may be interested in using Borland's latest. It's a free download from http://www.borland.com/bcppbuilder/freecom...ppc55steps.html , but it's only the compiler; there's no IDE. But if you combine it with a descent text editor, such as WinEdit, you'll have a low-cost and up-to-date C++ development environment.

Link to comment
Share on other sites

yea, im not sure why i need PATH_MAX either. im just trying to learn this stuff, so what i was doing was trying to compile the sample file shapes.cpp, and that is giving me all of these errors.

i downloaded the latest compiler, thanks a lot, i think i like it better... i am actually getting some new errors now... (it is never ending, sorry)

for some reason i dont have the stdafx header file. i dont even know what this one is for, although that doesnt say much...

the other new errors i get are with the stdlib header file, it says "templates and overloaded operators cannot ahve C linkage.

any ideas? thanks for all your help.

 

Link to comment
Share on other sites

If it's Shapes that you're playing around with, there's a good reason for the errors. It all centers around the use of MFC (Microsoft Foundation Classes). MFC is an application framework for Microsoft Visual C++. It provides controls like dialogs, toolbars, buttons, etc and various mechanisms for tedious programming tasks (such as I/O stuff). The Shapes C-Hook is an MFC-based Microsoft Visual C++ project. Any newer C-Hooks that have a Windows-type interface are MFC-based. The only Borland product that supports MFC is Borland C++ Builder (not totally 100% either) along with Borland's own VCL. I'm almost certain that the only framework plain 'ol Borland C++ can support is OWL. I've never gotten a single C-Hook to work with OWL or VCL yet and just stick with MFC instead. So trying to compile an MFC-based project with Borland C++ won't happen.

To answer a little more, "stdafx.h" is a Visual C++ header for the standard application frame work (it tells Visual C++ which application frameworks or template libraries you're using in your app).

There's a few more sample C-Hooks included with the SDK that don't use an interface and are therefore not dependant on MFC. I'd suggestion trying those ones out first. And when you're ready to develop C-Hooks with interfaces, you could either try with OWL or VCL (which may or may not work), but getting a copy of Visual C++ would be much easier. Hope this helps.

Link to comment
Share on other sites

No problem. Also don't forget the various compiler settings that you need to take into account. Here are a few of the major ones:

Target: Multithreaded DLL

Calling Convention: _cdecl *

Struct member alignment: 1 Byte

To elaborate, all C-Hooks must be compiled as multithreaded DLLs...yes, must be multithreaded. Using the "_cdecl *" calling convention is a safe bet. Simply put, the calling convention is the way functions are called and how they use arguments, returned values, etc... Structure member alignments are usually 8 bytes in the Windows development world, but for reasons beyond our control, C-Hooks use 1 byte alignment. All of these settings should be avaailable to be changed via the command line or a make file.

Good luck and have fun smile.gif

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.

Join us!

eMastercam - your online source for all things Mastercam.

Together, we are the strongest Mastercam community on the web with over 56,000 members, and our online store offers a wide selection of training materials for all applications and skill levels.

Follow us

×
×
  • Create New...