Ok, this is gonna be a very short post but my question is I can't seem to figure what's wrong with my code when I run g++ through it to compile it. Whenever I add a semicolon after main() I keep getting expected unqualified id '{' token, but whenever I try it without the semicolon I get a ton of errors. Can anyone help me out? the code is here . Please and thanks. :)
Forum Thread: Coding Help
- Hot
- Active
-
Forum Thread: When My Kali Linux Finishes Installing (It Is Ready to Boot), and When I Try to Boot It All I Get Is a Black Screen. 8 Replies
5 days ago -
Forum Thread: HACK ANDROID with KALI USING PORT FORWARDING(portmap.io) 12 Replies
1 wk ago -
Forum Thread: Hydra Syntax Issue Stops After 16 Attempts 2 Replies
1 mo ago -
Forum Thread: Hack Instagram Account Using BruteForce 208 Replies
1 mo ago -
Forum Thread: Metasploit reverse_tcp Handler Problem 47 Replies
2 mo ago -
Forum Thread: How to Train to Be an IT Security Professional (Ethical Hacker) 22 Replies
3 mo ago -
Metasploit Error: Handler Failed to Bind 41 Replies
3 mo ago -
Forum Thread: How to Hack Android Phone Using Same Wifi 21 Replies
3 mo ago -
How to: HACK Android Device with TermuX on Android | Part #1 - Over the Internet [Ultimate Guide] 177 Replies
3 mo ago -
How to: Crack Instagram Passwords Using Instainsane 36 Replies
3 mo ago -
Forum Thread: How to Hack an Android Device Remotely, to Gain Acces to Gmail, Facebook, Twitter and More 5 Replies
3 mo ago -
Forum Thread: How Many Hackers Have Played Watch_Dogs Game Before? 13 Replies
3 mo ago -
Forum Thread: How to Hack an Android Device with Only a Ip Adress 55 Replies
4 mo ago -
How to: Sign the APK File with Embedded Payload (The Ultimate Guide) 10 Replies
4 mo ago -
Forum Thread: How to Run and Install Kali Linux on a Chromebook 18 Replies
5 mo ago -
Forum Thread: How to Find Admin Panel Page of a Website? 13 Replies
6 mo ago -
Forum Thread: can i run kali lenux in windows 10 without reboting my computer 4 Replies
6 mo ago -
Forum Thread: How to Hack School Website 11 Replies
6 mo ago -
Forum Thread: Make a Phishing Page for Harvesting Credentials Yourself 8 Replies
6 mo ago -
Forum Thread: Creating an Completely Undetectable Executable in Under 15 Minutes! 38 Replies
8 mo ago
-
How To: Dox Anyone
-
BT Recon: How to Snoop on Bluetooth Devices Using Kali Linux
-
How To: Run USB Rubber Ducky Scripts on a Super Inexpensive Digispark Board
-
How To: Crack Shadow Hashes After Getting Root on a Linux System
-
How To: Check if Your Wireless Network Adapter Supports Monitor Mode & Packet Injection
-
How To: Make Your Own Bad USB
-
How To: Create a Persistent Back Door in Android Using Kali Linux:
-
How To: Scrape Target Email Addresses with TheHarvester
-
How To: Gain Complete Control of Any Android Phone with the AhMyth RAT
-
How To: Set Up a Wi-Fi Spy Camera with an ESP32-CAM
-
How To: Set Your Wi-Fi Card's TX Power Higher Than 30 dBm
-
How To: Hack Open Hotel, Airplane & Coffee Shop Wi-Fi with MAC Address Spoofing
-
How To: Control Network Traffic with Evil Limiter to Throttle or Kick Off Devices
-
How To: Scan for Vulnerabilities on Any Website Using Nikto
-
How To: Find Identifying Information from a Phone Number Using OSINT Tools
-
Hack Like a Pro: How to Find Directories in Websites Using DirBuster
-
How To: Get Root with Metasploit's Local Exploit Suggester
-
How To: Use Ettercap to Intercept Passwords with ARP Spoofing
-
How to Hack Wi-Fi: Cracking WPA2 Passwords Using the New PMKID Hashcat Attack
-
How To: Hack 5 GHz Wi-Fi Networks with an Alfa Wi-Fi Adapter
5 Responses
Remember, semi colons close statements... You can't end main() before you start it, so don't put a semi colon there. Pay attention to the "ton of errors", working to fix them one by one. For starters, you're missing semi colons on the end of lines: 12, 13, 16, and need to remove the semi colon at the end of line 17. I can see a couple more errors, but start with those and try to follow the error messages you get when you try to compile. Ex: Did you define all your variables? Are there any other misplaced semi colons? Add some indentation inside your braces (and after your for loop) too to make it more readable so you'll have an easier time following the code.
Thank you very much... I'm still new to c++ in general but thank you for the help. :)
Of course. Best way to learn is to do it, and then try to figure out each error one at a time. Once you think you fixed the first error, recompile and see if you get farther. Often times, fixing one error will make several of the subsequent errors vanish (or at least change to more helpful errors) as the compiler can now properly interpret the rest of the code.
Every great coder started where you are now. They're great now only because they didn't give up. Keep at it. You'll get there.
(whoops) Fixed my cin and cout errors. Except fstream is being a pain, does fstream usually causes problems? :/
What I don't understand is how this was compiled, if it was even compiled. What compiler are you using? Did you check any warnings/errors assuming your compiler failed to compile the code? Are you using the appropriate flags to check your code for errors? Did you do any research on any functions or operations? Looked at example code?
Share Your Thoughts