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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T06:02:31+00:00 2026-06-10T06:02:31+00:00

I have the following struct. struct ShaderObject { const GLchar* File; ShaderType Type; GLuint

  • 0

I have the following struct.

struct ShaderObject
{
    const GLchar* File;
    ShaderType Type;
    GLuint Shader;
    ShaderObject(const GLchar* File, ShaderType Type);
};

And this type of map.

typedef map<string, ShaderObject> Shaders;

The compiler gives me an error, linking to the implementation of map.

 Error 1 error C2512: 'ShaderObject::ShaderObject': No appropriate default constructor
 available c:\program files (x86)\microsoft visual studio 11.0\vc\include\map 198 1

I don’t understand the error. How can I fix it? Because I never had an error like this before and I can’t explain, I am not sure which informations you will need. Please feel free to ask for details! Thanks a lot!

  • 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-06-10T06:02:32+00:00Added an answer on June 10, 2026 at 6:02 am

    You need to provide a default constructor (a constructor that can be called with no arguments) for ShaderObject if you want to put it inside std::map. The reason for this is, if you use operator[] on map for a key that doesn’t exist, it will automatically insert that key and a new ShaderObject as the value. It will use the default constructor to create this object.

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

Sidebar

Related Questions

I have following query: THis is my structure in some .h file typedef struct
I have the following code: struct Message { explicit Message(const std::string& message) : selfMessage(message)
I have the following struct typedef char String[256]; typedef struct { String name; int
I have the following struct: public struct Declarations { public const string SchemaVersion =
I have following code #include <stdio.h> #include<ctype.h> typedef struct { int Type; int Type2;
Suppose I have the following: struct Person { std::string mName; Birthday mBirthday; }; using
I have defined the following struct in C: typedef struct point{ float x; float
I have declared the following struct: typedef struct _RECOGNITIONRESULT { int begin_time_ms, end_time_ms; char*
I have the following struct declaration and typedef in my code: struct blockHeaderStruct {
I have the following struct in C# class public struct Employee { public const

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.