How to compile C/C++ program with GStreamer
I'm trying to compile this code:
#include <stdio.h>
#include <stdlib.h>
#include <gst/gst.h>
int main (int argc,
char *argv)
{
const gchar *nano_str;
guint major, minor, micro, nano;
gst_init (&argc, &argv);
gst_version (&major, &minor, µ, &nano);
if (nano == 1)
nano_str = "(CVS)";
else if (nano == 2)
nano_str = "(Prerelease)";
else
nano_str = "";
printf ("This program is linked against GStreamer %d.%d.%d %sn",
major, minor, micro, nano_str);
return 0;
}
When I use this command in terminal:
libtool --mode=link gcc `pkg-config --cflags --libs gstreamer-1.0` -o main main.c
I get this error:
Package gstreamer-1.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gstreamer-1.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'gstreamer-1.0' found
libtool: link: gcc -o main main.c
And this error:
main.c:3:21: fatal error: gst/gst.h: No such file or directory
But I have installed GStreamer 1.0 and libtool with apt-get. Do you have any ideas where should I start? I have dig whole Internet searching the answer and no one has the answer.
compiling c++ gstreamer
add a comment |
I'm trying to compile this code:
#include <stdio.h>
#include <stdlib.h>
#include <gst/gst.h>
int main (int argc,
char *argv)
{
const gchar *nano_str;
guint major, minor, micro, nano;
gst_init (&argc, &argv);
gst_version (&major, &minor, µ, &nano);
if (nano == 1)
nano_str = "(CVS)";
else if (nano == 2)
nano_str = "(Prerelease)";
else
nano_str = "";
printf ("This program is linked against GStreamer %d.%d.%d %sn",
major, minor, micro, nano_str);
return 0;
}
When I use this command in terminal:
libtool --mode=link gcc `pkg-config --cflags --libs gstreamer-1.0` -o main main.c
I get this error:
Package gstreamer-1.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gstreamer-1.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'gstreamer-1.0' found
libtool: link: gcc -o main main.c
And this error:
main.c:3:21: fatal error: gst/gst.h: No such file or directory
But I have installed GStreamer 1.0 and libtool with apt-get. Do you have any ideas where should I start? I have dig whole Internet searching the answer and no one has the answer.
compiling c++ gstreamer
add a comment |
I'm trying to compile this code:
#include <stdio.h>
#include <stdlib.h>
#include <gst/gst.h>
int main (int argc,
char *argv)
{
const gchar *nano_str;
guint major, minor, micro, nano;
gst_init (&argc, &argv);
gst_version (&major, &minor, µ, &nano);
if (nano == 1)
nano_str = "(CVS)";
else if (nano == 2)
nano_str = "(Prerelease)";
else
nano_str = "";
printf ("This program is linked against GStreamer %d.%d.%d %sn",
major, minor, micro, nano_str);
return 0;
}
When I use this command in terminal:
libtool --mode=link gcc `pkg-config --cflags --libs gstreamer-1.0` -o main main.c
I get this error:
Package gstreamer-1.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gstreamer-1.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'gstreamer-1.0' found
libtool: link: gcc -o main main.c
And this error:
main.c:3:21: fatal error: gst/gst.h: No such file or directory
But I have installed GStreamer 1.0 and libtool with apt-get. Do you have any ideas where should I start? I have dig whole Internet searching the answer and no one has the answer.
compiling c++ gstreamer
I'm trying to compile this code:
#include <stdio.h>
#include <stdlib.h>
#include <gst/gst.h>
int main (int argc,
char *argv)
{
const gchar *nano_str;
guint major, minor, micro, nano;
gst_init (&argc, &argv);
gst_version (&major, &minor, µ, &nano);
if (nano == 1)
nano_str = "(CVS)";
else if (nano == 2)
nano_str = "(Prerelease)";
else
nano_str = "";
printf ("This program is linked against GStreamer %d.%d.%d %sn",
major, minor, micro, nano_str);
return 0;
}
When I use this command in terminal:
libtool --mode=link gcc `pkg-config --cflags --libs gstreamer-1.0` -o main main.c
I get this error:
Package gstreamer-1.0 was not found in the pkg-config search path.
Perhaps you should add the directory containing `gstreamer-1.0.pc'
to the PKG_CONFIG_PATH environment variable
No package 'gstreamer-1.0' found
libtool: link: gcc -o main main.c
And this error:
main.c:3:21: fatal error: gst/gst.h: No such file or directory
But I have installed GStreamer 1.0 and libtool with apt-get. Do you have any ideas where should I start? I have dig whole Internet searching the answer and no one has the answer.
compiling c++ gstreamer
compiling c++ gstreamer
asked Oct 14 '14 at 20:00
dwinardwinar
18114
18114
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
gst/gst.h
is provided by libgstreamer1.0-dev
. Install it:
sudo apt-get install libgstreamer1.0-dev
In Code::Blocks, you can set custom include locations and linker flags. In the Project menu, click on Build options:
That helped a lot! But now I wonder how did you know that this is required? GStreamer Development Manual doesn't say a word about this. One more question would be what to type in "linker settings" in Codeblocks for example to allow compilation with IDE?
– dwinar
Oct 14 '14 at 20:28
@dwinar Usually in Ubuntu header files for some package (saysomething
) are provided by the correspondingdev
package (saysomething-dev
orlibsomething-dev
). Unless the manual is Ubuntu specific, it will probably just say "Install the development files" or something like that (or assume you compiled from source).
– muru
Oct 14 '14 at 20:33
Thank you very much. I'll remember this in the future. I have solved my IDE issue also :) Yes I knew where to find project settings but I didn't know what to write there but now I found it. I had add compiler option: "pkg-config --cflags gstreamer-1.0
" and in linker settingspkg-config --libs gstreamer-1.0
– dwinar
Oct 14 '14 at 21:12
@dwinar my update was a bit too late then. Was I correct?
– muru
Oct 14 '14 at 21:13
Almost but that doesn't matter :P you saved me with your "sudo apt-get install libgstreamer1.0-dev" advice. Thanks again!
– dwinar
Oct 14 '14 at 21:18
|
show 1 more comment
For people using Eclipse you should do the followings to make the project from within Eclipse:
Right click the project name and select properties. Under C/C++ Build, select Settings.
Under Tool Settings, open GCC C complier and select miscellaneous.
Add the following to other flags text box:
`pkg-config --cflags gstreamer-1.0` -fPIC
Under Tool Settings, open GCC C++ Linker and select miscellaneous. Add the following to linker flags text box:
`pkg-config --libs gstreamer-1.0 gobject-2.0 glib-2.0`
Under Tool Settings, open GCC C++ Linker and select Libraries. Add gstreamer-1.0, gobject-2.0 and glib-2.0 under Libraries section.
Your application should compile and link successfully then.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
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: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
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%2faskubuntu.com%2fquestions%2f537132%2fhow-to-compile-c-c-program-with-gstreamer%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
gst/gst.h
is provided by libgstreamer1.0-dev
. Install it:
sudo apt-get install libgstreamer1.0-dev
In Code::Blocks, you can set custom include locations and linker flags. In the Project menu, click on Build options:
That helped a lot! But now I wonder how did you know that this is required? GStreamer Development Manual doesn't say a word about this. One more question would be what to type in "linker settings" in Codeblocks for example to allow compilation with IDE?
– dwinar
Oct 14 '14 at 20:28
@dwinar Usually in Ubuntu header files for some package (saysomething
) are provided by the correspondingdev
package (saysomething-dev
orlibsomething-dev
). Unless the manual is Ubuntu specific, it will probably just say "Install the development files" or something like that (or assume you compiled from source).
– muru
Oct 14 '14 at 20:33
Thank you very much. I'll remember this in the future. I have solved my IDE issue also :) Yes I knew where to find project settings but I didn't know what to write there but now I found it. I had add compiler option: "pkg-config --cflags gstreamer-1.0
" and in linker settingspkg-config --libs gstreamer-1.0
– dwinar
Oct 14 '14 at 21:12
@dwinar my update was a bit too late then. Was I correct?
– muru
Oct 14 '14 at 21:13
Almost but that doesn't matter :P you saved me with your "sudo apt-get install libgstreamer1.0-dev" advice. Thanks again!
– dwinar
Oct 14 '14 at 21:18
|
show 1 more comment
gst/gst.h
is provided by libgstreamer1.0-dev
. Install it:
sudo apt-get install libgstreamer1.0-dev
In Code::Blocks, you can set custom include locations and linker flags. In the Project menu, click on Build options:
That helped a lot! But now I wonder how did you know that this is required? GStreamer Development Manual doesn't say a word about this. One more question would be what to type in "linker settings" in Codeblocks for example to allow compilation with IDE?
– dwinar
Oct 14 '14 at 20:28
@dwinar Usually in Ubuntu header files for some package (saysomething
) are provided by the correspondingdev
package (saysomething-dev
orlibsomething-dev
). Unless the manual is Ubuntu specific, it will probably just say "Install the development files" or something like that (or assume you compiled from source).
– muru
Oct 14 '14 at 20:33
Thank you very much. I'll remember this in the future. I have solved my IDE issue also :) Yes I knew where to find project settings but I didn't know what to write there but now I found it. I had add compiler option: "pkg-config --cflags gstreamer-1.0
" and in linker settingspkg-config --libs gstreamer-1.0
– dwinar
Oct 14 '14 at 21:12
@dwinar my update was a bit too late then. Was I correct?
– muru
Oct 14 '14 at 21:13
Almost but that doesn't matter :P you saved me with your "sudo apt-get install libgstreamer1.0-dev" advice. Thanks again!
– dwinar
Oct 14 '14 at 21:18
|
show 1 more comment
gst/gst.h
is provided by libgstreamer1.0-dev
. Install it:
sudo apt-get install libgstreamer1.0-dev
In Code::Blocks, you can set custom include locations and linker flags. In the Project menu, click on Build options:
gst/gst.h
is provided by libgstreamer1.0-dev
. Install it:
sudo apt-get install libgstreamer1.0-dev
In Code::Blocks, you can set custom include locations and linker flags. In the Project menu, click on Build options:
edited Oct 14 '14 at 21:12
answered Oct 14 '14 at 20:05
murumuru
1
1
That helped a lot! But now I wonder how did you know that this is required? GStreamer Development Manual doesn't say a word about this. One more question would be what to type in "linker settings" in Codeblocks for example to allow compilation with IDE?
– dwinar
Oct 14 '14 at 20:28
@dwinar Usually in Ubuntu header files for some package (saysomething
) are provided by the correspondingdev
package (saysomething-dev
orlibsomething-dev
). Unless the manual is Ubuntu specific, it will probably just say "Install the development files" or something like that (or assume you compiled from source).
– muru
Oct 14 '14 at 20:33
Thank you very much. I'll remember this in the future. I have solved my IDE issue also :) Yes I knew where to find project settings but I didn't know what to write there but now I found it. I had add compiler option: "pkg-config --cflags gstreamer-1.0
" and in linker settingspkg-config --libs gstreamer-1.0
– dwinar
Oct 14 '14 at 21:12
@dwinar my update was a bit too late then. Was I correct?
– muru
Oct 14 '14 at 21:13
Almost but that doesn't matter :P you saved me with your "sudo apt-get install libgstreamer1.0-dev" advice. Thanks again!
– dwinar
Oct 14 '14 at 21:18
|
show 1 more comment
That helped a lot! But now I wonder how did you know that this is required? GStreamer Development Manual doesn't say a word about this. One more question would be what to type in "linker settings" in Codeblocks for example to allow compilation with IDE?
– dwinar
Oct 14 '14 at 20:28
@dwinar Usually in Ubuntu header files for some package (saysomething
) are provided by the correspondingdev
package (saysomething-dev
orlibsomething-dev
). Unless the manual is Ubuntu specific, it will probably just say "Install the development files" or something like that (or assume you compiled from source).
– muru
Oct 14 '14 at 20:33
Thank you very much. I'll remember this in the future. I have solved my IDE issue also :) Yes I knew where to find project settings but I didn't know what to write there but now I found it. I had add compiler option: "pkg-config --cflags gstreamer-1.0
" and in linker settingspkg-config --libs gstreamer-1.0
– dwinar
Oct 14 '14 at 21:12
@dwinar my update was a bit too late then. Was I correct?
– muru
Oct 14 '14 at 21:13
Almost but that doesn't matter :P you saved me with your "sudo apt-get install libgstreamer1.0-dev" advice. Thanks again!
– dwinar
Oct 14 '14 at 21:18
That helped a lot! But now I wonder how did you know that this is required? GStreamer Development Manual doesn't say a word about this. One more question would be what to type in "linker settings" in Codeblocks for example to allow compilation with IDE?
– dwinar
Oct 14 '14 at 20:28
That helped a lot! But now I wonder how did you know that this is required? GStreamer Development Manual doesn't say a word about this. One more question would be what to type in "linker settings" in Codeblocks for example to allow compilation with IDE?
– dwinar
Oct 14 '14 at 20:28
@dwinar Usually in Ubuntu header files for some package (say
something
) are provided by the corresponding dev
package (say something-dev
or libsomething-dev
). Unless the manual is Ubuntu specific, it will probably just say "Install the development files" or something like that (or assume you compiled from source).– muru
Oct 14 '14 at 20:33
@dwinar Usually in Ubuntu header files for some package (say
something
) are provided by the corresponding dev
package (say something-dev
or libsomething-dev
). Unless the manual is Ubuntu specific, it will probably just say "Install the development files" or something like that (or assume you compiled from source).– muru
Oct 14 '14 at 20:33
Thank you very much. I'll remember this in the future. I have solved my IDE issue also :) Yes I knew where to find project settings but I didn't know what to write there but now I found it. I had add compiler option: "
pkg-config --cflags gstreamer-1.0
" and in linker settings pkg-config --libs gstreamer-1.0
– dwinar
Oct 14 '14 at 21:12
Thank you very much. I'll remember this in the future. I have solved my IDE issue also :) Yes I knew where to find project settings but I didn't know what to write there but now I found it. I had add compiler option: "
pkg-config --cflags gstreamer-1.0
" and in linker settings pkg-config --libs gstreamer-1.0
– dwinar
Oct 14 '14 at 21:12
@dwinar my update was a bit too late then. Was I correct?
– muru
Oct 14 '14 at 21:13
@dwinar my update was a bit too late then. Was I correct?
– muru
Oct 14 '14 at 21:13
Almost but that doesn't matter :P you saved me with your "sudo apt-get install libgstreamer1.0-dev" advice. Thanks again!
– dwinar
Oct 14 '14 at 21:18
Almost but that doesn't matter :P you saved me with your "sudo apt-get install libgstreamer1.0-dev" advice. Thanks again!
– dwinar
Oct 14 '14 at 21:18
|
show 1 more comment
For people using Eclipse you should do the followings to make the project from within Eclipse:
Right click the project name and select properties. Under C/C++ Build, select Settings.
Under Tool Settings, open GCC C complier and select miscellaneous.
Add the following to other flags text box:
`pkg-config --cflags gstreamer-1.0` -fPIC
Under Tool Settings, open GCC C++ Linker and select miscellaneous. Add the following to linker flags text box:
`pkg-config --libs gstreamer-1.0 gobject-2.0 glib-2.0`
Under Tool Settings, open GCC C++ Linker and select Libraries. Add gstreamer-1.0, gobject-2.0 and glib-2.0 under Libraries section.
Your application should compile and link successfully then.
add a comment |
For people using Eclipse you should do the followings to make the project from within Eclipse:
Right click the project name and select properties. Under C/C++ Build, select Settings.
Under Tool Settings, open GCC C complier and select miscellaneous.
Add the following to other flags text box:
`pkg-config --cflags gstreamer-1.0` -fPIC
Under Tool Settings, open GCC C++ Linker and select miscellaneous. Add the following to linker flags text box:
`pkg-config --libs gstreamer-1.0 gobject-2.0 glib-2.0`
Under Tool Settings, open GCC C++ Linker and select Libraries. Add gstreamer-1.0, gobject-2.0 and glib-2.0 under Libraries section.
Your application should compile and link successfully then.
add a comment |
For people using Eclipse you should do the followings to make the project from within Eclipse:
Right click the project name and select properties. Under C/C++ Build, select Settings.
Under Tool Settings, open GCC C complier and select miscellaneous.
Add the following to other flags text box:
`pkg-config --cflags gstreamer-1.0` -fPIC
Under Tool Settings, open GCC C++ Linker and select miscellaneous. Add the following to linker flags text box:
`pkg-config --libs gstreamer-1.0 gobject-2.0 glib-2.0`
Under Tool Settings, open GCC C++ Linker and select Libraries. Add gstreamer-1.0, gobject-2.0 and glib-2.0 under Libraries section.
Your application should compile and link successfully then.
For people using Eclipse you should do the followings to make the project from within Eclipse:
Right click the project name and select properties. Under C/C++ Build, select Settings.
Under Tool Settings, open GCC C complier and select miscellaneous.
Add the following to other flags text box:
`pkg-config --cflags gstreamer-1.0` -fPIC
Under Tool Settings, open GCC C++ Linker and select miscellaneous. Add the following to linker flags text box:
`pkg-config --libs gstreamer-1.0 gobject-2.0 glib-2.0`
Under Tool Settings, open GCC C++ Linker and select Libraries. Add gstreamer-1.0, gobject-2.0 and glib-2.0 under Libraries section.
Your application should compile and link successfully then.
edited Jan 3 '17 at 16:29
answered Dec 29 '16 at 19:46
mehdimehdi
113
113
add a comment |
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- 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%2faskubuntu.com%2fquestions%2f537132%2fhow-to-compile-c-c-program-with-gstreamer%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