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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T19:26:53+00:00 2026-06-14T19:26:53+00:00

When trying to compile my code i get the following errors every time. These

  • 0

When trying to compile my code i get the following errors every time.
These are the errors:

C:\...\main.cpp In file included from main.cpp
C:\...\triangle.h In constructor `trianglePlus::trianglePlus(double, double, double, char*)':
C:\...\triangle.h expected `{' at end of input
C:\...\Makefile.win [Build Error]  [main.o] Error 1 

And here’s a stripped down version of my program.

triangle.h :

class triangle { 
  double x;
  double y;
  double z;

  public:
         triangle(double a,double b,double c);
  };
class trianglePlus: public triangle {
  char * name;
  public:
         trianglePlus(double a,double b,double c,char * v):triangle(a,b,c);
  };

When removing the commented section it gives me even more errors.
main.cpp

#include <cstdlib>
#include <iostream>
#include <math.h>
#include "triangle.h"
using namespace std;

triangle::triangle(double a, double b, double c) {
    x = a;
    y = b;
    z = c;
}

/*
trianglePlus::trianglePlus(double a,double b,double c,char * v):trijsturis(a,b,c) {
    x = a;
    y = b;
    z = c;
    name = new char[20];
    strcpy(name,v);
    }
*/

int main()
{
    system("PAUSE");
    return 0;
}

Any ideas what could be wrong?

  • 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-14T19:26:54+00:00Added an answer on June 14, 2026 at 7:26 pm

    Your constructor needs to be either fully defined or only declared. Since you want to specify the initializer list, you need to define the full constructor. Best like this, inline in the class definition:

    trianglePlus(double a, double b, double c, char * v)
    : triangle(a,b,c)
    , x(a)
    , y(b)
    , z(c)
    {
    }
    

    Alternatively, just put the declaration in the header, and the definition in the source file:

    trianglePlus(double a, double b, double c, char * v);
    

    trianglePlus::trianglePlus(double a, double b, double c, char * v)
    : triangle(a,b,c)
    , x(a)
    , y(b)
    , z(c)
    {
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to compile code in g++ and I get the following errors: In
I get the following errors when trying to compile the below code using g++.
I get following error with following Objective-C code, while trying to compile it with
I am trying to get the following code to compile using g++ 4.2.1 and
I'm trying to compile a very simple c++ code and get a linking error
I get an incomplete type error when trying to compile my code. I know
I'm trying to compile some code which contains the following declaration, because I would
I'm trying to compile and run the task-android-sample code from Google's API website. I
Trying to compile the following code on different compilers gives me two different results:
I am trying to compile some C++ code from the Festival project. When I

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.