Linker error _SDL_main unresolved in _main_getcmdline [duplicate]
This question already has an answer here:
What is an undefined reference/unresolved external symbol error and how do I fix it?
31 answers
I'm following LazyFoo's tutorial for SDL2. I went through the first ten lessons, and now i'm getting this error (until i compile i don't get any errors from VS).
1>------ Inizio compilazione: Progetto: yetANewSDLProj, Configurazione: Debug Win32 ------
1>SDL2main.lib(SDL_windows_main.obj) : error LNK2019: riferimento al simbolo esterno _SDL_main non risolto nella funzione _main_getcmdline
1>Compilazione progetto "yetANewSDLProj.vcxproj" NON COMPLETATA.
========== Compilazione: 0 completate, 1 non riuscite, 0 aggiornate, 0 ignorate ==========
"Reference to external symbol "_SDL_main" unresolved in the function "_SDL_getcmdline"
It seems to me that the error is not in my code but rather between SDL's files but i can't figure out which file supposedly Visual Studio doesn't find or why.
I created a new empty project, the only code i have (one file, main.cpp) is:
#include <SDL.h>
#include <SDL_image.h>
#include <stdio.h>
#include <iostream>
#include <string>
#include <cmath>
int main(int argc, char* argv)
{
SDL_Init(SDL_INIT_VIDEO);
while(1){}
SDL_Quit();
return 0;
}
The include files are in the path: "C:vs_dev_libinclude"
The DLL/lib files: "C:vs_dev_liblibx86"
Both paths are inserted in "VC++ Directories" (Include Directories / Library Directories).
I also copied all DLLs in both System32 and SysWOW64.
I also tried copying DLLs and .lib file in my project directory.
The headers, dll and lib files are from SDL2, SDL2 image, Mixer and TTF (in all cases development libraries for windows (Visual C++ 32/64-bit).
Linker/Input/Additional Denpendencies look like this:
SDL2.lib
SDL2main.lib
SDL2_image.lib
SDL2_ttf.lib
SDL2_mixer.lib
Linker/System/Subsystem is set to "Console(/SUBSYSTEM:CONSOLE)"
Character set is "Multibyte character set" (translated, not sure how exactly it's spelled in english).
Thanks in advance, if you need any other info let me know.
Googling didn't bring me any luck, i've been stuck with this for the past two days :/
c++ linker-errors sdl-2
marked as duplicate by Matthieu Brucher, genpfault
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 21 '18 at 0:22
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
add a comment |
This question already has an answer here:
What is an undefined reference/unresolved external symbol error and how do I fix it?
31 answers
I'm following LazyFoo's tutorial for SDL2. I went through the first ten lessons, and now i'm getting this error (until i compile i don't get any errors from VS).
1>------ Inizio compilazione: Progetto: yetANewSDLProj, Configurazione: Debug Win32 ------
1>SDL2main.lib(SDL_windows_main.obj) : error LNK2019: riferimento al simbolo esterno _SDL_main non risolto nella funzione _main_getcmdline
1>Compilazione progetto "yetANewSDLProj.vcxproj" NON COMPLETATA.
========== Compilazione: 0 completate, 1 non riuscite, 0 aggiornate, 0 ignorate ==========
"Reference to external symbol "_SDL_main" unresolved in the function "_SDL_getcmdline"
It seems to me that the error is not in my code but rather between SDL's files but i can't figure out which file supposedly Visual Studio doesn't find or why.
I created a new empty project, the only code i have (one file, main.cpp) is:
#include <SDL.h>
#include <SDL_image.h>
#include <stdio.h>
#include <iostream>
#include <string>
#include <cmath>
int main(int argc, char* argv)
{
SDL_Init(SDL_INIT_VIDEO);
while(1){}
SDL_Quit();
return 0;
}
The include files are in the path: "C:vs_dev_libinclude"
The DLL/lib files: "C:vs_dev_liblibx86"
Both paths are inserted in "VC++ Directories" (Include Directories / Library Directories).
I also copied all DLLs in both System32 and SysWOW64.
I also tried copying DLLs and .lib file in my project directory.
The headers, dll and lib files are from SDL2, SDL2 image, Mixer and TTF (in all cases development libraries for windows (Visual C++ 32/64-bit).
Linker/Input/Additional Denpendencies look like this:
SDL2.lib
SDL2main.lib
SDL2_image.lib
SDL2_ttf.lib
SDL2_mixer.lib
Linker/System/Subsystem is set to "Console(/SUBSYSTEM:CONSOLE)"
Character set is "Multibyte character set" (translated, not sure how exactly it's spelled in english).
Thanks in advance, if you need any other info let me know.
Googling didn't bring me any luck, i've been stuck with this for the past two days :/
c++ linker-errors sdl-2
marked as duplicate by Matthieu Brucher, genpfault
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 21 '18 at 0:22
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
Said error may occur if yourmain
declaration is notint main(int, char **)
, but it is in question - are you absolutely sure you have the same code? What are your preprocessor definitions? Can you show your e.g. "command line" from project properties, or even better, build log?
– keltar
Nov 20 '18 at 6:22
add a comment |
This question already has an answer here:
What is an undefined reference/unresolved external symbol error and how do I fix it?
31 answers
I'm following LazyFoo's tutorial for SDL2. I went through the first ten lessons, and now i'm getting this error (until i compile i don't get any errors from VS).
1>------ Inizio compilazione: Progetto: yetANewSDLProj, Configurazione: Debug Win32 ------
1>SDL2main.lib(SDL_windows_main.obj) : error LNK2019: riferimento al simbolo esterno _SDL_main non risolto nella funzione _main_getcmdline
1>Compilazione progetto "yetANewSDLProj.vcxproj" NON COMPLETATA.
========== Compilazione: 0 completate, 1 non riuscite, 0 aggiornate, 0 ignorate ==========
"Reference to external symbol "_SDL_main" unresolved in the function "_SDL_getcmdline"
It seems to me that the error is not in my code but rather between SDL's files but i can't figure out which file supposedly Visual Studio doesn't find or why.
I created a new empty project, the only code i have (one file, main.cpp) is:
#include <SDL.h>
#include <SDL_image.h>
#include <stdio.h>
#include <iostream>
#include <string>
#include <cmath>
int main(int argc, char* argv)
{
SDL_Init(SDL_INIT_VIDEO);
while(1){}
SDL_Quit();
return 0;
}
The include files are in the path: "C:vs_dev_libinclude"
The DLL/lib files: "C:vs_dev_liblibx86"
Both paths are inserted in "VC++ Directories" (Include Directories / Library Directories).
I also copied all DLLs in both System32 and SysWOW64.
I also tried copying DLLs and .lib file in my project directory.
The headers, dll and lib files are from SDL2, SDL2 image, Mixer and TTF (in all cases development libraries for windows (Visual C++ 32/64-bit).
Linker/Input/Additional Denpendencies look like this:
SDL2.lib
SDL2main.lib
SDL2_image.lib
SDL2_ttf.lib
SDL2_mixer.lib
Linker/System/Subsystem is set to "Console(/SUBSYSTEM:CONSOLE)"
Character set is "Multibyte character set" (translated, not sure how exactly it's spelled in english).
Thanks in advance, if you need any other info let me know.
Googling didn't bring me any luck, i've been stuck with this for the past two days :/
c++ linker-errors sdl-2
This question already has an answer here:
What is an undefined reference/unresolved external symbol error and how do I fix it?
31 answers
I'm following LazyFoo's tutorial for SDL2. I went through the first ten lessons, and now i'm getting this error (until i compile i don't get any errors from VS).
1>------ Inizio compilazione: Progetto: yetANewSDLProj, Configurazione: Debug Win32 ------
1>SDL2main.lib(SDL_windows_main.obj) : error LNK2019: riferimento al simbolo esterno _SDL_main non risolto nella funzione _main_getcmdline
1>Compilazione progetto "yetANewSDLProj.vcxproj" NON COMPLETATA.
========== Compilazione: 0 completate, 1 non riuscite, 0 aggiornate, 0 ignorate ==========
"Reference to external symbol "_SDL_main" unresolved in the function "_SDL_getcmdline"
It seems to me that the error is not in my code but rather between SDL's files but i can't figure out which file supposedly Visual Studio doesn't find or why.
I created a new empty project, the only code i have (one file, main.cpp) is:
#include <SDL.h>
#include <SDL_image.h>
#include <stdio.h>
#include <iostream>
#include <string>
#include <cmath>
int main(int argc, char* argv)
{
SDL_Init(SDL_INIT_VIDEO);
while(1){}
SDL_Quit();
return 0;
}
The include files are in the path: "C:vs_dev_libinclude"
The DLL/lib files: "C:vs_dev_liblibx86"
Both paths are inserted in "VC++ Directories" (Include Directories / Library Directories).
I also copied all DLLs in both System32 and SysWOW64.
I also tried copying DLLs and .lib file in my project directory.
The headers, dll and lib files are from SDL2, SDL2 image, Mixer and TTF (in all cases development libraries for windows (Visual C++ 32/64-bit).
Linker/Input/Additional Denpendencies look like this:
SDL2.lib
SDL2main.lib
SDL2_image.lib
SDL2_ttf.lib
SDL2_mixer.lib
Linker/System/Subsystem is set to "Console(/SUBSYSTEM:CONSOLE)"
Character set is "Multibyte character set" (translated, not sure how exactly it's spelled in english).
Thanks in advance, if you need any other info let me know.
Googling didn't bring me any luck, i've been stuck with this for the past two days :/
This question already has an answer here:
What is an undefined reference/unresolved external symbol error and how do I fix it?
31 answers
c++ linker-errors sdl-2
c++ linker-errors sdl-2
edited Nov 19 '18 at 14:38
asked Nov 19 '18 at 14:32
Artoflife
43
43
marked as duplicate by Matthieu Brucher, genpfault
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 21 '18 at 0:22
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
marked as duplicate by Matthieu Brucher, genpfault
StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;
$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');
$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Nov 21 '18 at 0:22
This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
Said error may occur if yourmain
declaration is notint main(int, char **)
, but it is in question - are you absolutely sure you have the same code? What are your preprocessor definitions? Can you show your e.g. "command line" from project properties, or even better, build log?
– keltar
Nov 20 '18 at 6:22
add a comment |
Said error may occur if yourmain
declaration is notint main(int, char **)
, but it is in question - are you absolutely sure you have the same code? What are your preprocessor definitions? Can you show your e.g. "command line" from project properties, or even better, build log?
– keltar
Nov 20 '18 at 6:22
Said error may occur if your
main
declaration is not int main(int, char **)
, but it is in question - are you absolutely sure you have the same code? What are your preprocessor definitions? Can you show your e.g. "command line" from project properties, or even better, build log?– keltar
Nov 20 '18 at 6:22
Said error may occur if your
main
declaration is not int main(int, char **)
, but it is in question - are you absolutely sure you have the same code? What are your preprocessor definitions? Can you show your e.g. "command line" from project properties, or even better, build log?– keltar
Nov 20 '18 at 6:22
add a comment |
1 Answer
1
active
oldest
votes
Try defining #define SDL_MAIN_HANDLED
prior to including sdl headers if you are going to manually provide an entry point.
#define SDL_MAIN_HANDLED
#include "SDL.h"
int main(int argc, char *argv)
{
SDL_SetMainReady();
SDL_Init(SDL_INIT_VIDEO);
...
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Try defining #define SDL_MAIN_HANDLED
prior to including sdl headers if you are going to manually provide an entry point.
#define SDL_MAIN_HANDLED
#include "SDL.h"
int main(int argc, char *argv)
{
SDL_SetMainReady();
SDL_Init(SDL_INIT_VIDEO);
...
add a comment |
Try defining #define SDL_MAIN_HANDLED
prior to including sdl headers if you are going to manually provide an entry point.
#define SDL_MAIN_HANDLED
#include "SDL.h"
int main(int argc, char *argv)
{
SDL_SetMainReady();
SDL_Init(SDL_INIT_VIDEO);
...
add a comment |
Try defining #define SDL_MAIN_HANDLED
prior to including sdl headers if you are going to manually provide an entry point.
#define SDL_MAIN_HANDLED
#include "SDL.h"
int main(int argc, char *argv)
{
SDL_SetMainReady();
SDL_Init(SDL_INIT_VIDEO);
...
Try defining #define SDL_MAIN_HANDLED
prior to including sdl headers if you are going to manually provide an entry point.
#define SDL_MAIN_HANDLED
#include "SDL.h"
int main(int argc, char *argv)
{
SDL_SetMainReady();
SDL_Init(SDL_INIT_VIDEO);
...
answered Nov 19 '18 at 14:44


VTT
23.8k42345
23.8k42345
add a comment |
add a comment |
Said error may occur if your
main
declaration is notint main(int, char **)
, but it is in question - are you absolutely sure you have the same code? What are your preprocessor definitions? Can you show your e.g. "command line" from project properties, or even better, build log?– keltar
Nov 20 '18 at 6:22