?
Solved

A linking error using SDL (Simple DirectMedia Layer) library

Posted on 2005-03-05
4
Medium Priority
?
738 Views
Last Modified: 2008-01-09
I am trying to learn some graphics programming using SDL, but have run across a problem when i try to use the SDL_image library. Here are the errors i get:

Linking...
msvcrt.lib(MSVCR71.dll) : error LNK2005: _exit already defined in LIBC.lib(crt0dat.obj)
msvcrt.lib(MSVCR71.dll) : error LNK2005: _strncpy already defined in LIBC.lib(strncpy.obj)
msvcrt.lib(MSVCR71.dll) : error LNK2005: _fprintf already defined in LIBC.lib(fprintf.obj)
msvcrt.lib(MSVCR71.dll) : error LNK2005: _fclose already defined in LIBC.lib(fclose.obj)
msvcrt.lib(MSVCR71.dll) : error LNK2005: __isctype already defined in LIBC.lib(isctype.obj)
LIBC.lib(crt0init.obj) : warning LNK4098: defaultlib 'msvcrt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library
SDLmain.lib(SDL_win32_main.obj) : error LNK2019: unresolved external symbol _SDL_main referenced in function _main
Release/SDL_TEST.exe : fatal error LNK1120: 1 unresolved externals

This happens when i include SDL_image.h, and SDL_image.lib   I have this project set as multithreaded dll (/MD)

I also tried ignoring msvcrt.ib and libc.lib but i dont think it worked...whats going on here???
0
Comment
Question by:Joshjje
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 86

Accepted Solution

by:
jkr earned 800 total points
ID: 13467625
Set your application to use the CRT as a static library, i.e. in your project settings, under "C++|Code Generation", de-select the options that have "DLL" in their name (that means "/MT") to get rid of the conflicts-
0
 

Author Comment

by:Joshjje
ID: 13467822
Odd, for some reason it was set to single-threaded instead of the multithreaded that i had it on....Anyways i put it back to multithreaded dll, but now i still get this error:

SDLmain.lib(SDL_win32_main.obj) : error LNK2019: unresolved external symbol _SDL_main referenced in function _main
Release/SDL_TEST.exe : fatal error LNK1120: 1 unresolved externals
0
 
LVL 86

Expert Comment

by:jkr
ID: 13468901
Hm, I don't know SDL, but could it be that you are supposed to supply a 'SDL_main()'?
0
 

Author Comment

by:Joshjje
ID: 13468949
<< im an idiot....i had int main() instead of int main(int argc, char** argv)   thanks.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question