Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4323996
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T09:04:25+00:00 2026-05-21T09:04:25+00:00

I am writing a C++ OpenGL project using DevIL and I am getting compile-time

  • 0

I am writing a C++ OpenGL project using DevIL and I am getting compile-time errors while trying to work out how to load an image to use as a texture.

So far I have this

//Declarations
const char* filename = "back.bmp";
ILboolean ilLoadImage(const char *filename);

ILuint image;
ilGenImages(1, &image);
ilBindImage(image);

//Load the image
if (!ilLoadImage(filename))
{
throw runtime_error("Unable to load image" +filename);
}

which presents me with the error: error C2110: '+' : cannot add two pointers

if I change the declaration of filename to string filename = "back.bmp"; and the if statement to

if (!ilLoadImage(const_cast<char*>(filename.c_str())))

I get this linker error error LNK1104: cannot open file 'DevIL.libkernel32.lib'

I am certain that I have placed all the DevIL files where they need to be and added the dependencies in Project->Properties->Linker->Input->Additional Dependencies.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T09:04:26+00:00Added an answer on May 21, 2026 at 9:04 am

    Fix the compile error by ensuring you add C++ strings not C strings

    throw runtime_error(std::string("Unable to load image") +filename);
    

    Fix the link error by putting a space in between the libs in Additional Dependencies.

    Also, if you have to use const_cast, odds are you’re doing it wrong.

    ILboolean ilLoadImage(const char *filename);
    

    You don’t need to cast to char * in order to pass .c_str() – .c_str() returns a const char *

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been working on a project in C++ using openGL and am looking to
I'm writing opengl code in python using the library pyglet. When I draw to
I have been writing an OpenGL game engine for a while which uses SDL
I just started learning opengl and writing a first person shooter but I'm getting
I'm writing a rendering routine in C using opengl es 2.0 with NDK. I'm
I am writing an application in C++ using CGL/OpenGL, and need keyboard/mouse input. I
I'm writing a simple graphics engine that draws textures on the screen using OpenGL
I'm writing a simple OpenGL application that uses GLUT . I don't want to
I'm writing a basic planet viewer OpenGL Perl application, just for fun. I have
Writing a JSP page, what exactly does the <c:out> do? I've noticed that the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.