how to set up environment in C++?

T

tony

In Java, we have to set Path and classpath in order to run the
programmes correctly. Could anybody tell me how to do this in the C++
world? How to set the include path and lib path if I don't want to use
any IDE?
Thank you!
 
S

Stefan Naewe

In Java, we have to set Path and classpath in order to run the
programmes correctly. Could anybody tell me how to do this in the C++
world? How to set the include path and lib path if I don't want to use
any IDE?
Thank you!

Check the manual/documentation of your compiler.

S.
 
Z

Zeppe

tony said:
In Java, we have to set Path and classpath in order to run the
programmes correctly. Could anybody tell me how to do this in the C++
world? How to set the include path and lib path if I don't want to use
any IDE?
Thank you!

It does not depend on the language, it depends on the compiler, so you
have to check the compiler documentation in order to learn about the
format of the arguments.

Regards,

Zeppe
 
V

Victor Bazarov

tony said:
In Java, we have to set Path and classpath in order to run the
programmes correctly. Could anybody tell me how to do this in the C++
world? How to set the include path and lib path if I don't want to use
any IDE?

There is no equivalent "in the C++ world". C++ is a language that lets
you create _native_ applications, which means that whatever environment
you need to set up to run them is governed by the hosting operating
system. Same for a compiler. It's just like any other application on
your computer, nothing special about it. In order to set it up in the
way it will work for you some special steps may be required, and that
is NOT governed by the language, but by the compiler itself (since it's
a native application in the majority of cases). Please refer to the
compiler documentation to learn about all the steps needed to set it up
correctly.

V
 
T

Tim Slattery

tony said:
In Java, we have to set Path and classpath in order to run the
programmes correctly. Could anybody tell me how to do this in the C++
world? How to set the include path and lib path if I don't want to use
any IDE?

Depends on your operating system. You'll (probably) want to add the
directory where your application resides to the system PATH. Different
systems will have different search strategies for libraries, you'll
have to find out what yours does.
 
G

Guest

In Java, we have to set Path and classpath in order to run the
programmes correctly. Could anybody tell me how to do this in the C++
world? How to set the include path and lib path if I don't want to use
any IDE?

It depends on what system you are using, if you use one with gcc
preinstalled it is probably already setup correctly. You should ask in a
group dedicated to your system for a better answer.
 
T

tony

Options of compilers can do that temporarily, but what I want is to
setup the search directories permanently.
To make it explicit:
one way is:
gcc -I <includeDir> -L <libDir> <src>
yet what I want:
set up includeDir and libDir permanently, and
when I compile codes:
gcc <src>
without need of specifying options.
 
V

Victor Bazarov

tony said:
Options of compilers can do that temporarily, but what I want is to
setup the search directories permanently.
[..]

We get that. Do you not understand that it differs from system to
system? And it's not part of C++ _language_. RTFM for your OS.

V
 
S

shadowman

tony said:
Options of compilers can do that temporarily, but what I want is to
setup the search directories permanently.
To make it explicit:
one way is:
gcc -I <includeDir> -L <libDir> <src>
yet what I want:
set up includeDir and libDir permanently, and
when I compile codes:
gcc <src>
without need of specifying options.

If you need help finding a good search term -- you probably want to look
up the 'make' utility, and makefiles.
 
A

attibln

In Java, we have to set Path and classpath in order to run the
programmes correctly. Could anybody tell me how to do this in the C++
world? How to set the include path and lib path if I don't want to use
any IDE?
Thank you!

In case you use the BASH (eiter on linux or cygwin) you could make an
entry in ~/.alias (create it if it doesn't exist yet) and add the line

alias "gccIL=gcc -I <includeDir> -L <libDir>"

then you can use gccIL <src> to compile w/o having to state the
include and lib directory.

peace!
~ Attila
 
M

Markus Schoder

Options of compilers can do that temporarily, but what I want is to
setup the search directories permanently. To make it explicit:
one way is:
gcc -I <includeDir> -L <libDir> <src>
yet what I want:
set up includeDir and libDir permanently, and when I compile codes:
gcc <src>
without need of specifying options.

You can use the environment variables

CPLUS_INCLUDE_PATH

and

LIBRARY_PATH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top