Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

A linking error using SDL (Simple DirectMedia Layer) library

Posted on 2005-03-05
4
Medium Priority
?
757 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
  • 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

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Question has a verified solution.

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

Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

572 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