简体   繁体   中英

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

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.

Set up your IDE to look for Allegro:


(source: allegro.cc )

The complete tutorial is here:

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM