What do compile and link line refer to?
Clash Royale CLAN TAG#URR8PPP
While installing the cudnn library, I came across this in the INSTALL.txt
file:
Add [installpath] to your build and link process by adding
-I[installpath] to your compile
line and -L[installpath] -lcudnn to your link line.
What does compile and link line mean? Do I do this, while compiling myFile.c
which uses cudnn:
gcc myFile.c -L /path/to/library -l /name/of/library
Or something else?
PS: They have also mentioned to do this:
cd <installpath>
export LD_LIBRARY_PATH=`pwd`:$LD_LIBRARY_PATH
But won't I need to write this out to my .bashrc
file so that the environment variable is set every time my machine runs?
compiling environment-variables gcc linker
add a comment |
While installing the cudnn library, I came across this in the INSTALL.txt
file:
Add [installpath] to your build and link process by adding
-I[installpath] to your compile
line and -L[installpath] -lcudnn to your link line.
What does compile and link line mean? Do I do this, while compiling myFile.c
which uses cudnn:
gcc myFile.c -L /path/to/library -l /name/of/library
Or something else?
PS: They have also mentioned to do this:
cd <installpath>
export LD_LIBRARY_PATH=`pwd`:$LD_LIBRARY_PATH
But won't I need to write this out to my .bashrc
file so that the environment variable is set every time my machine runs?
compiling environment-variables gcc linker
add a comment |
While installing the cudnn library, I came across this in the INSTALL.txt
file:
Add [installpath] to your build and link process by adding
-I[installpath] to your compile
line and -L[installpath] -lcudnn to your link line.
What does compile and link line mean? Do I do this, while compiling myFile.c
which uses cudnn:
gcc myFile.c -L /path/to/library -l /name/of/library
Or something else?
PS: They have also mentioned to do this:
cd <installpath>
export LD_LIBRARY_PATH=`pwd`:$LD_LIBRARY_PATH
But won't I need to write this out to my .bashrc
file so that the environment variable is set every time my machine runs?
compiling environment-variables gcc linker
While installing the cudnn library, I came across this in the INSTALL.txt
file:
Add [installpath] to your build and link process by adding
-I[installpath] to your compile
line and -L[installpath] -lcudnn to your link line.
What does compile and link line mean? Do I do this, while compiling myFile.c
which uses cudnn:
gcc myFile.c -L /path/to/library -l /name/of/library
Or something else?
PS: They have also mentioned to do this:
cd <installpath>
export LD_LIBRARY_PATH=`pwd`:$LD_LIBRARY_PATH
But won't I need to write this out to my .bashrc
file so that the environment variable is set every time my machine runs?
compiling environment-variables gcc linker
compiling environment-variables gcc linker
edited Jan 14 at 0:46
Rui F Ribeiro
39.7k1479132
39.7k1479132
asked Jun 3 '17 at 11:45
James BondJames Bond
2315
2315
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
Your gcc
command combines the compile and link phase, so you need to add all the options given:
gcc -Iincludepath myFile.c -Llibpath -lcudnn
replacing includepath
and libpath
as appropriate.
And yes, you’ll probably want to edit your .bashrc
to set LD_LIBRARY_PATH
:
export LD_LIBRARY_PATH=libpath:$LD_LIBRARY_PATH
replacing libpath
as appropriate.
includepath
needs to point to the headers (.h
files), libpath
to the library (.so
).
add a comment |
Compiling and linking are the 2 major steps in the creation of an executable. Both can be done with the gcc
command. There is also a preprocessing step (before compilation) and an assembly (after compilation); these are almost always done at the same time as compiling so the combination "preprocess then compile then assemble" are treated as a single step called "compiling" for short.
The steps performed by a particular gcc
command line can be determined as follows:
Write down the order "preprocess, compile, assemble, link".
If the input file is named *.i
, remove the preprocess step (.i
files are already preprocessed).
If the input file is named *.s
, remove the preprocess and compile steps (.s
files are already compiled).
If the input file is named *.o
, remove the preprocess, compile, and assemble steps (.o
files are assembled).
If there's a -x
option, use it instead of the name of the input file in the preceding steps. (This is rare)
If the -c
option is used, remove the link step.
If the -S
option is used, remove the assemble and link steps.
If the -E
option is used, remove the compile, assemble, and link steps.
In summary, the type of the input file determines where you start in the preprocess-compile-assemble-link sequence, and the -c
/-S
/-E
options determine where you stop (they request output files of type *.o
, *.s
, and *.i
respectively - although -E
actually outputs to stdout by default).
Your command line has none of the output-type options, and its input file is named *.c
, so it is a compile line and a link line. This is a normal way to compile small programs. With larger programs, you usually don't want to compile everything all at once. It's better to save the intermediate *.o
files for reuse and only recompile them when their source file changes.
The "recompile as needed" development cycle involves gcc -c
commands to create the *.o
files, usually one at a time, and a gcc *.o -o theprogram
command to do the linking. These commands are commonly found in a Makefile and are referred to as "compile lines" and "link lines".
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f368977%2fwhat-do-compile-and-link-line-refer-to%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Your gcc
command combines the compile and link phase, so you need to add all the options given:
gcc -Iincludepath myFile.c -Llibpath -lcudnn
replacing includepath
and libpath
as appropriate.
And yes, you’ll probably want to edit your .bashrc
to set LD_LIBRARY_PATH
:
export LD_LIBRARY_PATH=libpath:$LD_LIBRARY_PATH
replacing libpath
as appropriate.
includepath
needs to point to the headers (.h
files), libpath
to the library (.so
).
add a comment |
Your gcc
command combines the compile and link phase, so you need to add all the options given:
gcc -Iincludepath myFile.c -Llibpath -lcudnn
replacing includepath
and libpath
as appropriate.
And yes, you’ll probably want to edit your .bashrc
to set LD_LIBRARY_PATH
:
export LD_LIBRARY_PATH=libpath:$LD_LIBRARY_PATH
replacing libpath
as appropriate.
includepath
needs to point to the headers (.h
files), libpath
to the library (.so
).
add a comment |
Your gcc
command combines the compile and link phase, so you need to add all the options given:
gcc -Iincludepath myFile.c -Llibpath -lcudnn
replacing includepath
and libpath
as appropriate.
And yes, you’ll probably want to edit your .bashrc
to set LD_LIBRARY_PATH
:
export LD_LIBRARY_PATH=libpath:$LD_LIBRARY_PATH
replacing libpath
as appropriate.
includepath
needs to point to the headers (.h
files), libpath
to the library (.so
).
Your gcc
command combines the compile and link phase, so you need to add all the options given:
gcc -Iincludepath myFile.c -Llibpath -lcudnn
replacing includepath
and libpath
as appropriate.
And yes, you’ll probably want to edit your .bashrc
to set LD_LIBRARY_PATH
:
export LD_LIBRARY_PATH=libpath:$LD_LIBRARY_PATH
replacing libpath
as appropriate.
includepath
needs to point to the headers (.h
files), libpath
to the library (.so
).
answered Jun 3 '17 at 15:36
Stephen KittStephen Kitt
169k24380458
169k24380458
add a comment |
add a comment |
Compiling and linking are the 2 major steps in the creation of an executable. Both can be done with the gcc
command. There is also a preprocessing step (before compilation) and an assembly (after compilation); these are almost always done at the same time as compiling so the combination "preprocess then compile then assemble" are treated as a single step called "compiling" for short.
The steps performed by a particular gcc
command line can be determined as follows:
Write down the order "preprocess, compile, assemble, link".
If the input file is named *.i
, remove the preprocess step (.i
files are already preprocessed).
If the input file is named *.s
, remove the preprocess and compile steps (.s
files are already compiled).
If the input file is named *.o
, remove the preprocess, compile, and assemble steps (.o
files are assembled).
If there's a -x
option, use it instead of the name of the input file in the preceding steps. (This is rare)
If the -c
option is used, remove the link step.
If the -S
option is used, remove the assemble and link steps.
If the -E
option is used, remove the compile, assemble, and link steps.
In summary, the type of the input file determines where you start in the preprocess-compile-assemble-link sequence, and the -c
/-S
/-E
options determine where you stop (they request output files of type *.o
, *.s
, and *.i
respectively - although -E
actually outputs to stdout by default).
Your command line has none of the output-type options, and its input file is named *.c
, so it is a compile line and a link line. This is a normal way to compile small programs. With larger programs, you usually don't want to compile everything all at once. It's better to save the intermediate *.o
files for reuse and only recompile them when their source file changes.
The "recompile as needed" development cycle involves gcc -c
commands to create the *.o
files, usually one at a time, and a gcc *.o -o theprogram
command to do the linking. These commands are commonly found in a Makefile and are referred to as "compile lines" and "link lines".
add a comment |
Compiling and linking are the 2 major steps in the creation of an executable. Both can be done with the gcc
command. There is also a preprocessing step (before compilation) and an assembly (after compilation); these are almost always done at the same time as compiling so the combination "preprocess then compile then assemble" are treated as a single step called "compiling" for short.
The steps performed by a particular gcc
command line can be determined as follows:
Write down the order "preprocess, compile, assemble, link".
If the input file is named *.i
, remove the preprocess step (.i
files are already preprocessed).
If the input file is named *.s
, remove the preprocess and compile steps (.s
files are already compiled).
If the input file is named *.o
, remove the preprocess, compile, and assemble steps (.o
files are assembled).
If there's a -x
option, use it instead of the name of the input file in the preceding steps. (This is rare)
If the -c
option is used, remove the link step.
If the -S
option is used, remove the assemble and link steps.
If the -E
option is used, remove the compile, assemble, and link steps.
In summary, the type of the input file determines where you start in the preprocess-compile-assemble-link sequence, and the -c
/-S
/-E
options determine where you stop (they request output files of type *.o
, *.s
, and *.i
respectively - although -E
actually outputs to stdout by default).
Your command line has none of the output-type options, and its input file is named *.c
, so it is a compile line and a link line. This is a normal way to compile small programs. With larger programs, you usually don't want to compile everything all at once. It's better to save the intermediate *.o
files for reuse and only recompile them when their source file changes.
The "recompile as needed" development cycle involves gcc -c
commands to create the *.o
files, usually one at a time, and a gcc *.o -o theprogram
command to do the linking. These commands are commonly found in a Makefile and are referred to as "compile lines" and "link lines".
add a comment |
Compiling and linking are the 2 major steps in the creation of an executable. Both can be done with the gcc
command. There is also a preprocessing step (before compilation) and an assembly (after compilation); these are almost always done at the same time as compiling so the combination "preprocess then compile then assemble" are treated as a single step called "compiling" for short.
The steps performed by a particular gcc
command line can be determined as follows:
Write down the order "preprocess, compile, assemble, link".
If the input file is named *.i
, remove the preprocess step (.i
files are already preprocessed).
If the input file is named *.s
, remove the preprocess and compile steps (.s
files are already compiled).
If the input file is named *.o
, remove the preprocess, compile, and assemble steps (.o
files are assembled).
If there's a -x
option, use it instead of the name of the input file in the preceding steps. (This is rare)
If the -c
option is used, remove the link step.
If the -S
option is used, remove the assemble and link steps.
If the -E
option is used, remove the compile, assemble, and link steps.
In summary, the type of the input file determines where you start in the preprocess-compile-assemble-link sequence, and the -c
/-S
/-E
options determine where you stop (they request output files of type *.o
, *.s
, and *.i
respectively - although -E
actually outputs to stdout by default).
Your command line has none of the output-type options, and its input file is named *.c
, so it is a compile line and a link line. This is a normal way to compile small programs. With larger programs, you usually don't want to compile everything all at once. It's better to save the intermediate *.o
files for reuse and only recompile them when their source file changes.
The "recompile as needed" development cycle involves gcc -c
commands to create the *.o
files, usually one at a time, and a gcc *.o -o theprogram
command to do the linking. These commands are commonly found in a Makefile and are referred to as "compile lines" and "link lines".
Compiling and linking are the 2 major steps in the creation of an executable. Both can be done with the gcc
command. There is also a preprocessing step (before compilation) and an assembly (after compilation); these are almost always done at the same time as compiling so the combination "preprocess then compile then assemble" are treated as a single step called "compiling" for short.
The steps performed by a particular gcc
command line can be determined as follows:
Write down the order "preprocess, compile, assemble, link".
If the input file is named *.i
, remove the preprocess step (.i
files are already preprocessed).
If the input file is named *.s
, remove the preprocess and compile steps (.s
files are already compiled).
If the input file is named *.o
, remove the preprocess, compile, and assemble steps (.o
files are assembled).
If there's a -x
option, use it instead of the name of the input file in the preceding steps. (This is rare)
If the -c
option is used, remove the link step.
If the -S
option is used, remove the assemble and link steps.
If the -E
option is used, remove the compile, assemble, and link steps.
In summary, the type of the input file determines where you start in the preprocess-compile-assemble-link sequence, and the -c
/-S
/-E
options determine where you stop (they request output files of type *.o
, *.s
, and *.i
respectively - although -E
actually outputs to stdout by default).
Your command line has none of the output-type options, and its input file is named *.c
, so it is a compile line and a link line. This is a normal way to compile small programs. With larger programs, you usually don't want to compile everything all at once. It's better to save the intermediate *.o
files for reuse and only recompile them when their source file changes.
The "recompile as needed" development cycle involves gcc -c
commands to create the *.o
files, usually one at a time, and a gcc *.o -o theprogram
command to do the linking. These commands are commonly found in a Makefile and are referred to as "compile lines" and "link lines".
answered Jun 3 '17 at 16:16
Wumpus Q. WumbleyWumpus Q. Wumbley
4,6801322
4,6801322
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f368977%2fwhat-do-compile-and-link-line-refer-to%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown