📖
Wiki
Back to my personal website
  • Home
  • Equipment and Devices
    • 3D Printer
    • Laser Cutter
    • Motion Capture System
    • Sensors
      • RGB-D Cameras
      • Velodyne LiDAR
      • Zed Camera
      • RealSense D435i
      • IMU
    • eGPU
    • Nvidia AGX Xavier
    • CPU Benchmark
    • Installation Checklist
  • Development
    • Linux
      • Shell
      • GDB
      • Git
      • Tmux
      • Network
      • Tricks
      • Debug FAQ
    • CMake
      • Catkin Tools
      • CMakeLists
      • CMake Variables
      • CMake Commands
      • CMake: find_package()
    • ROS
      • Gazebo
      • wstool
      • roslaunch
      • rosbag
      • multi-threaded spinner
    • ROS2
      • Convert ROS1 bag to ROS2 bag
    • C++
      • C++ 11
      • C++ Examples
      • C++ Debug
      • Factory Method
      • Timing
    • Google Tools
      • GLog
      • GFlags
      • GTest
      • Style Guide
      • Clang Format
    • PCL
      • Point Type
      • Methods
      • Architecture
      • Code Explained
    • Open3D
      • Python API
      • Registration
      • Visualization
      • Tools
    • OpenCV
      • Documentation
      • Modules
    • Other Libraries
      • Eigen
      • Ceres
      • g2o
      • GTSAM
    • Website
  • Algorithm
    • SLAM
      • K-D Tree
      • Octree
      • Bag of Words
      • Distance Measures
      • Coordinate Systems
      • LOAM
      • Iterative Closest Point
      • Generalized ICP
      • Mahalanobis Distance
    • Computer Science
      • Computational Model
      • Sorting
      • Analysis
      • Complexity Classes (P, NP)
      • Divide and Conquer
      • Greedy Algorithm
      • Dynamic Programming
      • Tree
      • Graph
    • Computer Vision
      • Camera Models
      • Distortion
      • Motion Models
      • Shutter
      • Image Sensors
      • Epipolar Geometry
      • Multiple-View Geometry
    • Datasets
      • RGB-D Datasets
      • Point Cloud Datasets
      • LiDAR SLAM Datasets
  • Math
    • Optimization
      • Convex Optimization
      • Descent Methods
    • Probability
      • Moment
      • Covariance Matrix
      • Stochastic Process
    • Topology
      • References
      • Concepts
      • Topological Spaces
      • Representation of Rotations
      • Representation of 3-sphere
    • Algebra
      • Linear Algebra
      • Matrix Factorization
      • Condition Number
      • Matrix Lie Group
    • Differential Geometry
      • Manifold
      • Submanifold
      • Quotient Manifolds
      • Tangent Space
  • Quadrotor
    • PX4 Development
    • Companion Computer
    • Drone Hardware
    • Propeller Lock
    • Debug
  • Favorites
    • Bookmarks
Powered by GitBook
On this page
  • Debug FAQ
  • error: if condition proceeds with a bool variable that is false
  • error: variable or field declared void

Was this helpful?

  1. Development
  2. C++

C++ Debug

Debug FAQ

error: if condition proceeds with a bool variable that is false

fake_indices_ = false; // member variable initialized somewhere else

bool MultiviewGICP::initCompute() {
  std::cout << "fake_indices_ = " << fake_indices_ << std::endl;
  // this prints 0, and confirms that fake_indices_ was indeed initialized as false
  if (fake_indices_) {
    std::cout << "we are getting here." << std::endl;
    // the weird thing is that this line of code gets printed out,
    // meaning that we reached this code block, suppressing the if condition
  }
  // the root cause of this problem was the missing of the return statement below,
  // which is required of this function.
  // Without it, program proceeds with whatever code being compiled in the memory.
  return true;
  // if you put directly "if (false)", the above code block will not be executed,
  // since they may be optimized out during compilation.
}

error: variable or field declared void

// for example it happens in this case
void initializeJSP(unknownType Experiment);

// another example (due to the missing 'typename' keyword)
template <typename PointT>
void func(pcl::PointCloud<PointT>::Ptr& cloud) {} // error
void func(typename pcl::PointCloud<PointT>::Ptr& cloud) {} // correct

PreviousC++ ExamplesNextFactory Method

Last updated 1 year ago

Was this helpful?

reference:

https://stackoverflow.com/questions/364209/variable-or-field-declared-void