need help with problem

alain
2011-05-11
2012-09-26
  • alain

    alain - 2011-05-11

    Hi,

    I have been trying to compile this code with no avail.
    I am using windows XP. It's a long code but I have posted the first part of it
    below:

    include <iostream>

    include <cmath>

    include <fstream>

    using namespace std;

    struct geometricalshapes { // subroutine for assigning values to the particle
    geometrical shapes
    float side1, side2, side3, side4, side5;
    float angle1, angle2, angle3, angle4, angle5;
    float height, base, centroidx, centroidy, momentofinertiax, momentofinertiay,
    area;

    };

    float ddamping_coefficient, dk;
    double dstiffness_coefficient;
    double dtime_increment;
    float dmass;
    float ii; // mass moment of inertia
    float dresult;

    int main ()

    {
    geometricalshapes righttriangle; //the particle
    righttriangle.side1 = 4.243;
    righttriangle.side2 = 3;
    righttriangle.side3 = 3;
    righttriangle.angle1 = 45;
    righttriangle.angle2 = 45;
    righttriangle.angle3 = 90;
    righttriangle.height = 2.12;
    righttriangle.base = 4.243;
    righttriangle.centroidx = 0;
    righttriangle.centroidy = 0.707;
    righttriangle.momentofinertiax = 1.123;
    righttriangle.momentofinertiay = 3.374;
    righttriangle.area = 4.498;

    }}

    The error statement is the following:

    Compiler: Default compiler
    Executing g++.exe...
    g++.exe "C:\Dev-Cpp\my-project.cpp" -o "C:\Dev-Cpp\my-project.exe" -I"C:\Dev-
    Cpp\lib\gcc\mingw32\3.4.2\include" -I"C:\Dev-Cpp\include\c++\3.4.2\backward"
    -I"C:\Dev-Cpp\include\c++\3.4.2\mingw32" -I"C:\Dev-Cpp\include\c++\3.4.2" -I"C
    :\Dev-Cpp\include" -L"C:\Dev-Cpp\lib"
    C:\Dev-Cpp\my-project.cpp:42: error: expected declaration before '}' token

    Execution terminated

    This error statement applies to the last line posted (with double curly
    brackets) I have tried removing one or both brackets but the errors only
    increased.

    I appreciate any help...

     
  • DARC

    DARC - 2011-06-14

    Remove the second brace you know is wrong and start fixing your mistakes.

     
  • Tor E Syversen

    Tor E Syversen - 2011-12-25

    runninng w7 and c++ 4.9.9.2. the part you display shows no compiller problem
    reports, but notting else shows either. what was the idea of the code ?

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks