1

Is there a difference between #include and libraries? Or can you just include libraries in your application? Another thing I want to know is if I want to distribute my application how and where do I put the files that I've included in my program? Am I allowed to put the libraries and header files in the same folder as the .cpp files?

This confusion arose when I was trying to figure out how to install the SFML library into Dev-C++, now before you tell me that Dev is old and I should change, I won't because it works fine for me. I don't like Visual because it's a little disorienting, I just want something simple, like Dev-C++. If I have a folder called libraries in with my source files can I just do

#include <libraries/something.h>?
Paul R
  • 208,748
  • 37
  • 389
  • 560
  • *Is there a difference between #include and libraries?* Include pulls in a header, most often a description of a library. It provides identifier declarations to the compiler so that the compiler know that out there, somewhere exists a library that actually defined these identifiers. Later the linker comes along and combines the library with your compiled objects. See [How does the compilation/linking process work?](https://stackoverflow.com/questions/6264249/how-does-the-compilation-linking-process-work) for more details. – user4581301 Sep 08 '18 at 00:34
  • I do a lot of my work in a text editor from the 1990s. I'm in no position to tell someone that their dev tool of choice is too old. Unless they are a savage using ed. – user4581301 Sep 08 '18 at 00:35
  • ***Or can you just include libraries in your application?*** No you can't. At least in most cases. – drescherjm Sep 08 '18 at 00:38
  • I'm not up on Dev-C++ and I don't know how you add libraries to a project with it. One of the project properties menu options should be something along the lines of *Add Library* Googling "dev-c++ add library" looks like it has promising results. I'd start there. – user4581301 Sep 08 '18 at 00:39
  • My concern is that you have libraries that are compatible with the toolchain used in your IDE. Visual Studio binaries should be avoided. – drescherjm Sep 08 '18 at 00:42
  • 2
    Indeed. A library for Visual Studio isn't going to work with whatever compiler is backing DevC++ and it's entirely possible that libraries compiled for different versions of the same compiler will not work correctly. One of the common ones is folk trying to use winbgi libraries from 2005 (gcc3.4) with a newer development system (gcc6.3 is quite hip). – user4581301 Sep 08 '18 at 00:52
  • You're asking a lot of questions here -- which is of itself not a bad thing, but we're better at answering more specific inquiries. I think that before you worry about things like choice of tools and how to arrange source files and headers in the directory tree, you should get a good solid grasp of what the compiler and linker do, using material like what @user4581301 has cited. – Beta Sep 08 '18 at 01:08
  • I understand what you are saying, I should've been a little more descriptive. I know how to add a library to Dev-C++, I was looking for a solution to my 'where am I allowed to put the library files' question I guess. Thanks for the clarification on libraries. So they are the whole thing, the headder files and dlls that make up the whole API? Like a shelf of books in a library. –  Sep 08 '18 at 01:22
  • @user4581301 It's mingw usually. But DevC++ is a pure IDE, you can use any compiler even Windows SDK's one. Have to have proper makefile for particular toolchain though. – Swift - Friday Pie Sep 08 '18 at 01:26

0 Answers0