Ancient Dragon & WolfPack
I tried out the steps you pointed out and the api-example program runs beautifully. I used visual C++ 2003.
But I would like to test it in C ( not in vc).
To tell you frankly, my first target is to test it in Java. There is also Java LGinterface. But I don't know how to use it and move to C.
Have you ever met an intelligent student like me?

By the way, how do you choose your nickname?

Ancient Dragon & WolfPack
I tried out the steps you pointed out and the api-example program runs beautifully. I used visual C++ 2003.

good

But I would like to test it in C ( not in vc).

C is a language. The program is written in C. VC, BCC, TC are compilers. You have used the VC compiler to test the program. It is the same for other compilers also, only the commands used to compile are different.

To tell you frankly, my first target is to test it in Java.
There is also Java LGinterface. But I don't know how to use it and move to C.

Neither do I.

Have you ever met an intelligent student like me?

No

By the way, how do you choose your nickname?

Same as you did.

>> But I would like to test it in C ( not in vc).

VC is the name of a Microsoft compiler, not a computer language. It compiles both C and C++ code just like any other compiler will do. Give the file a *.c extension and the compiler will compile it as a C program.

You could also use free Dev-C++ from www.bloodshet.net. Dev-C++ is another compiler whose name might be confusing -- it also compiler C as well as C++ code.

Thank you very much for your kind reply.
Let me continue to ask more questions if you don't mind.
Don't angry with me for my stupid questions. I am not intelligent, as you know.

///////////////// Add these lines
#ifndef WIN32
#define WIN32
#endif
////////////////////////////////////////////
#ifndef _LINKINCLUDESH_
#define _LINKINCLUDESH_

What is the meaning of that line and why we need to use that?

///////////////// Add these lines
#ifndef WIN32
#define WIN32
#endif
////////////////////////////////////////////
#ifndef _LINKINCLUDESH_
#define _LINKINCLUDESH_

What is the meaning of that line and why we need to use that?

Those are called preprocessor switches. It defines a constant called WIN32. Because the program was designed to compile in Sun, Linux, Windows environment, some way was needed to tell the preprocessor what to do in each environment.

If you look at resource.c file you can see this code.

#if !defined(WIN32)
   #include <sys/time.h>
   #include <sys/resource.h>
#endif

#if defined(__linux__)
/* based on reading the man page for getrusage on linux, I inferred that
   I needed to include this.  However it doesn't seem to be necessary */
   #include <unistd.h>
#endif

#if defined(__hpux__)
  #include <sys/syscall.h>
  int syscall(int, int, struct rusage *rusage);  /* can't find
						    the prototype for this */
  #define getrusage(a, b)  syscall(SYS_GETRUSAGE, (a), (b))
#endif /* __hpux__ */

#if defined(__sun__)
int getrusage(int who, struct rusage *rusage);
/* Declaration missing from sys/resource.h in sun operating systems (?) */
#endif /* __sun__ */

Because we defined the constant called WIN32, the

#include <sys/time.h>
   #include <sys/resource.h>

part and the other part will not be compiled. It needs to be compiled in a non-windows environment.

the #if defined(__sun__) part means do this in a Sun environment.

the #if defined(__linux__) part means do this in a Linux environment. so on and so forth.

If you were using the Visual Studio Project files to compile the program the lines

#ifndef WIN32
#define WIN32
#endif

need not be added. There were already defined in the link41b.dsp project file. Since you insisted on using another compiler it was needed.

What is visual studio project file?

I have to go back to hostel.

It is a project management file used in the Visual Studio Development Environment. You can group mulitple source files to a single project file to make compiling and maintaining the project easier. I dont think you can use it with the Visual Studio 2003 Command line toolkit. You should have the Visual Studio Development Environment ( Like Visual Studio 6 or Visual Studio .NET ) for that.

Edit.
Where is your hostel?

What is Library Directories & Include Directories & Resource Directories?
Please use my downloaded linkgrammar folder, link41b as an example.

What is the difference between command line compiler and IDE?

What is Library Directories & Include Directories & Resource Directories?
Please use my downloaded linkgrammar folder, link41b as an example.

Library directory: the directory (or folder) that contains library files (file with .lib extension). You need not specify the compiler's standard library path (see your compiler installation directory)

Include directory: the directory that contains include files (with a .h extension or sometimes no extension at all). You need not specify your compiler's standard include directories (see your compiler's installation directory).

resource directory: the directory where you put the *.rc file(s) and other resources, such as icons and bitmaps.

You can leave all those direcories blank if you do not use them.

>>Please use my downloaded linkgrammar folder
Use your own head and attempt to figure it out yourself. Use your head for something other than a hat rack.

Use your own head and attempt to figure it out yourself. Use your head for something other than a hat rack.

Good call man. I had given up answering these questions.

ok .. I will use my own head.

Wolfpack
I can not use my own head.
U pointed out me the step of running api-example.c.
Why that step can not be used for constituent-example.c?

Wolfpack
I can not use my own head.
U pointed out me the step of running api-example.c.
Why that step can not be used for constituent-example.c?

Add this line

#include "link-includes.h"

at the top of the file constituent-example.c and try again.

Edit: I got a heap error while using the cl /EHsc command. So if you also get it, just type cl without the /EHsc part

eg. cl *.c /I..\include

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.