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

Added CMakeLists.txt and fixed C++17 compilation on Windows #10

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

prometey1982
Copy link

  • Removed unused headers
  • Added CMakeLists.txt for including into projects with CMake
  • Fixed compilation for modern C++

@prometey1982
Copy link
Author

@bfoz can look into?

#include "intelhex.h"

#include <fstream>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer to order includes with system (or std) includes before local includes

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In such case you can get into situation when .h file uses something from implementation but not includes it.

@@ -350,7 +348,7 @@ namespace intelhex

while( (s.get() == ':') && s.good() )
{
getline(s, line); // Read the whole line
std::getline(s, line); // Read the whole line
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this causing a compile error?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bfoz
Copy link
Owner

bfoz commented Jan 15, 2025

Sorry for the delay.

I don't use CMake, so I have no way of validating that part, or any way of maintaining it. Does CMake have a backwards-compatibility mode for using Makefiles?

The header changes look simple enough. Are those changes Windows-specific? Which parts are C++17 specific?

@prometey1982
Copy link
Author

I think that previously getline was not inside std namespace or something like this. Maybe there was some macros. When I took your library for my purposes I found that it has some Linux specific includes and doesn't compile with Visual Studio C++ 2022 with enabled C++17. This is way I named this PR as fix for C++17 on Windows.
CMake is very common for C++ projects. It allows to include dependencies in one line. For example, linking with libraries
https://github.com/prometey1982/VolvoTools/blob/master/VolvoLogger/CMakeLists.txt#L23

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants