Sign in to follow this  

Why is nothing being printed on the screen?

Recommended Posts

Ok so I'm working through this book "GAME PROGRAMMING ALL IN ONE, Third Edition," and I keep running into all these stupid compiler errors ( missing msvcr80.dll bullshit ), and once I finally get that taken care printf's aren't working. Here's my code:
#include <stdlib.h>
#include <allegro.h>

int main(void){
	printf("Allegro version = %s\n", allegro_id);
	printf("\nPress any key...\n");
	return 0;

I also tried adding #include <stdio.h> but that didn't help. I'm using VC++ 2005 Express Edition, and I already went to properties and changed my file to compile as C, and saved the source as "main.c" but it don't want to work. And the only thing that is display when I run this is the system("PAUSE") ( "Press any key to continue..." ). What's the deal? [Edited by - Shakedown on May 23, 2007 10:33:36 PM]

Share this post

Link to post
Share on other sites
Original post by dada222
Stdio.h isn't enough; you must include iostream.h to use printf or cout.

#include <iostream.h>


This is wrong on multiple levels.

printf is in stdio.h not iostream.h (in C++ it would be cstudio, but we're using C here so stdio.h is fine)

iostream.h doesn't exist - it's prestandard. The header is "iostream" (Furthermore neither of these headers exists in C which the OP is using)

furthermore if the program runs then there isn't a compile or linking problem, so changing headers almost certainly won't fix anything.

Glancing at allegro briefly suggests that by default it uses some macro weirdness to change main into WinMain. This means that the printf isn't actually going anywhere. You might try adding:


Which should force a console entry point and might fix the problem you're seeing

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this