Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some headers don't compile independently #184

Open
abmukh opened this issue Oct 8, 2021 · 7 comments
Open

Some headers don't compile independently #184

abmukh opened this issue Oct 8, 2021 · 7 comments

Comments

@abmukh
Copy link

abmukh commented Oct 8, 2021

Tried executing a basic try code Try1.cpp in vol_test/examples/Sampling_New:

   #include<stdio.h>
   #include "random_walks.hpp"
   using namespace std;
   int main()
   {
        cout<<"Ran"<<endl;
        return 0;
   } 

Returned the following error (sqrt,pow not a member of std):
cmath_error
Resolved that by using #include<cmath> . However cmath ideally should not have been needed to be included.

@vissarion vissarion changed the title <cmath> required while executing makefile <cmath> required for compiling with some header files Oct 8, 2021
@vissarion
Copy link
Member

This is part of a more general issue probably. Could you test which headers cannot be included separately?

@abmukh
Copy link
Author

abmukh commented Oct 9, 2021

I did a partial check. The try code is available as the same name in the same directory, now modified . Here is what I found :
Those that need headers :

  1. Containers ( Checked for <array>,<deque>,<forward_list>,<map>,<unordered_map>,<unordered_set>,<stack>,<queue>,<vector>)
  2. Numeric Limits (Checked for <cfloat>,<cinttype>,<climits>,<cstdint>)
  3. Numeric Library ( Checked for <cmath>,<cfenv>,<complex>,<random>,<numeric>,<ratio>,<valarray>)
    Those that do not need header files:
  4. String Libraries ( Checked for <cctype>,<cstring>,<string>)
  5. Error Handling ( Checked for <cassert>,<cerrno>,<exception>)
  6. I/O ( Checked for <iostream>,<cstdio>)
  7. Algorithms ( Checked for <algorithm>)
    Will add if I encounter more

@aditiaher
Copy link

Try by adding header file #include<bits/stdc++.h>

@vissarion
Copy link
Member

The goal here is that every header file should include the headers that are needed to be included autonomously. For example, the issue above is caused by boundary_cdhr_walk.hpp that misses #include<cmath>.

@abmukh if you want to give it a try please open a PR.

@vissarion vissarion changed the title <cmath> required for compiling with some header files Some headers don't compile independently Oct 12, 2021
@Neel-Shah-29
Copy link

Neel-Shah-29 commented Feb 25, 2022

Hello i would like to try this issue. I only need to include the cmath header file in boundary_cdhr_walk.hpp right?
Also if there are any other header files that needs to be included than kindly let me know. Thanks!

@himanshuParashar0101
Copy link

hi kindly assign this issue to me
I think we should give all the header file into a one header file likes its kind of merging the header file and making our own header that reads the data from it

@Neel-Shah-29
Copy link

Neel-Shah-29 commented Feb 27, 2022

Hey @Himanshu i am already trying this issue and have sent a PR regarding it , so you can give your suggestions in PR if you want ,i can resolve it .

sharmapranay38 added a commit to sharmapranay38/volesti that referenced this issue Feb 4, 2023
included the library <cmath>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants