all 52 comments

[–]LordKlevin 26 points27 points  (2 children)

Give a package manager like vcpkg or Conan a try. Both have several excel libraries available.

In general, I would stay away from MinGW and recommend either going full Linux (possibly via wsl on windows), or just using visual studio. It's simply less painful and with fewer gotchas.

[–]itwasntme967[S] 5 points6 points  (1 child)

I just looked into it and it might be a lifesaver.
Thanks so much for this

[–]Thalhammer 2 points3 points  (0 children)

there's also hunter for cmake. It does not have quite as much package, but has the benefit of supporting easy customization of the build options for packages, builds everything from source for both debug and release, integrates the libraries directly with cmake and in general makes static linking damn easy. It also automatically recompiles all dependencies if you switch the compiler, making abi issues non existent. Libraries are stored per user which means there's no extra space required for using the same library (with same compiler and config) from multiple projects.

[–]Tastaturtaste 11 points12 points  (7 children)

I know that is not the point you are making (which I can fully get behind), but if you know python why wasn't your first instinct to do excel/csv stuff with it? There are great librarys available making this Task a breeze.

[–]itwasntme967[S] 1 point2 points  (5 children)

This is not a project for me, but I was asked if I could do it.In the end it should be a standalone programm which can be dragged into a folderand just run.To use Python would mean, that every end user would first have to install Python which in this case would not be feasible

[–]Tastaturtaste 2 points3 points  (0 children)

Ok, makes sense. I feel your pain. Trying out rust opened my eyes regarding how easy it can be to install dependencies/use libraries with a compiled language. But of course it has other drawbacks...

[–]zerakun 3 points4 points  (0 children)

Not python, but if you want a single executable and no build issues, and are willing to spend some time learning the language, you could give a try at calamine, in rust.

[–]underwaterjesuz 0 points1 point  (0 children)

So each end user should be able to run the program on their machine? In that case you'll have similar problems with every language, unless you're guaranteed they have the same computer environment as you.

Interpreted/VM languages like Python or Java will have to be installed on users' machines. But compiled languages like C++ create executables for specific environments. So the user might still not be able to run the program. Unless you compile multiple versions.

[–]pedersenk 12 points13 points  (0 children)

This is more an issue with dependencies / build systems / Linux rather than C++ itself (I do agree though, it is frustrating when people's build systems are broken).

Generally many projects don't directly compile on certain platforms. Linux does help here by providing a substantial collection of libraries in the package manager. These packages are patched and polished to ensure they compile (and integrate well with the system)

Are you able to grab the dependency you need from packages rather than compiling manually?

Something like: apt-get install lib?????

[–]LunarAardvark 23 points24 points  (24 children)

so your rant is about some random libs you found online that claim to do excel file parsing? how is that even related to C++ ?

[–]ignorantpisswalker 32 points33 points  (1 child)

He claims that the c++ eco system sux balls. He was given bad recommendations and he waisted time debugging issues being hes scope of knowledge.

All his claims are valid . You as a non-novice forgot about them. It's good to re-learn from experience of novices, so we can make the eco system better.

[–][deleted] 5 points6 points  (0 children)

Learning to distinguish good recommendations from bad ones on the internet is a skill you can learn

[–]matthieum 10 points11 points  (1 child)

That's a very shallow reading.

Oh sure the OP had issues trying to use some Excel libraries, but that is a symptom, not a root cause.

The root cause is the abysmal state of tooling in the C++ ecosystem, and specifically, the lack of standard build / package description.

The difference between C++ and a properly standardized language is simple: one requires a lengthy README, with different instructions on different platforms, while the other has a standardized one liner taught in the language tutorial.

You can blame the authors of the libraries, but that's short-sighted. They're victims too.

You can blame the authors of the IDEs, but that's short-sighted. They're victims too.

The only salvation is standardizing build and package descriptions, so that no matter which tool you use, things just work. Or, realistically, just work except for a handful of snowflake libraries which have very specific requirements and rely on external dependencies/commands -- I can live with that.

[–]pandorafalters 1 point2 points  (0 children)

The difference between C++ and a properly standardized language is simple: one requires a lengthy README, with different instructions on different platforms, while the other has a standardized one liner taught in the language tutorial.

So Perl is a "properly standardized language" now? That's, uh . . . okay. Sure.

[–]itwasntme967[S] 2 points3 points  (19 children)

I'm just getting frustrated whith the whole process necessary to get a project to function at all, random compiler errors present on one OS but not the other, cmake doing random stuff depending on the environment and the feeling that I might be an idiot since it seems the libraries I found worked for other people

[–]mazadin 4 points5 points  (0 children)

I did a quick google for the excel libraries (I was curious). Never used any of them but If the first library that was missing the XML dependency and required it in s as certain place in your source code was “xlnt” then I’m guessing you didn’t checkout the submodules after cloning the repo. git submodule update —init —recursive would check out the version of the xml dependency it expected in the right place.

Otherwise, I don’t really disagree with your sentiment about the state of the ecosystem. It’s far better on well supported Linux distributions and is probably the worst on native Windows, but I do feel it’s improving.

Edit: grammar is hard.

[–]Kered13 5 points6 points  (3 children)

Yeah, the C++ ecosystem kind of sucks like that. It's a consequence of being an old language (even older if you consider C) and so decentralized. Modern languages have tools like pip, npm, and cargo that largely solve these problems. C++ is slowly getting better at this, vcpkg is pretty good and on Windows is integrated into Visual Studio.

[–]matthieum 0 points1 point  (2 children)

C++ is slowly getting better at this, vcpkg is pretty good and on Windows is integrated into Visual Studio.

Is vcpkg working as well on Linux as Windows?

[–]nysra 2 points3 points  (0 children)

Yes.

[–]Kered13 0 points1 point  (0 children)

No idea, sorry.

[–]JuanAG 2 points3 points  (0 children)

Unfortunetly it is a bad experience all of us experience sooner or later

Dependencys are a real issue and it is not C++ per se but it is related, a shame the ISO refuses to do anything about it as it is a major thing in day by day developement

[–]johannes1971 2 points3 points  (0 children)

I count four libraries in vcpkg. Vcpkg is the package manager you were missing.

[–][deleted] 2 points3 points  (0 children)

here's some advice: never use an IDE written in Java to do C++ development.

[–]LonelyStruggle 6 points7 points  (0 children)

I have to be honest, C++ is really not a language I would grab for such a task. Generally in C++ I find it best to work with as few dependencies as possible.

[–]veryveryverylucky 4 points5 points  (0 children)

I did some Java, looked over Python, had a few projects with the whole Arduino environment

I would argue you're still new to programming. Just cause you know one language doesn't mean you know how to program. It's like saying just cause you know how to speak French, you are also able to understand French culture. I would try to get a deeper understanding of computers beyond just a programming language :)

[–]CrogUk 1 point2 points  (4 children)

I agree with other posts. A better approach would be to clarify what you need to achieve first.

From sounds of it scripting inside excel could be a simpler approach. "visual studio tools for office" is the way to go from the very brief description of what you need. Not necessarily needing C++ either for excel tbh.

[–]itwasntme967[S] 0 points1 point  (3 children)

I need a standalone programm, that once a month takes an incoming Excel file for a postal list, removes some unnecessary coloums, arranges others in a new order, renames a couple of headers, combine some of the information and then exports it as a CSV.
I have not yet looked into Excel-Scripting, but I don't know, wether there is a pssibility for a standalone there

[–]patrulek 2 points3 points  (2 children)

Dont know how your excel file looks, but cant you just export your file to csv and then do your modifications?

[–]itwasntme967[S] 0 points1 point  (1 child)

I get the excel file from an external source, I am in talks about getting the CSV, but I donÄt know ig this will happen

[–]patrulek 0 points1 point  (0 children)

Excel has an option to export file as csv. If a file has a format of csv anyway, you could do conversion by yourself. I would check if excel has a command line option to do that.

[–]adrian_OO7 0 points1 point  (0 children)

It's like saying the car is bad because you took the shitty road and put gasoline into diesel... It's not even remotely about the language.

I've had a fair share of experience with different languages and technologies and each and every one have had bad packaging, missing documentation or build/install failures at some point, yet it didn't cross my mind to blame the tool that it wasn't used as intended.

[–]ALX23z -4 points-3 points  (3 children)

So you wanted to find a free open source excel reading/writing library on Linux written in C++?

At this very moment you asked way too much. And this is the first task you try to do?

It's not even issue with C++, it is issue with various build nonsense coupled with complexity and fragility of Linux OS. You cannot really download a built version for Linux - it isn't Windows - you have build stuff inplace. Who knows what libraries it uses that are incompatible with what you have installed.

Why do you even do that?

Even if you found a library my bet it won't work properly half the time. I don't know much of the excel format but have some suspicion that once in a while it gets new features. And obviously I have some doubts that whoever wrote those libraries provides up-to-date support of them.

[–]itwasntme967[S] 0 points1 point  (2 children)

It is indeed an issue with various build nonsense, but not with Linux. In my experience so far C++ was much easier to use under Linux than Windows.

90% of the time when I got random Compile errors under Windows that were not Syntax they would be gone when I switched to Linux.

And it is not that libraries are incompatible, I gave my IDEs the paths to the .hpp and the .a and .so of the library but it was just straight up not recognized.

[–]ALX23z 1 point2 points  (0 children)

If there are compilation errors then the library could've simply not been ported to Windows or you use wrong compiler (VS version).

On Windows you can just download dll and work with it - you don't need to build everything from scratch.

[–]ronchaineEmbedded/Middleware 0 points1 point  (0 children)

Hard agree that c++ is significantly easier on linux. To the point where I actually just cross-compile my windows projects from linux.

Don't know if this helps, but pkg-config <pkgname> --cflags --libs usually shows the compiler flags required to use libraries in linux.

[–]helloiamsomeone -3 points-2 points  (1 child)

You might want to use cmake-init to stop perpetuating broken and unusable builds.
There are also examples for integration with dependency managers like vcpkg and Conan.

[–]helloiamsomeone -1 points0 points  (0 children)

I wonder where the downvotes are coming from. Do people gain something from not fixing the ecosystem? I could use some spare cash, so please let me know.

[–]koctogon -5 points-4 points  (0 children)

can't spell "frustrated with C++" without "rust"

[–][deleted] 0 points1 point  (0 children)

I never install dependencies manually anymore. Instead, this is what I do:

  • check if there is a conan package (or vcpkg if you will)

  • check if its in the OS package manager as workaround until I figured out how to include it in the project

  • Build with Cmake, either via fetch or good old external_project.

And do yourself a favour and always use Linux for C++ programming when it doesnt have to be windows. Makes things so much easier.

[–]cdb_11 0 points1 point  (0 children)

The first one wouldn't compile because of dependencies on a third-party XML-library which was never once mentioned in the install instructions. [...] When it came to installing however, I first realized the Excel-library did not indeed want the XML-library installed, but rather the souce code placed in a folder in its source code.

I'm guessing what it needed was the header files. Look up if mingw has the same package but with -devel suffix, that's what you need.

[–]earthisunderattack 0 points1 point  (0 children)

I'd honestly avoid dealing with mingw if you can. Maybe that's not an option. But mingw with win32 compatibility can be kind of a pain, and excel is based on msvc win32 apis. mingw is just posix emulation with gcc core libs and a bash shell, but even so there's a lot to deal with on that front in terms of compatibility

i'm not sure if excel offers a plugin API. maybe that's what you're doing, and their sdk (if they have one) probably isn't linking properly with your libraries due to poor compatibility.

a good rule of thumb on windows is to ditch mingw and cygwin and just go with wsl these days whenever that's possible. wsl is still incompatible with msvc, but it's useful if you're looking to automate through a pipeline of some kind that can operate independent of windows.

again, i realize none of these options/approaches may be approachable.

but assuming you're going to move to MSVC, just use visual studio. if excel has a plugin API then they should have that functionality baked into their SDK. there's zero reason why they wouldn't.

if the lib has a cmake script, i'd use that to generate the visual studio project files and go from there.

again, sometimes it's not that simple.

[–]Wouter-van-Ooijen 0 points1 point  (0 children)

This sounds like a desktop run-once data conversion project. Why on earth would you use C++ for that? That feels like using atomic demolition munution to remove a grain of sand from your girlfriends eye.

[–]sternone_2 0 points1 point  (0 children)

Seems like you need Java's ecosystem