[Anjuta-list] making SDL available to an Anjuta C++ project
- From: kevinfishburne <kevinfishburne eightvirtues com>
- To: anjuta-list lists sourceforge net
- Subject: [Anjuta-list] making SDL available to an Anjuta C++ project
- Date: Mon, 21 Jul 2008 01:52:54 -0700 (PDT)
I'm new to Anjuta and have just started learning C and C++. I'm using Anjuta
2.4.1 under Ubuntu 8.04 Desktop AMD64, and can build and run "Hello World"
just fine. I can also build and run a sample SDL application, but am not
sure why I have to start the project as a "Generic C" project instead of a
"Generic C++" project. Starting it as a C++ project causes errors like
main.cc:8: undefined reference to 'SDL_Init'. Interestingly when creating a
C project it has the option "Add C++ support".
Is there an explanation of why this is, and what the differences are between
C and C++ projects that affect an SDL application this way? I'm assuming the
differences, whatever they are, are stored in the actual Anjuta project
file, as all the flags, modules, etc. accessible through the GUI seem to be
identical between C and C++ projects. I also couldn't find any include files
in one that weren't in the other. I'm using the Anjuta-supplied sample SDL
code below. Thanks all.
#include "SDL/SDL.h"
const int WINDOW_WIDTH = 640;
const int WINDOW_HEIGHT = 480;
const char* WINDOW_TITLE = "SDL Start";
int main(int argc, char **argv)
{
SDL_Init( SDL_INIT_VIDEO );
SDL_Surface* screen = SDL_SetVideoMode(
WINDOW_WIDTH, WINDOW_HEIGHT, 0,
SDL_HWSURFACE | SDL_DOUBLEBUF );
SDL_WM_SetCaption( WINDOW_TITLE, 0 );
SDL_Event event;
int gameRunning = 1;
while (gameRunning)
{
if (SDL_PollEvent(&event))
{
if (event.type == SDL_QUIT)
{
gameRunning = 0;
}
}
}
SDL_Quit();
return 0;
}
-----
Kevin Fishburne, Eight Virtues
www: http://sales.eightvirtues.com http://sales.eightvirtues.com
e-mail: mailto:sales eightvirtues com sales eightvirtues com
phone: (770) 853-6271
--
View this message in context: http://www.nabble.com/making-SDL-available-to-an-Anjuta-C%2B%2B-project-tp18564578p18564578.html
Sent from the Anjuta - Users mailing list archive at Nabble.com.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]