c++codeblocksallegro

Need help in C++ with allegro library....?


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..??


Solution

  • 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.