Author Topic: Symbol not found  (Read 295 times)

patrickkox

  • Senior Community Member
  • Posts: 111
  • Hero Points: 4
  • Debian GNU/Linux user
Symbol not found
« on: November 25, 2020, 05:00:45 pm »
I'm working with the book "Programming Principles and Practice using C++" By Bjarne Stroustrup and I'm getting a lot of Symbol not found "colors" in SE25 (SlickEdit Pro 2020 (v25.0.0.9 64-bit) on Linux).
The code compiler and runs so there doesn't seem to be a problem there. Also the Defs window shows the Symbols.


The strange this is that if you look at line 18 you'll see that x_orig is colored white but y_orig is orange (both are constexpr int)
When I hover over x_orig it shown that it evaluates to int (I've enabled that in the options) but it doesn't do that for y_orig


Also all defintions of the constexpr variables from lines 20 to 26 show "Symbol not found"


I've attached a screenshot.

Dennis

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 3144
  • Hero Points: 453
Re: Symbol not found
« Reply #1 on: November 30, 2020, 03:05:02 pm »
It looks like local variable parsing gave up after 'orig' with the brace initializer.

Could you save me 15 minutes and attach main.cpp ?
« Last Edit: November 30, 2020, 03:06:33 pm by Dennis »

patrickkox

  • Senior Community Member
  • Posts: 111
  • Hero Points: 4
  • Debian GNU/Linux user
Re: Symbol not found
« Reply #2 on: November 30, 2020, 03:13:49 pm »
Code: [Select]

#include "Simple_window.h"  // if we want the "next" button
#include "Graph.h"


double one(double) {return 1;}
double slope(double x) {return x/2;}
double square(double x) { return x * x;}


int main()
try
{
   using namespace Graph_lib;


   constexpr int xmax = 600;               // window size
   constexpr int ymax = 400;               // window qize


   constexpr int x_orig = xmax / 2;        // position (0,0) is center of the window
   constexpr int y_orig = ymax / 2;
   const Point orig{x_orig, y_orig};        // constexpr will not compile !


   constexpr int r_min { -10 };              // range [-10::11)
   constexpr int r_max = 11;


   constexpr int n_points = 400;           // number of points used in range


   constexpr int x_scale = 30;             // scaling factor
   constexpr int y_scale = 30;             // scaling factor


   Simple_window win{Point{100, 100}, xmax, ymax, "Function graphing"};


   Function s{one, r_min, r_max, orig, n_points, x_scale, y_scale};
   Function s1{slope, r_min, r_max, orig, n_points, x_scale, y_scale};
   Function s2{square, r_min, r_max, orig, n_points, x_scale, y_scale};


   Text ts{Point{100, y_orig - 40}, "one"};
   Text ts2{Point{100, y_orig + y_orig / 2 - 20}, "x/2"};
   Text ts3{Point{x_orig - 100, 20}, "x*x"};
   win.set_label("Function graphing: label functions:");


   constexpr int xlength = xmax - 40;   // make the axis a bit smaller than the window
   constexpr int ylength = ymax - 40;


   Axis x{Axis::x, Point{20, y_orig}, xlength, xlength / x_scale, "one notch = 1"};
   x.set_color(Color::red);
   Axis y{Axis::y, Point{x_orig, ylength + 20}, ylength, ylength / y_scale, "one notch = 1"};
   y.set_color(Color::red);


   win.attach(s);
   win.attach(ts);
   win.attach(s1);
   win.attach(ts2);
   win.attach(s2);
   win.attach(ts3);
   win.attach(x);
   win.attach(y);
   win.wait_for_button();




} catch (exception& e){
        // some error reporting
    return 1;
} catch (...){
        // some more error reporting
    return 2;
}


Hope this helps[/code]
« Last Edit: November 30, 2020, 05:31:38 pm by patrickkox »

Dennis

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 3144
  • Hero Points: 453
Re: Symbol not found
« Reply #3 on: November 30, 2020, 06:56:37 pm »
Yes, looks like a problem parsing the brace initializer.  I will see if I can put a fix in for the next point release.

Dennis

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 3144
  • Hero Points: 453
Re: Symbol not found
« Reply #4 on: December 01, 2020, 01:18:00 am »
Fixed for a future release (25.0.1).