0

I am currently trying to compile and run a file in the terminal using Visual Studio Code as my editor (on a mac). So far I am able to compile the file using "g++ -c bigint.cpp" but not to run it. This may be a stupid question as I am a noob to working with multiple/.hpp files as well as to Visual Studio Code on a mac but I am totally lost.

Below I attached the error message I am getting as well as my code linking in the header file. The .hpp and .cpp file are in the same folder. Is this just a Visual Studio Code issue and if so how do I fix it/should I switch to a new editor? I'm totally stuck on this and just want to get it figured out so I can move on to coding. Screenshot of Error Message

walnut
  • 21,629
  • 4
  • 23
  • 59
codePie
  • 1
  • 1
  • 1
    Does this answer your question? [Using G++ to compile multiple .cpp and .h files](https://stackoverflow.com/questions/3202136/using-g-to-compile-multiple-cpp-and-h-files) – walnut Dec 23 '19 at 20:23
  • Note that `g++` on Mac is probably not really `g++` from GCC, but `clang++` in disguise. Nevertheless the duplicate still applies. – walnut Dec 23 '19 at 20:24
  • I checked out the forum above but was unable to run it even after trying those modifications! – codePie Dec 24 '19 at 00:52
  • Then please provide a [repro] for the problem that you tried to compile, including the full compiler invocation you used and also read https://stackoverflow.com/questions/12573816/what-is-an-undefined-reference-unresolved-external-symbol-error-and-how-do-i-fix – walnut Dec 24 '19 at 07:25
  • Oops thought I added the screenshot earlier. Up above should be a screenshot with the #include tag I'm using and what happens when I try to run a g++ command to compile and link. – codePie Dec 24 '19 at 16:02
  • Please don't post text in images. Copy-paste error messages and code as plain-text into the question instead. See [ask]. Also please provide a [repro] as I mentioned in my previous comment. The error message is telling you that you didn't define a `main` function, which is the entry point for a C++ program. Where is your `main`? Note that, as explained in the previously linked questions, you need to add *all* `.cpp` files to the compiler invocation. – walnut Dec 24 '19 at 22:24

0 Answers0