Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9226221
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T04:46:39+00:00 2026-06-18T04:46:39+00:00

I am using C++ with the SDL Cocoa and Foundation framework on my mac

  • 0

I am using C++ with the SDL Cocoa and Foundation framework on my mac os x. I get the following error

Undefined symbols for architecture x86_64:
  "_SDL_main", referenced from:
      -[SDLMain applicationDidFinishLaunching:] in SDLMain.o
ld: symbol(s) not found for architecture x86_64

when I run the following code

#import <Foundation/Foundation.h>
#import <SDL/SDL.h>
#include "SDLMain.h"
int main(int argc, const char * argv[])
{
    SDL_Init(SDL_INIT_EVERYTHING);
    SDL_SetVideoMode(640,480,32,SDL_DOUBLEBUF);
    SDL_Event event;
    bool isRunning = true;
    while(SDL_PollEvent(&event)){
        if(event.type == SDL_QUIT){
            isRunning=false;
        }
    }

    SDL_Quit();
    return 0;
}

I have no idea what is wrong, although it seems that when I go into the SDLMain.m file and comment out this line of code

status = SDL_main (gArgc, gArgv);

the program compiles with no problems. However, it doesn’t work. No window opens like its supposed to. Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T04:46:41+00:00Added an answer on June 18, 2026 at 4:46 am

    I bet your main function signature is incorrect. You use:

    int main(int argc, const char * argv[])
                       ^^^^^
    

    but SDL_main.h wants

    int main(int argc, char *argv[])
    

    Why?

    You see, SDL does something really horrific when compiling: It renames your main function to SDL_main, injecting its own main function which, in turn, calls yours.

    Note that if this doesn’t work, then you may be compiling with wrong flags. To be sure, get the flags by typing:

    $ sdl-config --cflags --libs
    

    For more information, see Simply including SDL header causes linker error

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using SDL tridion 2011 SP1. I want to get the list of
I'm using SDL with FASM, and have code that's minimally like the following: format
I have been using SDL with success to learn OpenGL, however I am following
I'm building a program in C++, using SDL, and am occasionally receiving this error:
I'm making a game in SDL, and I'm using SDL_VideoInfo to get the monitors
I'm following through an SDL tutorial series (written in C++) using Derelict and D.
I'm trying to get SDL setup in Mac OS X lion with Xcode. So
I am using SDL Tridion 2011 SP1. I need small clarification regarding multimedia schema
I'm using Windows and I need the SDL Library to start using SDL with
My situation is Using .NET 3.5 Using SDL.NET Need to make a friendly installer

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.