Hi guys, itz my that projectile game in C which used to be in code snippets sections. Well, as u can see no one was able to compile it and as a consequence it's been thrown out of the snippets :rolleyes:

Well, here is the complete program, no codes -- all compiled --- waiting for u to run it. It was my very first program-- hope u like it. Leave some comments plz.

Dani AI

Generated

This thread documents 's early projectile game (an executable was posted), noting the snippet lives in the C section, and rightly warning about running unknown binaries. The notes below are practical, evergreen guidance for compiling or running small, older C hobby programs on modern systems and for dealing with common portability/security issues.

A modern toolchain usually handles this kind of program. Typical compile commands:

gcc -std=c99 -O2 -Wall -o cannon cannon.c -lm

For older K&R-style sources that rely on implicit declarations the older dialect can be enabled:

gcc -std=gnu89 -O2 -Wall -o cannon cannon.c -lm

The -lm flag links the math library when sin, cos, sqrt, etc., are used. Warnings from -Wall will help identify deprecated or non-portable constructs.

Common roadblocks and fixes: many vintage examples use platform-specific headers (for example conio.h or old BGI graphics.h) that are not available on modern GCC; replace getch()/kbhit() with portable alternatives (getchar() or POSIX termios/ncurses) or port graphics code to SDL2. Implicit-int and K&R function definitions cause errors under strict C99; either modernize the code (add prototypes and explicit return types) or compile with -std=gnu89. If an executable fails to run on modern Windows, it might be a 16-bit/DOS binary—running it under DOSBox can help.

Since raised the safety concern, unknown executables should be scanned and sandboxed first. Public scanning services like VirusTotal (https://www.virustotal.com) and virtual machines (VirtualBox: https://www.virtualbox.org) provide low-risk ways to inspect or run legacy binaries. For compilation questions, exact compiler error messages and the target OS/toolchain are the key diagnostics.

Recommended Answers

All 4 Replies

Asif_NSU, your game was never thrown out of the code snippets section. It's located here: http://www.daniweb.com/code/snippet4.html

The reason you probably didn't spot it on first glance is because it is in the C code snippets section instead of the CPP code snippets section.

Alternatively, you can visit this page to see a listing of all code snippets you ever donated to DaniWeb: http://www.daniweb.com/code/member6421.html

Plz download the program from here instead

im sure your a good guy asif_nsu but you have to take into consideration that not alot of people are goin to take an exe from a forum and just run it. call me paraniod but i know i wouldnt :) but if the source is there i would give it a go :)

edit: well i risked it and downloaded it and it is not a virus ;) the game is pretty basic but since im at work i didnt play it more then a second ;) but good work :)

well, u can get the source code in c code snippets "projectile game in C", since not many people were able to compile it I have submitted the complete program. Thanx for ur comments... yea it's basic cos it was my first.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.