-1

I installed CodeBlocks 10.5 with minGW compiler. After setting environment variables for minGW I cheked gcc -v on cmd and it is working fine. The problem is that, I have made a small program in CodeBlocks project the code is below

#include <iostream>
#include <allegro5/allegro.h>

using namespace std;

int main()
{
cout << "Hello world!" << endl;
return 0;
}

There is an error, the build log is:

Compiling: main.cpp C:\Program Files\CodeBlocks\MinGW\bin\allegro_pract… error: allegro5/allegro.h: No such file or directory Process terminated with status 1 (0 minutes, 0 seconds) 1 errors, 0 warnings

Directory structure for codeblocks is: C:\Program Files\CodeBlocks and for minGW: C:\Program Files\CodeBlocks\mingw and my project is: C:\Program Files\CodeBlocks\bin\

i am confused about allegro library where to place it.. as I have not used any external library.. the library is placed now at: C:\Program Files\CodeBlocks\mingw\allegro\

I am "Googling" for a long time but no tutorial seems to be working.. please give a valid solution.. and where to place allegro library..??

Bilal
  • 2,645
  • 3
  • 28
  • 40

3 Answers3

2

Do not try to "place" libraries in the "right place". Instead, tell the IDE where you put them explicitly. This is called setting the include path.

Code::Blocks should have some setting for include directories. You should point it to the place where Allegro lives.

Nicol Bolas
  • 449,505
  • 63
  • 781
  • 982
  • 1
    This is the correct answer. You're in charge, you tell the damn compiler where to find allegro. – john Aug 23 '11 at 18:00
1

Set up your IDE to look for Allegro:


(source: allegro.cc)

The complete tutorial is here:

Community
  • 1
  • 1
Matthew
  • 47,584
  • 11
  • 86
  • 98
0

http://www.mingw.org/wiki/IncludePathHOWTO:

The actual search path, for any specific installation of MinGW may be determined, by running the compiler itself, with the "-v" option; typically, for a GCC-3.4.5 installation in c:/mingw:--

defaults appear to be:

c:/mingw/include/c++/3.4.5
c:/mingw/include/c++/3.4.5/mingw32
c:/mingw/include/c++/3.4.5/backward
c:/mingw/include
c:/mingw/lib/gcc/mingw32/3.4.5/include

I don't use mingw, so, read the link.

Mooing Duck
  • 64,318
  • 19
  • 100
  • 158