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 558181
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T12:06:17+00:00 2026-05-13T12:06:17+00:00

I found that handy opencv library and tried to program a simple imagemodifier with

  • 0

I found that handy opencv library and tried to program a simple imagemodifier with it using C. When I started to compile my code I got some errors, that are a bit confusing as they doesn’t seem to make sense. This is my first time when programming with netbeans and first time I’m trying to make something else than those basic calculator etc. programs. Below is the code and the errors the compiler gives:

int iscolor = -1; /* Used to load the image as it is*/
IplImage* image = 0;

/* Load Image */
image = cvLoadImage(const char* 'test.jpg', iscolor); /* line 34 */

/*Modify image*/
...

/* Save Image */
int cvSaveImage(const char* 'modified.jpg', const CvArr* image); /* line 43 */

/*End*/

Compiler errors

main.c: In function ‘main’:

main.c:34: error: expected expression
before ‘const’

main.c:34:37: warning: character
constant too long for its type

main.c:34: error: too few arguments to
function ‘cvLoadImage’

main.c:43:33: warning: character
constant too long for its type

main.c:43: error: expected ‘;’, ‘,’ or
‘)’ before ‘\x2e6a7067’

These errors confuses me a bit, because

  1. referring to opencv c reference cvLoadImage takes just two arguments.

  2. how come character constant is too long?

  3. expected expression before ‘const’? hummm… I don’t get this at all

  4. expected ‘;’, ‘,’ or ‘)’ before ‘\x2e6a7067’… well I don’t get this either

    So can somebody tell me what I’m doing wrong? Any help would be nice 🙂

  • 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-13T12:06:17+00:00Added an answer on May 13, 2026 at 12:06 pm

    In C, single quotes are used to denote single (literal) character constants, and the resulting type of such constants is int. So, 'a' is OK, 'a1' is not, because that’s two characters. C defines some escape sequences, for example '\n', which is treated as one character signifying a newline, or '\xff', which is the character with hexadecimal value 0xff. Since 'test.jpg' contains more than one character, the compiler is telling you that your literal character constant is too long. You want a string, which needs double quotes.

    You need to put parentheses around a cast: (const char *)x is okay, const char * x is not (well it is okay if you are declaring x as a const char *). I think you added that cast because the compiler was warning you about “converting int to pointer without a cast”. In general, unless you really know what you’re doing, casting to silence the compiler is a very bad idea.

    Based upon the above, Line 34 should be:

    image = cvLoadImage("test.jpg", iscolor);
    

    If you really want to cast "test.jpg" as const char *, do:

    image = cvLoadImage((const char *)"test.jpg", iscolor);
    

    Also, now you know how to fix this line:

    int cvSaveImage(const char* 'modified.jpg', const CvArr* image);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 307k
  • Answers 307k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer As long as the UIScrollView has contentSize.width ≤ bounds.width there… May 13, 2026 at 9:33 pm
  • Editorial Team
    Editorial Team added an answer you can also use cat or NONE as reducer argument. May 13, 2026 at 9:33 pm
  • Editorial Team
    Editorial Team added an answer The oldest question asked by adopters of XML is when… May 13, 2026 at 9:33 pm

Related Questions

I would like to read a EAN-13 bar-code from an image in C. I
I'm configuring the admin site for my new app, and I found a little
I have a file that was deleted, but is still held open my a
I'm writing a Cocoa application that displays the contents of an archive file in
Going through Javascript documentation, I found the following two functions on a Javascript object

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.