Problems importing libraries to my c++ project, how to fix this?
I'm using the <XZY>
IDE to compile my program, and have some trouble to import/integrate a specific library with it.
I get error messages like
fatal error: 3rdPartyLib.h: No such file or directory
for a
#include "3rdPartyLib.h"
statement
ld.exe: cannot find `lib3rdParty.a`
for specifying
3rdParty
in the additional libraries
At least I got some error message like
undefined reference to `lib3rdParty::foo()'
What can I do to fix this?
c++ ide
add a comment |
I'm using the <XZY>
IDE to compile my program, and have some trouble to import/integrate a specific library with it.
I get error messages like
fatal error: 3rdPartyLib.h: No such file or directory
for a
#include "3rdPartyLib.h"
statement
ld.exe: cannot find `lib3rdParty.a`
for specifying
3rdParty
in the additional libraries
At least I got some error message like
undefined reference to `lib3rdParty::foo()'
What can I do to fix this?
c++ ide
add a comment |
I'm using the <XZY>
IDE to compile my program, and have some trouble to import/integrate a specific library with it.
I get error messages like
fatal error: 3rdPartyLib.h: No such file or directory
for a
#include "3rdPartyLib.h"
statement
ld.exe: cannot find `lib3rdParty.a`
for specifying
3rdParty
in the additional libraries
At least I got some error message like
undefined reference to `lib3rdParty::foo()'
What can I do to fix this?
c++ ide
I'm using the <XZY>
IDE to compile my program, and have some trouble to import/integrate a specific library with it.
I get error messages like
fatal error: 3rdPartyLib.h: No such file or directory
for a
#include "3rdPartyLib.h"
statement
ld.exe: cannot find `lib3rdParty.a`
for specifying
3rdParty
in the additional libraries
At least I got some error message like
undefined reference to `lib3rdParty::foo()'
What can I do to fix this?
c++ ide
c++ ide
edited Jul 12 '14 at 20:40
πάντα ῥεῖ
asked Jul 12 '14 at 18:06


πάντα ῥεῖπάντα ῥεῖ
73.1k976141
73.1k976141
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
It's a common misconception, that the current IDE used, is responsible for getting errors like stated in the question.
See for example
- c++ lib in two same project ,one can work but the other can 't
- Issue linking libxml++ and glib libraries with CodeBlocks IDE for C++ Windows
- ...
The problem is almost never related to the currently used IDE.
In the most cases the solution boils down, to supply the actual toolchain's compiler/linker with the appropriate path's to search for included headers, to be linked libraries.
One of the major applicable answers for the linker related problems are
What is an undefined reference/unresolved external symbol error and how do I fix it?
- undefined reference to `WinMain@16'
Most of the common IDEs provide features to configure this for a specific project. Here are some samples
Eclipse-CDT
Include path settings:
Library & library search path settings
Visual Studio 2013
Code Blocks
**DEV C++ (Bloodshed C++)
As from their FAQ:
9. How can i use the OpenGL library and others ?
All the libraries that comes with Mingw reside in the Lib directory. They are all named in the following way:
lib*.a
To link a library with your project, just add in Project options, Further option files :-lopengl32
This is for including thelibopengl32.a
library. To add any other library, just follow the same syntax:
Type-l
(L in lowercase) plus the base name of the library (filename withoutlib
and the.a
extension).
You may also consider putting a -L
option there to add directory pathes searched for libraries.
Qt Creator
In order to add include paths you have to open up the .pro file and then add
the directories to the INCLUDEPATH
variable. These paths are separated by spaces. Reference can be found here.
If none of the above samples applies for your actually used IDE/toolchain, I hope you're able to get the point of abstraction:
It's an issue how to provide compiling/linking options to your actual toolchain. The IDE used to setup the context is a minor point here.
add a comment |
For eclipse I use the pkg-config
plugin where possible:
https://marketplace.eclipse.org/content/pkg-config-support-eclipse-cdt
Failing that this configuration window:
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
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%2fstackoverflow.com%2fquestions%2f24715864%2fproblems-importing-libraries-to-my-c-project-how-to-fix-this%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
It's a common misconception, that the current IDE used, is responsible for getting errors like stated in the question.
See for example
- c++ lib in two same project ,one can work but the other can 't
- Issue linking libxml++ and glib libraries with CodeBlocks IDE for C++ Windows
- ...
The problem is almost never related to the currently used IDE.
In the most cases the solution boils down, to supply the actual toolchain's compiler/linker with the appropriate path's to search for included headers, to be linked libraries.
One of the major applicable answers for the linker related problems are
What is an undefined reference/unresolved external symbol error and how do I fix it?
- undefined reference to `WinMain@16'
Most of the common IDEs provide features to configure this for a specific project. Here are some samples
Eclipse-CDT
Include path settings:
Library & library search path settings
Visual Studio 2013
Code Blocks
**DEV C++ (Bloodshed C++)
As from their FAQ:
9. How can i use the OpenGL library and others ?
All the libraries that comes with Mingw reside in the Lib directory. They are all named in the following way:
lib*.a
To link a library with your project, just add in Project options, Further option files :-lopengl32
This is for including thelibopengl32.a
library. To add any other library, just follow the same syntax:
Type-l
(L in lowercase) plus the base name of the library (filename withoutlib
and the.a
extension).
You may also consider putting a -L
option there to add directory pathes searched for libraries.
Qt Creator
In order to add include paths you have to open up the .pro file and then add
the directories to the INCLUDEPATH
variable. These paths are separated by spaces. Reference can be found here.
If none of the above samples applies for your actually used IDE/toolchain, I hope you're able to get the point of abstraction:
It's an issue how to provide compiling/linking options to your actual toolchain. The IDE used to setup the context is a minor point here.
add a comment |
It's a common misconception, that the current IDE used, is responsible for getting errors like stated in the question.
See for example
- c++ lib in two same project ,one can work but the other can 't
- Issue linking libxml++ and glib libraries with CodeBlocks IDE for C++ Windows
- ...
The problem is almost never related to the currently used IDE.
In the most cases the solution boils down, to supply the actual toolchain's compiler/linker with the appropriate path's to search for included headers, to be linked libraries.
One of the major applicable answers for the linker related problems are
What is an undefined reference/unresolved external symbol error and how do I fix it?
- undefined reference to `WinMain@16'
Most of the common IDEs provide features to configure this for a specific project. Here are some samples
Eclipse-CDT
Include path settings:
Library & library search path settings
Visual Studio 2013
Code Blocks
**DEV C++ (Bloodshed C++)
As from their FAQ:
9. How can i use the OpenGL library and others ?
All the libraries that comes with Mingw reside in the Lib directory. They are all named in the following way:
lib*.a
To link a library with your project, just add in Project options, Further option files :-lopengl32
This is for including thelibopengl32.a
library. To add any other library, just follow the same syntax:
Type-l
(L in lowercase) plus the base name of the library (filename withoutlib
and the.a
extension).
You may also consider putting a -L
option there to add directory pathes searched for libraries.
Qt Creator
In order to add include paths you have to open up the .pro file and then add
the directories to the INCLUDEPATH
variable. These paths are separated by spaces. Reference can be found here.
If none of the above samples applies for your actually used IDE/toolchain, I hope you're able to get the point of abstraction:
It's an issue how to provide compiling/linking options to your actual toolchain. The IDE used to setup the context is a minor point here.
add a comment |
It's a common misconception, that the current IDE used, is responsible for getting errors like stated in the question.
See for example
- c++ lib in two same project ,one can work but the other can 't
- Issue linking libxml++ and glib libraries with CodeBlocks IDE for C++ Windows
- ...
The problem is almost never related to the currently used IDE.
In the most cases the solution boils down, to supply the actual toolchain's compiler/linker with the appropriate path's to search for included headers, to be linked libraries.
One of the major applicable answers for the linker related problems are
What is an undefined reference/unresolved external symbol error and how do I fix it?
- undefined reference to `WinMain@16'
Most of the common IDEs provide features to configure this for a specific project. Here are some samples
Eclipse-CDT
Include path settings:
Library & library search path settings
Visual Studio 2013
Code Blocks
**DEV C++ (Bloodshed C++)
As from their FAQ:
9. How can i use the OpenGL library and others ?
All the libraries that comes with Mingw reside in the Lib directory. They are all named in the following way:
lib*.a
To link a library with your project, just add in Project options, Further option files :-lopengl32
This is for including thelibopengl32.a
library. To add any other library, just follow the same syntax:
Type-l
(L in lowercase) plus the base name of the library (filename withoutlib
and the.a
extension).
You may also consider putting a -L
option there to add directory pathes searched for libraries.
Qt Creator
In order to add include paths you have to open up the .pro file and then add
the directories to the INCLUDEPATH
variable. These paths are separated by spaces. Reference can be found here.
If none of the above samples applies for your actually used IDE/toolchain, I hope you're able to get the point of abstraction:
It's an issue how to provide compiling/linking options to your actual toolchain. The IDE used to setup the context is a minor point here.
It's a common misconception, that the current IDE used, is responsible for getting errors like stated in the question.
See for example
- c++ lib in two same project ,one can work but the other can 't
- Issue linking libxml++ and glib libraries with CodeBlocks IDE for C++ Windows
- ...
The problem is almost never related to the currently used IDE.
In the most cases the solution boils down, to supply the actual toolchain's compiler/linker with the appropriate path's to search for included headers, to be linked libraries.
One of the major applicable answers for the linker related problems are
What is an undefined reference/unresolved external symbol error and how do I fix it?
- undefined reference to `WinMain@16'
Most of the common IDEs provide features to configure this for a specific project. Here are some samples
Eclipse-CDT
Include path settings:
Library & library search path settings
Visual Studio 2013
Code Blocks
**DEV C++ (Bloodshed C++)
As from their FAQ:
9. How can i use the OpenGL library and others ?
All the libraries that comes with Mingw reside in the Lib directory. They are all named in the following way:
lib*.a
To link a library with your project, just add in Project options, Further option files :-lopengl32
This is for including thelibopengl32.a
library. To add any other library, just follow the same syntax:
Type-l
(L in lowercase) plus the base name of the library (filename withoutlib
and the.a
extension).
You may also consider putting a -L
option there to add directory pathes searched for libraries.
Qt Creator
In order to add include paths you have to open up the .pro file and then add
the directories to the INCLUDEPATH
variable. These paths are separated by spaces. Reference can be found here.
If none of the above samples applies for your actually used IDE/toolchain, I hope you're able to get the point of abstraction:
It's an issue how to provide compiling/linking options to your actual toolchain. The IDE used to setup the context is a minor point here.
edited May 23 '17 at 12:17
community wiki
8 revs, 2 users 92%
πάντα ῥεῖ
add a comment |
add a comment |
For eclipse I use the pkg-config
plugin where possible:
https://marketplace.eclipse.org/content/pkg-config-support-eclipse-cdt
Failing that this configuration window:
add a comment |
For eclipse I use the pkg-config
plugin where possible:
https://marketplace.eclipse.org/content/pkg-config-support-eclipse-cdt
Failing that this configuration window:
add a comment |
For eclipse I use the pkg-config
plugin where possible:
https://marketplace.eclipse.org/content/pkg-config-support-eclipse-cdt
Failing that this configuration window:
For eclipse I use the pkg-config
plugin where possible:
https://marketplace.eclipse.org/content/pkg-config-support-eclipse-cdt
Failing that this configuration window:
edited Jul 28 '17 at 18:37
answered May 23 '15 at 13:18


GalikGalik
34.4k35080
34.4k35080
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- 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%2fstackoverflow.com%2fquestions%2f24715864%2fproblems-importing-libraries-to-my-c-project-how-to-fix-this%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