Not logged inGosu Forums
Forum back to libgosu.org Help Search Register Login
Up Topic Gosu / Gosu Exchange / Error while creating a window
- By ? Date 2009-08-02 14:42
Hi! I'm a newbie in gosu programming, and i'm trying to run a program on it over C++ (i think it's even less than a Hello World :p), but i get an error. I hope you could help me. This is my code:

#include <Gosu/Gosu.hpp>

int main(int argc, char* argv[])
{
    Gosu::Window(640,480,1);
}

I know, it's an stupid game. Anyway, i always get the same error:

X Error of failed request: BadMatch (invalid parameter attributes)
Major opcode of failed request: 1 (X_CreateWindow)
Serial number of failed request: 138
Current serial number in output stream: 139
Press ENTER to continue.

The numbers in lines 3 and 4 change in every execution. I have run this over Ubuntu 9.04, and I used Code::Blocks IDE. Everything is correctly linked and compiled, but I can't avoid this failure in runtime. The error is given when creating the window, all the remaining parts of the code are OK (obviously...)

Thanks in advance for the help!!

(Adrian)
- By Quit Date 2009-08-02 14:56 Edited 2009-08-02 15:05
You have to declare a name for your Gosu::Window-var.

>Gosu::Window win(640, 480, true);


should do the trick.

And you won't see anything, since you don't run it -

>win.show();

- By ? Date 2009-08-03 11:44
#include <Gosu/Gosu.hpp>

int main(int argc, char* argv[])
{
    Gosu::Window win(640,480,0);
    win.show();
}

Thanks for your help, but I still get the same problem.
- By disciplex Date 2009-08-03 12:11
Your main method is also expecting to return an integer.

#include <Gosu/Gosu.hpp>

int main(int argc, char* argv[])
{
    Gosu::Window win(640,480,0);
    win.show();
    return 0;
}
- By ? Date 2009-08-03 15:48
I get the same error again. I have traced the program, and the error is given in the line:

    Gosu::Window win(640,480,0);

, so I think it's a less trivial error. Could it be a trouble with hardware or update packets of other libraries? I'm sorry, I'm new on Gosu and I feel a little lost. Do you recommend me to change into Ruby? Thank you!
- By Maverick Date 2009-08-04 01:36
Can you tell us what the error says?
EDIT:

Can you create a super class from the base Gosu::Window? Follow the tutorials on the wiki to help set up a window.
- By jlnr (dev) Date 2009-08-04 10:23
You don't need a variable name to test if the constructor is working, and you don't need to return anything in main() thanks to a special language rule :)

Does it work in windowed mode, i.e. when passing false instead of 1? If so, does it work in windowed mode when the resolution is the desktop resolution?
- By ? Date 2009-08-04 11:04
Hi there.
I've tried to run the CppTutorial, and I get the same error. Changing resolution or fullscreen mode don't work either. Could I have installed something wrong? Thank you!
- By jlnr (dev) Date 2009-08-04 16:05
I don't have the slightest idea, X11 always leaves me puzzled :( Does it work if you turn off the visual effects under the Appearance settings?
- By ? Date 2009-08-04 19:24
They were already off...
Up Topic Gosu / Gosu Exchange / Error while creating a window

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill