Click here to Skip to main content
15,881,882 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have SDL set up in a project and want to also include the image and mixer libs ,but i get this error.

http://imgur.com/a/ltM93

What I have tried:

I don't know how these things work but the .h image lib shows up when I try to include it so i must be missing something
Posted
Updated 21-Mar-17 5:08am
v2
Comments
Richard MacCutchan 21-Mar-17 11:06am    
The message is quite clear. The compiler cannot find that file within any of the default directories, or any of the ones in the include list. Make sure the file is in the proper place.
Member 13049206 21-Mar-17 11:35am    
Again i don't really know how these things work,why doesn't the compiler find those but can find the SDL2 lib what's the difference
Richard MacCutchan 21-Mar-17 11:59am    
The compiler does not use .lib files, they are used by the linker, and may be in different directories. If you do not understand the compilation and search rules then I suggest going to the documentation pages for the compiler in question.

1 solution

You have to tell the compiler where he should look for include files. This is usually done by using the -I command line option and environment variables. See also The C Preprocessor: Search Path[^].

When using an IDE, there is usually a configuration option to specify additional pathes (for the current project and gobally for all projects). Add there the path to your SDL.h file.

Note that similar applies to the .lib library files for which there are also path options.
 
Share this answer
 
Comments
Member 13049206 21-Mar-17 11:32am    
Mind telling me how to do it? i can't quite understand what u are saying
Jochen Arndt 21-Mar-17 11:52am    
Ask yourself: Where is the file stored (full path)?

Execute on the command line:

gcc -v /dev/null -o /dev/null

Is the path listed (after "#include")?

If not, the compiler can not find the file. So you must tell the compiler about the path.

The simplest way to do this is using the IDE (Integrated Development Enviroment) you are using. Because you did not tell us which you are using, we can't help (from your image I can only see that you use the GCC compiler).

Read the documentation of the IDE. Or search the web "<name_of_ide> include path".

My problem is that I can't help you with a simple solution because you did not gave us some important information:
- Which OS (Windows, Linux, Mac)
- Whih IDE (e.g. Visual Studio, CodeBlocks, Dev C++)
- Which compiler (I got GCC from the image)
Member 13049206 21-Mar-17 12:08pm    
I have windows 10 using Code::Blocks 16.01 with GCC
Jochen Arndt 21-Mar-17 12:59pm    
See http://www.learncpp.com/cpp-tutorial/a3-using-libraries-with-codeblocks/
Member 13049206 21-Mar-17 13:35pm    
I thought i did those , look at the photos what else do i need to do?


[^]

[^]

[^]

[^]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900