[Solved, kinda] Could compile for first few lessons, but not now

Hi all. Super new to coding and having a blast with the basics here. I got through the introductory lessons just fine and was able to compile my “hello world” program. I took a break and the next day whenever I came back I couldn’t compile anymore. It happened when I started the axe game lessons. I checked and all my other programs are giving this same error. In way of troubleshooting, I’ve kind of been browsing the forum because I’m not entire sure what to do. The syntax errors are a bit easier to understand haha. Also, sorry if I have the wrong tag on this, I can move it. Just let me know.

So it seems that having 2 files running int main() is a no go? I got rid of one and it let me compile. I was able to run the debug after. Im guessing per project you can only have one main function, but I think thats wrong because the instructor still has both programs? Still would like to know how to get this functioning 100%, But solved enough to work for now! Onward we go!

Hi and welcome to the community.

You’re right in discovering that each C++ file in a single project can’t have a main() function. main is the entry fuction for all C++ programs so if you have multiple cpp files, it would normally indicate the other cpp files are functions or classes and only one will contain main.

I hope this helps

It can only have one definition of any given function. example

IIRC they’re in two different folders.to serve as different projects. He started fresh with Axe Game if memory serves.

Ahhh this clears it up. I think im tracking on the multiple files now. Thank you. Here from a modeling background looking to expand the horizon. Really enjoying the breakdown of concepts in this class so far. Thanks for the warm welcome!

I probably just missed the second folder/second project part. Thanks for the explanation!

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms