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 6836571
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:22:17+00:00 2026-05-26T23:22:17+00:00

I’m trying to compile a cmake project on my mac, but it depends on

  • 0

I’m trying to compile a cmake project on my mac, but it depends on the SDL framework. I installed this framework and after cmake then reported to me libSDL was not found I set following export variables myself (as suggested by cmake):

export SDL_INCLUDE_DIR=/Library/Frameworks/SDL.framework/
export SDLIMAGE_LIBRARY=/Library/Frameworks/SDL_image.framework/
export SDLIMAGE_INCLUDE_DIR=/Library/Frameworks/SDL_image.framework/Headers

Now cmake does it job, but when I run make, I get the following message:

Mats-MBP:build mats$ make
Linking CXX executable SDLExample
Undefined symbols for architecture i386:
 "_main", referenced from:
     start in crt1.10.6.o
    (maybe you meant: _SDL_main)
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status
make[2]: *** [src/SDLExample] Error 1
make[1]: *** [src/CMakeFiles/SDLExample.dir/all] Error 2
make: *** [all] Error 2

I get this for both i386 and x86_64. What did I forget?

EDIT: these are the file contents:

Mats-MBP:build mats$ cat ../src/main.cpp 
/**
 * @file main.cpp
 *
 * A simple example-program to help you out with using SDL for 2D graphics.
 *
 * @author przemek
 */

#include <iostream>
#include <stdexcept>
#include <SDL.h>
#include <SDL_image.h>

using namespace std;

int main(int argc, char* argv[]) {
    try {
        // Try to initialize SDL (for video)
        if (SDL_Init(SDL_INIT_VIDEO) != 0) {
            throw runtime_error("Couldn't init SDL video!");
        }
        // Create a double-buffered screen surface:
        SDL_Surface* screen = SDL_SetVideoMode(800, 600, 24, SDL_DOUBLEBUF/* |     SDL_FULLSCREEN*/);
        if (!screen) {
            throw runtime_error("Couldn't set SDL video mode!");
        }

        // Use SDL_image library to load an image:
        SDL_Surface* image = IMG_Load("image.png");
//      SDL_Surface* image = IMG_Load("image.tga");
        if (!image) {
            throw runtime_error(SDL_GetError());
        }

        // "Pump" SDL events like keyboard presses and get the keystate:
        SDL_PumpEvents();
        Uint8* keyState = SDL_GetKeyState(0);

        // loop until user presses escape:
        while (!keyState[SDLK_ESCAPE]) {
            // Display a game background:
        SDL_Rect src, dst;          // Source and destination rectangles
        src.x = 0;
        src.y = 0;
        src.w = image->w;
        src.h = image->h;
        dst.x = 100;
        dst.y = 50;
        dst.w = image->w;
        dst.h = image->h;
        // Copy the image from 'image' to 'screen' surface
        SDL_BlitSurface(image, &src, SDL_GetVideoSurface(), &dst);

        // Flip surfaces (remember: double-buffering!) and clear the back buffer:
        SDL_Flip(screen);
        SDL_FillRect(screen, 0, 0);

        // Get new keyboard state:
        SDL_PumpEvents();
        keyState = SDL_GetKeyState(0);
    }

    // Free the screen surface & quit SDL
    SDL_FreeSurface(screen);
    SDL_Quit();
} catch (runtime_error& e) {
    cout << e.what() << endl;
    SDL_Quit();
}

return 0;
}
  • 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-05-26T23:22:17+00:00Added an answer on May 26, 2026 at 11:22 pm

    I solved it by removing the .framework and unset my export variables to this framework, and I used the source to ./configure, make, make install. I removed all cmake build files and cmade and made my project again and everything was solved.

    (For compiling SDL on OS X Lion you need to ./configure --disable-assembly)

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

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
this is what i have right now Drawing an RSS feed into the php,
I am trying to render a haml file in a javascript response like so:
I have this code to decode numeric html entities to the UTF8 equivalent character.

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.