2

A question I am currently trying to ask is roughly as follows:

I am trying to develop a C++ static library which can work on multiple platforms (in fact, the whole point of the library is that it works on multiple platforms with the user of the library not having to write any extra code), and as far as I am aware C++ static libraries should be able to work on multiple platforms (.lib on Windows; .a on other platforms). But when I go to create a static library in Visual Studio, the only option that comes up is a "Windows Static Library", which suggests it will only work when compiled for Windows. So, is this true? Will this not work on other platforms? And if so, what should I do instead? Perhaps this is not possible in the first place?

And I am not sure where I should post this question. It is a question about a specific problem I am having, and it does have a definite answer, so it should be on topic for Stack Exchange in general. But I can't seem to find any site which would accept this question (which I would call a "general programming question", as it is not specifically about code, servers, game development, etc. - it doesn't really fall into any category).

I have reviewed the help pages of several Stack Exchange sites, such as:

  • Stack Overflow (can't post here because not about specific code)
  • Software Engineering SE (can't post here because not about "software development methods and practices", and maybe falls under the off-topic category of "support for tools or products")
  • Super User (can't post here because not a specific issue with existing computer software, hardware or networking)

So where should I ask this question?

11
  • 8
    There are already tons of questions related to this on Stack Overflow (e.g. stackoverflow.com/questions/66610262/…)
    – Mat
    May 11 at 17:35
  • 2
  • According to the Help Center a question that is about: "...software tools commonly used by programmers; and is a practical, answerable problem that is unique to software development..." is on-topic at Stack Overflow. "Can Visual Studio create a static library that works across multiple platforms?" seems to apply, though as Mat points out it may have been asked before.
    – BSMP
    May 11 at 18:26
  • @Mat searching "are c++ static libraries windows-only" on both Google and SO did not yield any useful results to me. Also, the question you posted is about .dll files which are, as far as I am aware, related to shared libraries not static libraries. The only answer did not help me at all, because I was asking whether it would be possible to compile to other OSs, not whether code compiled for Windows would work on other OSs.
    – Lecdi
    May 11 at 18:37
  • @BSMP I did not notice this; I always thought Stack Overflow questions had to include source code. But I fear that, although the Help Centre says contrary, this is the kind of question that would get heavily downvoted there, and go unanswered.
    – Lecdi
    May 11 at 18:38
  • @Lecdi: not the place to argue this, but the same issues raised in that answer apply to static and shared libraries alike. C++ libraries aren't even compatible across compilers, or even compilation options.
    – Mat
    May 11 at 18:52
  • @Mat The main thing is that that answer effectively says "you will need to compile for each platform individually", without saying how to do so; whereas I am asking whether it is even possible for me to compile the source code to each platform individually in the first place.
    – Lecdi
    May 11 at 18:59
  • 1
    Then search for "compiling C++ on [your OS] for [your target]".
    – Mat
    May 11 at 19:21
  • 1
    It shouldn't be necessary to ask this question. The answer is very likely among the existing 764,247 C++ questions. It is very hard to imagine someone didn't want to do the exact same thing and asked a question related to it on Stack Overflow. A starting point could be finding questions where the OP has actually tried something, but it didn't work as expected. May 11 at 23:40
  • @This_is_NOT_a_forum as I said above, I have already searched both Google and Stack Overflow, and I have tried several search terms, none of which yielded any useful results. Perhaps I just don't know the proper terminology to be searching?
    – Lecdi
    May 12 at 7:10
  • 1 question, not 4. Re "useful results" Please before considering posting read the manual/reference & google any error message & many clear, concise & precise phrasings of your question/problem/goal, with & without your particular names/strings/numbers, 'site:stackoverflow.com' & tags; read many answers. Reflect research in posts. SO/SE search is poor & literal & sometimes limited to titles, but read the help. Google re googling/searching, including in Q&A at [meta] & Meta Stack Exchange. How much research effort is expected of Stack Overflow users?
    – philipxy
    May 12 at 21:42

0

You must log in to answer this question.

Browse other questions tagged .