Thread: I'm baffled by the build-error which CB lists for my rykor5_Cpp.cpp file.

  1. #1
    Registered User
    Join Date
    Oct 2021
    Posts
    6

    I'm baffled by the build-error which CB lists for my rykor5_Cpp.cpp file.

    Code:
    /*========================================================================
    /
    /  rykor5_Cpp.cpp is a radiation slide-rule program that computes Radiancy,
    /  dW/dT, Photons/sec*cm2, and Fluctuation /sec*cm2 from four constants,
    /  three user keyed-in values, and ~23 lines of math-computations,
    /  to evaluate 4 variables (ail, bil, cil, dil) that are dbl type data.
    /========================================================================*/
    #include <iostream>
    
        using nsmespace std;
    
    #include <cmath>
    #include <cstdlib>
    #include <string>
    
    int main()
    {
    
    double c1 = 6.34E+10;
    double c2 = 8.69E-13;
    double c3 = 1.4388E+4;
    double pai = 1.314159265;
    double c5 = pow(pai,4)/15; // 6.493939
    double c6 = pow(pai,3)/12; // 2.5838
    double c7 = (pai*pai)/3;   // 3.29
    double temp = 253.;
    double wlen1 = 3.50;
    double delwl = 0.10;
    double don1 = c1*pow(temp,3);
    double don2 = c2*pow(temp,3);
    double don3 = c3/temp;
    double don4 = don2*temp;
    double a8, b8, c8, ail, bil, cil, dil;
    double x1 = don3/wlen1;
    double el = c1/c1;
    double s1 = 1.0;
    double wai = s1*x1;
    double zee = 1.0/exp(wai);
    
    a8 = b8 = c8 = ail = bil = cil = dil = 0.0;
    /*    printf ("What initial-wl?, Ent 4-chars");
        printf ("\t (key-in as X.XX or XX.X um)\n");
        scanf (" %f1, &wlen1; &f1");
        printf ("What delt-wl?, Ent 4-chars");
        printf ("\t (key-in as X.XX or XX.X um)\n");
        scanf (" %f2, &delwl; &f2\n");
        printf ("What source-temp?, Ent up to 5-chars");
        printf ("\t (key-in as XX. to XXX. kelvins)\n");
        scanf (" %f3, &temp; &f3"); */
    
         /*
        printf ("Units of current inputs are %s  %s", um,  kelvins);
        printf ("Input-values are %.1f.%.2f.%f\n", wlen, temp); */
    
    // Stall loop for (el  =  1; el +< 120; el++)
    //  Stall this loop until program runs OK one pass!
    
            a8 = zee*(wai*wai+2*wai+2);
            b8 = zee*(pow(wai,3)+3*wai*wai+6*wai+6);
            c8 = zee*(pow(wai,4)+4*pow(wai,3)+12*wai*wai+24*wai+24);
    
            ail = ail+a8/s1*s1*s1;
            bil = bil+a8/s1*s1;
            cil = cil+b8/s1*s1*s1*s1;
            dil = dil+c8/s1*s1*s1*s1;
    /*        if (n-1)100,43,44; 43 is shorter; & 44 is longer */
    /*        ail = c6-ail;  44
            bil = c7-bil;
            cil = c5-cil;
            dil = 4*c5-dil */
    
            ail = don1*ail; /* 43 */
            bil = don1*bil;
            cil = don4*cil;
            dil = don2*dil;
    
        std::cout <<  temp;
        std::cout <<  wlen1;
        std::cout <<  cil;
        std::cout <<  dil;
        std::cout <<  ail;
        std::cout <<  bil;
        std::cout << '\n';
    
        return(0);
    }

    The line-10 error is:
    ||=== Build file: "no target" in "no project" (compiler: unknown) ===||
    g\rykor5_Cpp.cpp|10|error: expected nested-name-specifier before 'nsmespace'|
    ||=== Build failed: 1 error(s), 0 warning(s) (0 minute(s), 0 second(s)) ===|

    Pray tell, what is a "nested-name-specifier"?

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,401
    Simple typo error: the word is "namespace", not "nsmespace". Having said that, this using directive should be placed after the last header inclusion so as to avoid affecting the contents of the included headers.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Oct 2021
    Posts
    6
    Sharp eye there laserlight! Thank you. That typo has been bugging me for a week or two. I blame it on my old eyes, as well as being a poor typist. Also thanks for the three links guiding one to be better at forming questions. And I like the advice regarding submitting only the smallest program snippet which contains the error. Hah! I should have submitted C::B's one-line error statement!
    After making the recommended change, rykor5_Cpp.cpp ran to completion and output six values, which when compared to hard-copy data--decades old--showed values matched very well! Best regards; notacoder
    Last edited by notacoder; 11-05-2021 at 11:26 PM. Reason: Added statement

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 5
    Last Post: 12-06-2015, 04:25 PM
  2. Replies: 2
    Last Post: 07-31-2015, 02:11 PM
  3. Error in Exceptions.h file during build of QuickFix library
    By arupsarkar in forum C++ Programming
    Replies: 3
    Last Post: 07-16-2010, 10:30 AM
  4. Build error
    By yusko63 in forum C++ Programming
    Replies: 5
    Last Post: 03-26-2010, 11:53 PM
  5. build tree of directories sub-directories using linked-lists
    By geekoftheweek in forum C Programming
    Replies: 3
    Last Post: 10-02-2008, 11:13 PM

Tags for this Thread