c++ - getting an error linking sdl with g++ -


i know lot of people have problems none of solutions have worked im linking sdl heres code:

#include <sdl/sdl.h> #include <iostream>  int main() {     return 0; } 

im using command-line g++ heres command:

g++ main.cpp -o application -wall -ideps/include -ldeps/lib -lsdl2 -lsdl2main 

im in:

c:\users\user\desktop\my_stuff\code\visual_studio_code\c++\graphics 

graphics has:

deps   include     sdl     gl   lib     libs main.cpp 

im getting output using -v:

using built-in specs. collect_gcc=g++ collect_lto_wrapper=c:/mingw/bin/../libexec/gcc/mingw32/4.5.2/lto-    wrapper.exe target: mingw32 configured with: ../../src/gcc-4.5.2/configure --build=mingw32 --enable-    languages=c,c++,ada,fort ran,objc,obj-c++ --enable-threads=win32 --enable-libgomp --enable-lto --      enable-fully-dynamic-string --enable-libstdcxx-debug --enable-version-specific-    runtime-libs --with-    gnu-ld --disable-nls --disable-win32-registry --disable-symvers --disable-werror --    prefix=/mingw32tdm --with-local-pr efix=/mingw32tdm --enable-cxx-flags='-fno-function-sections -fno-data-    sections' --with-pkgversio n=tdm-1 --enable-sjlj-exceptions --with-bugurl=http://tdm-    gcc.tdragon.net/bugs thread model: win32 gcc version 4.5.2 (tdm-1) collect_gcc_options='-v' '-o' 'application.exe' '-wall' '-ideps/include' '-    ldeps/lib' '-mtune=i3 86' '-march=i386' c:/mingw/bin/../libexec/gcc/mingw32/4.5.2/cc1plus.exe -quiet -v -  ideps/include -iprefix c:\ming w\bin\../lib/gcc/mingw32/4.5.2/ main.cpp -quiet -dumpbase main.cpp - mtune=i386 -march=i386 -auxb ase main -wall -version -o c:\users\dad\appdata\local\temp\ccgn7cdz.s gnu c++ (tdm-1) version 4.5.2 (mingw32) compiled gnu c version 4.5.2, gmp version 4.3.2, mpfr version 2.4.2, mpc  version 0.8.2 ggc heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 ignoring nonexistent    directory"c:\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../../mingw32/include" ignoring duplicate directory     "c:/mingw/lib/gcc/../../lib/gcc/mingw32/4.5.2/include/c++" ignoring duplicate directory "c:/mingw/lib/gcc/../../lib/gcc/mingw32/4.5.2/include/c++/mingw32" ignoring duplicate directory "c:/mingw/lib/gcc/../../lib/gcc/mingw32/4.5.2/include/c++/backward"  ignoring duplicate directory "c:/mingw/lib/gcc/../../lib/gcc/mingw32/4.5.2/../../../../include" ignoring duplicate directory "c:/mingw/lib/gcc/../../lib/gcc/mingw32/4.5.2/include" ignoring duplicate directory "c:/mingw/lib/gcc/../../lib/gcc/mingw32/4.5.2/include-fixed" ignoring nonexistent directory "c:/mingw/lib/gcc/../../lib/gcc/mingw32/4.5.2/../../../../mingw32 /include" #include "..." search starts here: #include <...> search starts here: deps/include c:\mingw\bin\../lib/gcc/mingw32/4.5.2/include/c++ c:\mingw\bin\../lib/gcc/mingw32/4.5.2/include/c++/mingw32 c:\mingw\bin\../lib/gcc/mingw32/4.5.2/include/c++/backward c:\mingw\bin\../lib/gcc/mingw32/4.5.2/../../../../include c:\mingw\bin\../lib/gcc/mingw32/4.5.2/include c:\mingw\bin\../lib/gcc/mingw32/4.5.2/include-fixed end of search list. gnu c++ (tdm-1) version 4.5.2 (mingw32) compiled gnu c version 4.5.2, gmp version 4.3.2, mpfr version 2.4.2, mpc    version 0.8.2 ggc heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072 compiler executable checksum: c87e8bfb7b6e930a996a4301ffec06cc collect_gcc_options='-v' '-o' 'application.exe' '-wall' '-ideps/include' '-    ldeps/lib' '-mtune=i3 86' '-march=i386' c:/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../../mingw32/bin/as.exe -o     c:\users\dad\appdata\lo cal\temp\ccqmlcuw.o c:\users\dad\appdata\local\temp\ccgn7cdz.s    compiler_path=c:/mingw/bin/../libexec/gcc/mingw32/4.5.2/;c:/mingw/bin/../libexec    /gcc/;c:/mingw/b in/../lib/gcc/mingw32/4.5.2/../../../../mingw32/bin/   library_path=c:/mingw/bin/../lib/gcc/mingw32/4.5.2/;c:/mingw/bin/../lib/gcc/;c:/        mingw/bin/../lib/gcc/mingw32/4.5.2/../../../../mingw32/lib/;c:/mingw/bin/../lib/    gcc/mingw32/4.5.2/../../../ collect_gcc_options='-v' '-o' 'application.exe' '-wall' '-ideps/include' '-    ldeps/lib' '-mtune=i3 86' '-march=i386' c:/mingw/bin/../libexec/gcc/mingw32/4.5.2/collect2.exe -bdynamic -o      application.exe c:/mingw/bi n/../lib/gcc/mingw32/4.5.2/../../../crt2.o     c:/mingw/bin/../lib/gcc/mingw32/4.5.2/crtbegin.o -lde ps/lib -lc:/mingw/bin/../lib/gcc/mingw32/4.5.2 -lc:/mingw/bin/../lib/gcc -    lc:/mingw/bin/../lib/g cc/mingw32/4.5.2/../../../../mingw32/lib -    lc:/mingw/bin/../lib/gcc/mingw32/4.5.2/../../.. c:\use rs\dad\appdata\local\temp\ccqmlcuw.o -lsdl2 -lsdl2main -bstatic -lstdc++ -    bdynamic -lmingw32 -lg cc -lmoldname -lmingwex -lmsvcrt -luser32 -lkernel32 -ladvapi32 -lshell32 -    lmingw32 -lgcc -lmold name -lmingwex -lmsvcrt c:/mingw/bin/../lib/gcc/mingw32/4.5.2/crtend.o c:/mingw/bin/../lib/gcc/mingw32/4.5.2/../../../libmingw32.a(main.o): in    function `main': c:\mingw\msys\1.0\src\mingwrt/../mingw/main.c:73: undefined reference     `winmain@16' collect2: ld returned 1 exit status 

i'm trying set visual studio code compile c++ right.

also know can use code blocks or visual studio 2015 or else have 2 reasons not to. 1. im sharing computer 4 somtimes 5 other people hard drive filling , visual studio 4gb @ least 2. kinda want know how this

try this:

under visual c++, need link sdl2main.lib. under gcc build environments including dev-c++, need link output of "sdl-config --libs", usually: -lmingw32 -lsdl2main -lsdl2 -mwindows

source: sdl doc


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -