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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T04:40:23+00:00 2026-05-31T04:40:23+00:00

Following the instructions here , I’ve set up a CMakeLists.txt : Find_Package (SDL REQUIRED)

  • 0

Following the instructions here, I’ve set up a CMakeLists.txt:

Find_Package (SDL REQUIRED)
Find_Package (SDL_image REQUIRED)

link_libraries (
     ${SDL_LIBRARY}
     ${SDLIMAGE_LIBRARY}
     SDLmain
)

When running cmake, I get the following error:

ld: library not found for -lSDLmain
collect2: error: ld returned 1 exit status
make[2]: *** [src/GameOfLife] Error 1

Running g++ by hand gives the same error:

$ g++-4.7 -std=c++0x ../src/*.cpp -lSDLmain          
ld: library not found for -lSDLmain

How do I fix this?

  • 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-31T04:40:24+00:00Added an answer on May 31, 2026 at 4:40 am

    make doesn’t know where to find SDLmain; I need to link to the directory using link_directory in `CMakeLists.txt.


    Running

    $ g++-4.7 -std=c++0x ../src/*.cpp `sdl-config --libs`
    

    works fine, so I’ve clearly got SDL installed correctly. Checking the output of sdl-config --libs:

    $ sdl-config --libs  
    -L/opt/local/lib -lSDLmain -lSDL -Wl,-framework,Cocoa
    

    So the thing that’s not in the CMakeLists.txt is the -L/opt/local/lib. That should be added into the CMakeLists.txt using link_directory:

    link_directories( /opt/local/lib )
    

    And then cmake runs fine.

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

Sidebar

Related Questions

Tried following the instructions here: How to use Google app engine with my own
Anyone out there using the FTUtils library for iPhone development? Following the instructions here
I have installed Google application engine following instructions here: http://code.google.com/appengine/docs/java/gettingstarted/installing.html However, running dev_appserver.cmd script
following the instructions here http://wiki.apache.org/couchdb/ExternalProcesses this is what I get { * error: {{badarg,[{erlang,port_command,
I tried following the instructions here in order to create a static website on
I'm following the instructions here: http://blog.colinajohnston.com/scala-ide-200rc2-sbt-0112-lift-24-m5-now-with to setup eclipse with lift and sbt but
I've tried following the instructions here: http://devcenter.heroku.com/articles/pandastream However, when I open up the heroku
I am building a Httphandler following these instructions here It manipulates HTTP POST and
I just installed NetBeans and the Android SDK following the instructions here . I
I'm trying to test an Android app following the instructions here: http://www.jetbrains.com/idea/webhelp/testing-android-applications.html and here

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.