1

In HTML, you have the ability to use more than one javascript file. So you can make an javascript file with an infinite loop that checks things, and your normal code running at the same time. Im using this for a multyplayer game in js, but I want to make it in c++ too. So how do I achieve this in c++?

I tried this: #include <iostream> #include <fstream> #include "tick_update.cpp"

I tried to execute code in tick_update.cpp, but it didn't work. The int main function was already made, so the program was thinking that they were linked.

  • `So you can make an javascript file with an infinite loop that checks things, and your normal code running at the same time.` No, you can't. – tkausl Feb 09 '23 at 16:32
  • You might use multiple programs, or use thread? – Jarod42 Feb 09 '23 at 16:35
  • 2
    No don't include source files : #include "tick_update.cpp". I think you need to learn some C++ first before doing this. – Pepijn Kramer Feb 09 '23 at 16:36
  • 1
    Good sources to learn cpp from are : [cppreference](https://en.cppreference.com/w/. A [recent C++ book](https://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list) or have a go at https://www.learncpp.com/ (that's pretty decent, and pretty up-to-date). When you've mastered the C++ basics from those sources, look at the [C++ coreguidelines](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines) regularely to keep up-to-date. – Pepijn Kramer Feb 09 '23 at 16:36
  • 3
    Stack Overflow is not really a school, or a tutorial site. You have to know some stuff to be able to ask questions. I don't know how to answer your question, because it seems that you don't know a lot about C++. Whatever I say you will have additional questions to ask. Stack Overflow is not meant to be used in that way. You ask one good question and hope for a good answer. – Dialecticus Feb 09 '23 at 16:38

0 Answers0