• Create Account

## [dev-c++] How to include a library?(solved)

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

7 replies to this topic

### #1d1rk  Members

Posted 05 September 2008 - 06:49 AM

I wanted to use this font rendering code but it depended on the freetype library. I downloaded the devpack and installed it. I added freetype.lib and freetype-bcc.lib to my linker. When I tried to compile the my program I got the following errors: I've got similar problems before when I tried to install other libraries. So could someone clearly explain to me how to include a library to dev-c++ without the devpack and to link it in my projects. Thank you [Edited by - d1rk on September 5, 2008 3:03:28 PM]

### #2Marineio  Members

Posted 05 September 2008 - 07:22 AM

Quote:
 Original post by d1rkI wanted to use this font rendering code but it depended on the freetype library. I downloaded the devpack and installed it. I added freetype.lib and freetype-bcc.lib to my linker. When I tried to compile the my program I got the following errors:I've got similar problems before when I tried to install other libraries. So could someone clearly explain to me how to include a library to dev-c++ without the devpack and to link it in my projects.Thank you

Can you post some code please?

### #3Josh Petrie  Moderators

Posted 05 September 2008 - 07:50 AM

It looks like the preprocessor sees you trying to do:
#include freetype.h

or something similar. However, as the error message tells you, the #include directive expects an argument in double quotes or angle brackets; in your case double-quotes are likely correct:
#include "freetype.h"

Before that, it also appears as if you are trying to include a file that the preprocessor cannot find, perhaps because it does not exist or your search paths are wrong.

### #4d1rk  Members

Posted 05 September 2008 - 08:14 AM

I didn't write this part of the code myself. I just included it like I was told to on the website of GLFT_Font.

GLFT_font code:
#ifndef GLFT_FONT_HPP#define GLFT_FONT_HPP#include <GL/gl.h>#include <ft2build.h>#include FT_FREETYPE_H#include <string>#include <vector>#include <stdexcept>#include <cstdarg>#include <sstream>

-lglfw -lopengl32 -lglu32C:/Dev-Cpp/lib/freetype.libC:/Dev-Cpp/lib/freetype-bcc.lib

I think my search paths are wrong but i've never learned how to make them right. So could someone tell how to make them right?

PS: I can host my whole project so far if you want to see more source code but I don't think that it'll help. I think the problem is in the linking of freetype.

### #5Josh Petrie  Moderators

Posted 05 September 2008 - 08:52 AM

#include FT_FREETYPE_H

That's not legal code, so I'm immediately distrustful of the source of the code -- assuming you did actually copy it verbatim.

Look in the Dev-C++ manual for include paths. I don't use the program (and because of its age, I don't recommend you do either, but transitioning to Visual C++ Express might be more re-education than you are willing to commit to immediately; nonetheless consider it for your next project).

### #6d1rk  Members

Posted 05 September 2008 - 09:03 AM

Quote:
 Original post by jpetrie#include FT_FREETYPE_HThat's not legal code, so I'm immediately distrustful of the source of the code -- assuming you did actually copy it verbatim.Look in the Dev-C++ manual for include paths. I don't use the program (and because of its age, I don't recommend you do either, but transitioning to Visual C++ Express might be more re-education than you are willing to commit to immediately; nonetheless consider it for your next project).

If you say the code isn't ok then I think I have to switch to another font rendering library. I'll try FTGL instead.

(offtopic) Why do you recommend VC++? If it's really better I don't mind switching.

### #7this_is_phil  Members

Posted 05 September 2008 - 09:47 AM

It looks like FT_FREETYPE_H is the header guard off of the header file. If you know the header file that you are trying to include then you just use the file name in double quotes. As for switching to VC++, I much prefer Code::Blocks, the interface is nicer in my opinion, I have never used Dev-C++ so I don't know how much different it is.

### #8SiCrane  Moderators

Posted 05 September 2008 - 10:02 AM

Quote:
 Original post by jpetrie#include FT_FREETYPE_HThat's not legal code, so I'm immediately distrustful of the source of the code -- assuming you did actually copy it verbatim.

Unfortunately, it is legal code. When using the FreeType library, in order to include the main header you need to do this:
#include <ft2build.h>#include FT_FREETYPE_H

Inside ft2build.h it #defines FT_FREETYPE_H to whatever the main FreeType header should be. It's crazy-stupid, but legal code.

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.