MinGW "undefined reference" error (c++)

Started by
5 comments, last by monid233 14 years, 1 month ago
While attempting to compile some source code in MinGW, I got these errors: C:\Users\BEST_A~1\AppData\Local\Temp/ccDW02zH.o:ECleanup.cpp:(.text+0xfe): multi ple definition of `clean_up()' C:\Users\BEST_A~1\AppData\Local\Temp/ccfrrEBj.o:cleanup.cpp:(.text+0xfe): first defined here /mingw/lib/libSDLmain.a(SDL_win32_main.o): In function `redirect_output': /Users/hercules/trunk/SDL-1.2/./src/main/win32/SDL_win32_main.c:219: undefined r eference to `SDL_strlcpy' /Users/hercules/trunk/SDL-1.2/./src/main/win32/SDL_win32_main.c:220: undefined r eference to `SDL_strlcat' /Users/hercules/trunk/SDL-1.2/./src/main/win32/SDL_win32_main.c:243: undefined r eference to `SDL_strlcpy' /Users/hercules/trunk/SDL-1.2/./src/main/win32/SDL_win32_main.c:244: undefined r eference to `SDL_strlcat' /mingw/lib/libSDLmain.a(SDL_win32_main.o): In function `console_main': /Users/hercules/trunk/SDL-1.2/./src/main/win32/SDL_win32_main.c:296: undefined r eference to `SDL_strlcpy' /Users/hercules/trunk/SDL-1.2/./src/main/win32/SDL_win32_main.c:300: undefined r eference to `SDL_Init' /Users/hercules/trunk/SDL-1.2/./src/main/win32/SDL_win32_main.c:301: undefined r eference to `SDL_GetError' /Users/hercules/trunk/SDL-1.2/./src/main/win32/SDL_win32_main.c:312: undefined r eference to `SDL_SetModuleHandle' /mingw/lib/libSDLmain.a(SDL_win32_main.o): In function `WinMain': /Users/hercules/trunk/SDL-1.2/./src/main/win32/SDL_win32_main.c:354: undefined r eference to `SDL_getenv' /Users/hercules/trunk/SDL-1.2/./src/main/win32/SDL_win32_main.c:386: undefined r eference to `SDL_strlcpy' /mingw/lib/libSDLmain.a(SDL_win32_main.o): In function `cleanup': /Users/hercules/trunk/SDL-1.2/./src/main/win32/SDL_win32_main.c:158: undefined r eference to `SDL_Quit' C:\Users\BEST_A~1\AppData\Local\Temp/ccTxgmVT.o:main.cpp:(.text+0x172): undefine d reference to `SCREEN_BPP' C:\Users\BEST_A~1\AppData\Local\Temp/ccTxgmVT.o:main.cpp:(.text+0x17b): undefine d reference to `SCREEN_HEIGHT' C:\Users\BEST_A~1\AppData\Local\Temp/ccTxgmVT.o:main.cpp:(.text+0x184): undefine d reference to `SCREEN_WIDTH' C:\Users\BEST_A~1\AppData\Local\Temp/ccTxgmVT.o:main.cpp:(.text+0x25a): undefine d reference to `GameState' C:\Users\BEST_A~1\AppData\Local\Temp/ccTxgmVT.o:main.cpp:(.text+0x321): undefine d reference to `gameover' C:\Users\BEST_A~1\AppData\Local\Temp/ccTxgmVT.o:main.cpp:(.text+0x32b): undefine d reference to `fps' C:\Users\BEST_A~1\AppData\Local\Temp/ccTxgmVT.o:main.cpp:(.text+0x343): undefine d reference to `fps' C:\Users\BEST_A~1\AppData\Local\Temp/ccTxgmVT.o:main.cpp:(.text+0x35a): undefine d reference to `FPS' C:\Users\BEST_A~1\AppData\Local\Temp/ccTxgmVT.o:main.cpp:(.text+0x379): undefine d reference to `FPS' C:\Users\BEST_A~1\AppData\Local\Temp/ccTxgmVT.o:main.cpp:(.text+0x386): undefine d reference to `fps' C:\Users\BEST_A~1\AppData\Local\Temp/ccTxgmVT.o:main.cpp:(.text+0x39d): undefine d reference to `SDL_Delay' C:\Users\BEST_A~1\AppData\Local\Temp/ccfrrEBj.o:cleanup.cpp:(.text+0x124): undef ined reference to `SDL_FreeSurface' C:\Users\BEST_A~1\AppData\Local\Temp/ccfrrEBj.o:cleanup.cpp:(.text+0x129): undef ined reference to `_imp__Py_Finalize' C:\Users\BEST_A~1\AppData\Local\Temp/ccfrrEBj.o:cleanup.cpp:(.text+0x130): undef ined reference to `SDL_Quit' C:\Users\BEST_A~1\AppData\Local\Temp/ccCsIffw.o:EbClassUnit.cpp:(.text+0x1a8): u ndefined reference to `keystates' C:\Users\BEST_A~1\AppData\Local\Temp/ccCsIffw.o:EbClassUnit.cpp:(.text+0x223): u ndefined reference to `keystates' C:\Users\BEST_A~1\AppData\Local\Temp/ccCsIffw.o:EbClassUnit.cpp:(.text+0x29e): u ndefined reference to `keystates' C:\Users\BEST_A~1\AppData\Local\Temp/ccCsIffw.o:EbClassUnit.cpp:(.text+0x31b): u ndefined reference to `keystates' C:\Users\BEST_A~1\AppData\Local\Temp/ccCsIffw.o:EbClassUnit.cpp:(.text+0x519): u ndefined reference to `event_struct' C:\Users\BEST_A~1\AppData\Local\Temp/ccCsIffw.o:EbClassUnit.cpp:(.text+0x52b): u ndefined reference to `event_struct' C:\Users\BEST_A~1\AppData\Local\Temp/ccCsIffw.o:EbClassUnit.cpp:(.text+0x541): u ndefined reference to `event_struct' C:\Users\BEST_A~1\AppData\Local\Temp/ccCsIffw.o:EbClassUnit.cpp:(.text+0x550): u ndefined reference to `event_struct' C:\Users\BEST_A~1\AppData\Local\Temp/ccCsIffw.o:EbClassUnit.cpp:(.text$_ZN10bCla ssUnit11draw_spriteEv[bClassUnit::draw_sprite()]+0x23): undefined reference to ` PCamera' C:\Users\BEST_A~1\AppData\Local\Temp/ccCsIffw.o:EbClassUnit.cpp:(.text$_ZN10bCla ssUnit11draw_spriteEv[bClassUnit::draw_sprite()]+0x3e): undefined reference to ` PCamera' C:\Users\BEST_A~1\AppData\Local\Temp/ccCsIffw.o:EbClassUnit.cpp:(.text$_ZN10bCla ssUnit11draw_spriteEv[bClassUnit::draw_sprite()]+0x43): undefined reference to ` SCREEN_WIDTH' C:\Users\BEST_A~1\AppData\Local\Temp/ccCsIffw.o:EbClassUnit.cpp:(.text$_ZN10bCla ssUnit11draw_spriteEv[bClassUnit::draw_sprite()]+0x6d): undefined reference to ` PCamera' C:\Users\BEST_A~1\AppData\Local\Temp/ccCsIffw.o:EbClassUnit.cpp:(.text$_ZN10bCla ssUnit11draw_spriteEv[bClassUnit::draw_sprite()]+0x85): undefined reference to ` PCamera' C:\Users\BEST_A~1\AppData\Local\Temp/ccCsIffw.o:EbClassUnit.cpp:(.text$_ZN10bCla ssUnit11draw_spriteEv[bClassUnit::draw_sprite()]+0x8a): undefined reference to ` SCREEN_HEIGHT' C:\Users\BEST_A~1\AppData\Local\Temp/ccCsIffw.o:EbClassUnit.cpp:(.text$_ZN10bCla ssUnit11draw_spriteEv[bClassUnit::draw_sprite()]+0x96): undefined reference to ` screen' C:\Users\BEST_A~1\AppData\Local\Temp/ccCsIffw.o:EbClassUnit.cpp:(.text$_ZN10bCla ssUnit11draw_spriteEv[bClassUnit::draw_sprite()]+0xac): undefined reference to ` PCamera' C:\Users\BEST_A~1\AppData\Local\Temp/ccCsIffw.o:EbClassUnit.cpp:(.text$_ZN10bCla ssUnit11draw_spriteEv[bClassUnit::draw_sprite()]+0xc0): undefined reference to ` PCamera' C:\Users\BEST_A~1\AppData\Local\Temp/ccLgiESa.o:ECamera.cpp:(.text+0x192): undef ined reference to `SCREEN_WIDTH' C:\Users\BEST_A~1\AppData\Local\Temp/ccLgiESa.o:ECamera.cpp:(.text+0x1b1): undef ined reference to `SCREEN_WIDTH' C:\Users\BEST_A~1\AppData\Local\Temp/ccDW02zH.o:ECleanup.cpp:(.text+0x119): unde fined reference to `SDL_Quit' C:\Users\BEST_A~1\AppData\Local\Temp/cchC6NNC.o:EDraw.cpp:(.text+0x12f): undefin ed reference to `SDL_UpperBlit' C:\Users\BEST_A~1\AppData\Local\Temp/cchC6NNC.o:EDraw.cpp:(.text+0x167): undefin ed reference to `SDL_UpperBlit' C:\Users\BEST_A~1\AppData\Local\Temp/ccgo4x8S.o:EFPS.cpp:(.text+0x163): undefine d reference to `SDL_GetTicks' C:\Users\BEST_A~1\AppData\Local\Temp/ccgo4x8S.o:EFPS.cpp:(.text+0x1ab): undefine d reference to `SDL_GetTicks' C:\Users\BEST_A~1\AppData\Local\Temp/ccgo4x8S.o:EFPS.cpp:(.text+0x1e0): undefine d reference to `SDL_GetTicks' C:\Users\BEST_A~1\AppData\Local\Temp/ccgo4x8S.o:EFPS.cpp:(.text+0x22a): undefine d reference to `SDL_GetTicks' C:\Users\BEST_A~1\AppData\Local\Temp/cchHKU1C.o:ELoad_Image.cpp:(.text+0x16e): u ndefined reference to `IMG_Load' C:\Users\BEST_A~1\AppData\Local\Temp/cchHKU1C.o:ELoad_Image.cpp:(.text+0x182): u ndefined reference to `SDL_DisplayFormat' C:\Users\BEST_A~1\AppData\Local\Temp/cchHKU1C.o:ELoad_Image.cpp:(.text+0x190): u ndefined reference to `SDL_FreeSurface' C:\Users\BEST_A~1\AppData\Local\Temp/cchHKU1C.o:ELoad_Image.cpp:(.text+0x358): u ndefined reference to `IMG_Load' C:\Users\BEST_A~1\AppData\Local\Temp/cchHKU1C.o:ELoad_Image.cpp:(.text+0x370): u ndefined reference to `SDL_DisplayFormat' C:\Users\BEST_A~1\AppData\Local\Temp/cchHKU1C.o:ELoad_Image.cpp:(.text+0x37e): u ndefined reference to `SDL_FreeSurface' C:\Users\BEST_A~1\AppData\Local\Temp/cchHKU1C.o:ELoad_Image.cpp:(.text+0x3aa): u ndefined reference to `SDL_MapRGB' C:\Users\BEST_A~1\AppData\Local\Temp/cchHKU1C.o:ELoad_Image.cpp:(.text+0x3c7): u ndefined reference to `SDL_SetColorKey' C:\Users\BEST_A~1\AppData\Local\Temp/cchHKU1C.o:ELoad_Image.cpp:(.text+0x594): u ndefined reference to `IMG_Load' C:\Users\BEST_A~1\AppData\Local\Temp/cchHKU1C.o:ELoad_Image.cpp:(.text+0x5a8): u ndefined reference to `SDL_DisplayFormat' C:\Users\BEST_A~1\AppData\Local\Temp/cchHKU1C.o:ELoad_Image.cpp:(.text+0x5b6): u ndefined reference to `SDL_FreeSurface' C:\Users\BEST_A~1\AppData\Local\Temp/ccXKUq8C.o:EPython.cpp:(.text+0x11f): undef ined reference to `_imp__PyString_FromString' C:\Users\BEST_A~1\AppData\Local\Temp/ccXKUq8C.o:EPython.cpp:(.text+0x12f): undef ined reference to `_imp__PyImport_Import' C:\Users\BEST_A~1\AppData\Local\Temp/ccXKUq8C.o:EPython.cpp:(.text+0x13f): undef ined reference to `_imp__PyModule_GetDict' C:\Users\BEST_A~1\AppData\Local\Temp/ccXKUq8C.o:EPython.cpp:(.text+0x156): undef ined reference to `_imp__PyDict_GetItemString' C:\Users\BEST_A~1\AppData\Local\Temp/ccXKUq8C.o:EPython.cpp:(.text+0x166): undef ined reference to `_imp__PyCallable_Check' C:\Users\BEST_A~1\AppData\Local\Temp/ccXKUq8C.o:EPython.cpp:(.text+0x17f): undef ined reference to `_imp__PyObject_CallObject' C:\Users\BEST_A~1\AppData\Local\Temp/ccXKUq8C.o:EPython.cpp:(.text+0x188): undef ined reference to `_imp__PyErr_Print' C:\Users\BEST_A~1\AppData\Local\Temp/ccXKUq8C.o:EPython.cpp:(.text+0x1c9): undef ined reference to `_imp__Py_Finalize' C:\Users\BEST_A~1\AppData\Local\Temp/cc3Zfhm7.o:EStartup.cpp:(.text+0x12c): unde fined reference to `SDL_Init' C:\Users\BEST_A~1\AppData\Local\Temp/cc3Zfhm7.o:EStartup.cpp:(.text+0x156): unde fined reference to `TTF_Init' C:\Users\BEST_A~1\AppData\Local\Temp/cc3Zfhm7.o:EStartup.cpp:(.text+0x1a5): unde fined reference to `SDL_SetVideoMode' C:\Users\BEST_A~1\AppData\Local\Temp/cc3Zfhm7.o:EStartup.cpp:(.text+0x1aa): unde fined reference to `screen' C:\Users\BEST_A~1\AppData\Local\Temp/cc3Zfhm7.o:EStartup.cpp:(.text+0x1e1): unde fined reference to `SDL_SetVideoMode' C:\Users\BEST_A~1\AppData\Local\Temp/cc3Zfhm7.o:EStartup.cpp:(.text+0x1e6): unde fined reference to `screen' C:\Users\BEST_A~1\AppData\Local\Temp/cc3Zfhm7.o:EStartup.cpp:(.text+0x200): unde fined reference to `screen' C:\Users\BEST_A~1\AppData\Local\Temp/cc3Zfhm7.o:EStartup.cpp:(.text+0x23b): unde fined reference to `SDL_WM_SetCaption' C:\Users\BEST_A~1\AppData\Local\Temp/cc3Zfhm7.o:EStartup.cpp:(.text+0x287): unde fined reference to `_imp__Py_Initialize' C:\Users\BEST_A~1\AppData\Local\Temp/ccmnLKsf.o:toolshed.cpp:(.text+0x188): unde fined reference to `keystates' C:\Users\BEST_A~1\AppData\Local\Temp/ccmnLKsf.o:toolshed.cpp:(.text+0x1e1): unde fined reference to `keystates' C:\Users\BEST_A~1\AppData\Local\Temp/ccmnLKsf.o:toolshed.cpp:(.text+0x23a): unde fined reference to `keystates' C:\Users\BEST_A~1\AppData\Local\Temp/ccmnLKsf.o:toolshed.cpp:(.text+0x293): unde fined reference to `keystates' C:\Users\BEST_A~1\AppData\Local\Temp/ccmnLKsf.o:toolshed.cpp:(.text+0x491): unde fined reference to `event_struct' C:\Users\BEST_A~1\AppData\Local\Temp/ccmnLKsf.o:toolshed.cpp:(.text+0x4a0): unde fined reference to `event_struct' C:\Users\BEST_A~1\AppData\Local\Temp/ccmnLKsf.o:toolshed.cpp:(.text+0x4b7): unde fined reference to `event_struct' C:\Users\BEST_A~1\AppData\Local\Temp/ccmnLKsf.o:toolshed.cpp:(.text+0x4c6): unde fined reference to `event_struct' C:\Users\BEST_A~1\AppData\Local\Temp/ccmnLKsf.o:toolshed.cpp:(.text$_ZN8toolshed 11draw_spriteEv[toolshed::draw_sprite()]+0x23): undefined reference to `PCamera' C:\Users\BEST_A~1\AppData\Local\Temp/ccmnLKsf.o:toolshed.cpp:(.text$_ZN8toolshed 11draw_spriteEv[toolshed::draw_sprite()]+0x3e): undefined reference to `PCamera' C:\Users\BEST_A~1\AppData\Local\Temp/ccmnLKsf.o:toolshed.cpp:(.text$_ZN8toolshed 11draw_spriteEv[toolshed::draw_sprite()]+0x43): undefined reference to `SCREEN_W IDTH' C:\Users\BEST_A~1\AppData\Local\Temp/ccmnLKsf.o:toolshed.cpp:(.text$_ZN8toolshed 11draw_spriteEv[toolshed::draw_sprite()]+0x6d): undefined reference to `PCamera' C:\Users\BEST_A~1\AppData\Local\Temp/ccmnLKsf.o:toolshed.cpp:(.text$_ZN8toolshed 11draw_spriteEv[toolshed::draw_sprite()]+0x85): undefined reference to `PCamera' C:\Users\BEST_A~1\AppData\Local\Temp/ccmnLKsf.o:toolshed.cpp:(.text$_ZN8toolshed 11draw_spriteEv[toolshed::draw_sprite()]+0x8a): undefined reference to `SCREEN_H EIGHT' C:\Users\BEST_A~1\AppData\Local\Temp/ccmnLKsf.o:toolshed.cpp:(.text$_ZN8toolshed 11draw_spriteEv[toolshed::draw_sprite()]+0x96): undefined reference to `screen' C:\Users\BEST_A~1\AppData\Local\Temp/ccmnLKsf.o:toolshed.cpp:(.text$_ZN8toolshed 11draw_spriteEv[toolshed::draw_sprite()]+0xac): undefined reference to `PCamera' C:\Users\BEST_A~1\AppData\Local\Temp/ccmnLKsf.o:toolshed.cpp:(.text$_ZN8toolshed 11draw_spriteEv[toolshed::draw_sprite()]+0xc0): undefined reference to `PCamera' C:\Users\BEST_A~1\AppData\Local\Temp/cc7eMZWT.o:update.cpp:(.text+0x11e): undefi ned reference to `screen' C:\Users\BEST_A~1\AppData\Local\Temp/cc7eMZWT.o:update.cpp:(.text+0x129): undefi ned reference to `SDL_MapRGB' C:\Users\BEST_A~1\AppData\Local\Temp/cc7eMZWT.o:update.cpp:(.text+0x132): undefi ned reference to `screen' C:\Users\BEST_A~1\AppData\Local\Temp/cc7eMZWT.o:update.cpp:(.text+0x13e): undefi ned reference to `screen' C:\Users\BEST_A~1\AppData\Local\Temp/cc7eMZWT.o:update.cpp:(.text+0x146): undefi ned reference to `SDL_FillRect' C:\Users\BEST_A~1\AppData\Local\Temp/cc7eMZWT.o:update.cpp:(.text+0x14d): undefi ned reference to `event_struct' C:\Users\BEST_A~1\AppData\Local\Temp/cc7eMZWT.o:update.cpp:(.text+0x152): undefi ned reference to `SDL_PollEvent' C:\Users\BEST_A~1\AppData\Local\Temp/cc7eMZWT.o:update.cpp:(.text+0x15c): undefi ned reference to `event_struct' C:\Users\BEST_A~1\AppData\Local\Temp/cc7eMZWT.o:update.cpp:(.text+0x165): undefi ned reference to `gameover' C:\Users\BEST_A~1\AppData\Local\Temp/cc7eMZWT.o:update.cpp:(.text+0x16c): undefi ned reference to `GameState' C:\Users\BEST_A~1\AppData\Local\Temp/cc7eMZWT.o:update.cpp:(.text+0x175): undefi ned reference to `event_struct' C:\Users\BEST_A~1\AppData\Local\Temp/cc7eMZWT.o:update.cpp:(.text+0x17e): undefi ned reference to `event_struct' C:\Users\BEST_A~1\AppData\Local\Temp/cc7eMZWT.o:update.cpp:(.text+0x195): undefi ned reference to `keystates' C:\Users\BEST_A~1\AppData\Local\Temp/cc7eMZWT.o:update.cpp:(.text+0x1a3): undefi ned reference to `gameover' C:\Users\BEST_A~1\AppData\Local\Temp/cc7eMZWT.o:update.cpp:(.text+0x1aa): undefi ned reference to `GameState' C:\Users\BEST_A~1\AppData\Local\Temp/cc7eMZWT.o:update.cpp:(.text+0x1c3): undefi ned reference to `keystates' C:\Users\BEST_A~1\AppData\Local\Temp/cc7eMZWT.o:update.cpp:(.text+0x1d0): undefi ned reference to `PCamera' C:\Users\BEST_A~1\AppData\Local\Temp/cc7eMZWT.o:update.cpp:(.text+0x1df): undefi ned reference to `PCamera' C:\Users\BEST_A~1\AppData\Local\Temp/cc7eMZWT.o:update.cpp:(.text+0x1f5): undefi ned reference to `PCamera' C:\Users\BEST_A~1\AppData\Local\Temp/cc7eMZWT.o:update.cpp:(.text+0x202): undefi ned reference to `PCamera' C:\Users\BEST_A~1\AppData\Local\Temp/cc7eMZWT.o:update.cpp:(.text+0x241): undefi ned reference to `keystates' C:\Users\BEST_A~1\AppData\Local\Temp/cc7eMZWT.o:update.cpp:(.text+0x24e): undefi ned reference to `PCamera' C:\Users\BEST_A~1\AppData\Local\Temp/cc7eMZWT.o:update.cpp:(.text+0x25d): undefi ned reference to `PCamera' C:\Users\BEST_A~1\AppData\Local\Temp/cc7eMZWT.o:update.cpp:(.text+0x273): undefi ned reference to `PCamera' C:\Users\BEST_A~1\AppData\Local\Temp/cc7eMZWT.o:update.cpp:(.text+0x280): undefi ned reference to `PCamera' C:\Users\BEST_A~1\AppData\Local\Temp/cc7eMZWT.o:update.cpp:(.text+0x2bf): undefi ned reference to `keystates' C:\Users\BEST_A~1\AppData\Local\Temp/cc7eMZWT.o:update.cpp:(.text+0x2cc): undefi ned reference to `PCamera' C:\Users\BEST_A~1\AppData\Local\Temp/cc7eMZWT.o:update.cpp:(.text+0x2dc): undefi ned reference to `PCamera' C:\Users\BEST_A~1\AppData\Local\Temp/cc7eMZWT.o:update.cpp:(.text+0x2f1): undefi ned reference to `PCamera' C:\Users\BEST_A~1\AppData\Local\Temp/cc7eMZWT.o:update.cpp:(.text+0x2fe): undefi ned reference to `PCamera' C:\Users\BEST_A~1\AppData\Local\Temp/cc7eMZWT.o:update.cpp:(.text+0x33d): undefi ned reference to `keystates' C:\Users\BEST_A~1\AppData\Local\Temp/cc7eMZWT.o:update.cpp:(.text+0x34a): undefi ned reference to `PCamera' C:\Users\BEST_A~1\AppData\Local\Temp/cc7eMZWT.o:update.cpp:(.text+0x35a): undefi ned reference to `PCamera' C:\Users\BEST_A~1\AppData\Local\Temp/cc7eMZWT.o:update.cpp:(.text+0x36f): undefi ned reference to `PCamera' C:\Users\BEST_A~1\AppData\Local\Temp/cc7eMZWT.o:update.cpp:(.text+0x37c): undefi ned reference to `PCamera' C:\Users\BEST_A~1\AppData\Local\Temp/cc7eMZWT.o:update.cpp:(.text+0x3bb): undefi ned reference to `keystates' C:\Users\BEST_A~1\AppData\Local\Temp/cc7eMZWT.o:update.cpp:(.text+0x3e5): undefi ned reference to `screen' C:\Users\BEST_A~1\AppData\Local\Temp/cc7eMZWT.o:update.cpp:(.text+0x3ed): undefi ned reference to `SDL_Flip' collect2: ld returned 1 exit status Yes, a mouthful. 1) I am able to compile regular console programs. 2) I am able to compile sdl programs. 3) This error occurred when I tried to compile one of my games. 4) The errors do differ from each other slightly. 5) Yes, I did do a lot of searching, but was not able to solve the problem Here is the command line I used (Sorry if it is something very obvious that's causing this error, I haven't been using MinGW for long): g++ -Lc:\Python26\libs -lmingw32 -lSDL -lSDLmain -lSDL_image -lSDL_ffmpeg main.cpp button.cpp cleanup.cpp EbClassUnit.cpp ECamera.cpp ECFGParse.cpp ECleanup.cpp EDraw.cpp EFPS.cpp ELoad_Image.cpp EPython.cpp EStartup.cpp sprites.cpp toolshed.cpp update.cpp -o ORR.exe
Advertisement
I don't know if this is the source of your problem, but I read somewhere that the extra SDL libraries need to be linked between SDLmain and SDL. So, in your linking, put SDLmain, all your other SDL libraries (SDL_image, etc.), and then SDL. See if things improve.
Amateurs practice until they do it right.Professionals practice until they never do it wrong.
I'm afraid I still get the same exact errors.

Yes, I am sure I installed all the libraries properly.
Otherwise I would have tested that first.

Here is the new command_line: g++ -Lc:\Python26\libs -lmingw32 -lSDLmain -lSDL_image -lSDL_ffmpeg -lSDL main.cpp button.cpp cleanup.cpp EbClassUnit.cpp ECamera.cpp ECFGParse.cpp ECleanup.cpp EDraw.cpp EFPS.cpp ELoad_Image.cpp EPython.cpp EStartup.cpp sprites.cpp toolshed.cpp update.cpp -o ORR.exe


Oh, and thanks for the quick reply.
MinGW is very strict about the ordering of the libraries to link to. Not only they need to be in the right order, like TheBuzzSaw said, but they should be *after* the source code to link to, otherwise there are undefined reference errors, as you saw.

With that in mind, try to change the command line to:

g++ -Lc:\Python26\libs -lmingw32 main.cpp button.cpp cleanup.cpp EbClassUnit.cpp ECamera.cpp ECFGParse.cpp ECleanup.cpp EDraw.cpp EFPS.cpp ELoad_Image.cpp EPython.cpp EStartup.cpp sprites.cpp toolshed.cpp update.cpp -o ORR.exe -lSDLmain -lSDL_image -lSDL_ffmpeg -lSDL
I do remember reading that MinGW is very picky on the ordering.

Anyway, I did try what you suggested.
It reduced the error output.


After going through the errors, the compiler doesn't seem to be including the source files correctly.

Does the order I type the source files into the command line matter?
Why do I ask?
Here are the new errors:
ECamera.cpp: In destructor `camera::~camera()':
ECamera.cpp:12: warning: converting to non-pointer type `int' from NULL
ECamera.cpp:13: warning: converting to non-pointer type `int' from NULL
C:\Users\BEST_A~1\AppData\Local\Temp/ccoqzOT9.o:ECleanup.cpp:(.text+0xfe): multi
ple definition of `clean_up()'
C:\Users\BEST_A~1\AppData\Local\Temp/ccIAAx4z.o:cleanup.cpp:(.text+0xfe): first
defined here
C:\Users\BEST_A~1\AppData\Local\Temp/cccIAZvE.o:main.cpp:(.text+0x172): undefine
d reference to `SCREEN_BPP'
C:\Users\BEST_A~1\AppData\Local\Temp/cccIAZvE.o:main.cpp:(.text+0x17b): undefine
d reference to `SCREEN_HEIGHT'
C:\Users\BEST_A~1\AppData\Local\Temp/cccIAZvE.o:main.cpp:(.text+0x184): undefine
d reference to `SCREEN_WIDTH'
C:\Users\BEST_A~1\AppData\Local\Temp/cccIAZvE.o:main.cpp:(.text+0x25a): undefine
d reference to `GameState'
C:\Users\BEST_A~1\AppData\Local\Temp/cccIAZvE.o:main.cpp:(.text+0x321): undefine
d reference to `gameover'
C:\Users\BEST_A~1\AppData\Local\Temp/cccIAZvE.o:main.cpp:(.text+0x32b): undefine
d reference to `fps'
C:\Users\BEST_A~1\AppData\Local\Temp/cccIAZvE.o:main.cpp:(.text+0x343): undefine
d reference to `fps'
C:\Users\BEST_A~1\AppData\Local\Temp/cccIAZvE.o:main.cpp:(.text+0x35a): undefine
d reference to `FPS'
C:\Users\BEST_A~1\AppData\Local\Temp/cccIAZvE.o:main.cpp:(.text+0x379): undefine
d reference to `FPS'
C:\Users\BEST_A~1\AppData\Local\Temp/cccIAZvE.o:main.cpp:(.text+0x386): undefine
d reference to `fps'
C:\Users\BEST_A~1\AppData\Local\Temp/ccIAAx4z.o:cleanup.cpp:(.text+0x129): undef
ined reference to `_imp__Py_Finalize'
C:\Users\BEST_A~1\AppData\Local\Temp/ccSf9L0H.o:EbClassUnit.cpp:(.text+0x1a8): u
ndefined reference to `keystates'
C:\Users\BEST_A~1\AppData\Local\Temp/ccSf9L0H.o:EbClassUnit.cpp:(.text+0x223): u
ndefined reference to `keystates'
C:\Users\BEST_A~1\AppData\Local\Temp/ccSf9L0H.o:EbClassUnit.cpp:(.text+0x29e): u
ndefined reference to `keystates'
C:\Users\BEST_A~1\AppData\Local\Temp/ccSf9L0H.o:EbClassUnit.cpp:(.text+0x31b): u
ndefined reference to `keystates'
C:\Users\BEST_A~1\AppData\Local\Temp/ccSf9L0H.o:EbClassUnit.cpp:(.text+0x519): u
ndefined reference to `event_struct'
C:\Users\BEST_A~1\AppData\Local\Temp/ccSf9L0H.o:EbClassUnit.cpp:(.text+0x52b): u
ndefined reference to `event_struct'
C:\Users\BEST_A~1\AppData\Local\Temp/ccSf9L0H.o:EbClassUnit.cpp:(.text+0x541): u
ndefined reference to `event_struct'
C:\Users\BEST_A~1\AppData\Local\Temp/ccSf9L0H.o:EbClassUnit.cpp:(.text+0x550): u
ndefined reference to `event_struct'
C:\Users\BEST_A~1\AppData\Local\Temp/ccSf9L0H.o:EbClassUnit.cpp:(.text$_ZN10bCla
ssUnit11draw_spriteEv[bClassUnit::draw_sprite()]+0x23): undefined reference to `
PCamera'
C:\Users\BEST_A~1\AppData\Local\Temp/ccSf9L0H.o:EbClassUnit.cpp:(.text$_ZN10bCla
ssUnit11draw_spriteEv[bClassUnit::draw_sprite()]+0x3e): undefined reference to `
PCamera'
C:\Users\BEST_A~1\AppData\Local\Temp/ccSf9L0H.o:EbClassUnit.cpp:(.text$_ZN10bCla
ssUnit11draw_spriteEv[bClassUnit::draw_sprite()]+0x43): undefined reference to `
SCREEN_WIDTH'
C:\Users\BEST_A~1\AppData\Local\Temp/ccSf9L0H.o:EbClassUnit.cpp:(.text$_ZN10bCla
ssUnit11draw_spriteEv[bClassUnit::draw_sprite()]+0x6d): undefined reference to `
PCamera'
C:\Users\BEST_A~1\AppData\Local\Temp/ccSf9L0H.o:EbClassUnit.cpp:(.text$_ZN10bCla
ssUnit11draw_spriteEv[bClassUnit::draw_sprite()]+0x85): undefined reference to `
PCamera'
C:\Users\BEST_A~1\AppData\Local\Temp/ccSf9L0H.o:EbClassUnit.cpp:(.text$_ZN10bCla
ssUnit11draw_spriteEv[bClassUnit::draw_sprite()]+0x8a): undefined reference to `
SCREEN_HEIGHT'
C:\Users\BEST_A~1\AppData\Local\Temp/ccSf9L0H.o:EbClassUnit.cpp:(.text$_ZN10bCla
ssUnit11draw_spriteEv[bClassUnit::draw_sprite()]+0x96): undefined reference to `
screen'
C:\Users\BEST_A~1\AppData\Local\Temp/ccSf9L0H.o:EbClassUnit.cpp:(.text$_ZN10bCla
ssUnit11draw_spriteEv[bClassUnit::draw_sprite()]+0xac): undefined reference to `
PCamera'
C:\Users\BEST_A~1\AppData\Local\Temp/ccSf9L0H.o:EbClassUnit.cpp:(.text$_ZN10bCla
ssUnit11draw_spriteEv[bClassUnit::draw_sprite()]+0xc0): undefined reference to `
PCamera'
C:\Users\BEST_A~1\AppData\Local\Temp/ccL1BvG7.o:ECamera.cpp:(.text+0x192): undef
ined reference to `SCREEN_WIDTH'
C:\Users\BEST_A~1\AppData\Local\Temp/ccL1BvG7.o:ECamera.cpp:(.text+0x1b1): undef
ined reference to `SCREEN_WIDTH'
C:\Users\BEST_A~1\AppData\Local\Temp/cciQ6IcR.o:EPython.cpp:(.text+0x11f): undef
ined reference to `_imp__PyString_FromString'
C:\Users\BEST_A~1\AppData\Local\Temp/cciQ6IcR.o:EPython.cpp:(.text+0x12f): undef
ined reference to `_imp__PyImport_Import'
C:\Users\BEST_A~1\AppData\Local\Temp/cciQ6IcR.o:EPython.cpp:(.text+0x13f): undef
ined reference to `_imp__PyModule_GetDict'
C:\Users\BEST_A~1\AppData\Local\Temp/cciQ6IcR.o:EPython.cpp:(.text+0x156): undef
ined reference to `_imp__PyDict_GetItemString'
C:\Users\BEST_A~1\AppData\Local\Temp/cciQ6IcR.o:EPython.cpp:(.text+0x166): undef
ined reference to `_imp__PyCallable_Check'
C:\Users\BEST_A~1\AppData\Local\Temp/cciQ6IcR.o:EPython.cpp:(.text+0x17f): undef
ined reference to `_imp__PyObject_CallObject'
C:\Users\BEST_A~1\AppData\Local\Temp/cciQ6IcR.o:EPython.cpp:(.text+0x188): undef
ined reference to `_imp__PyErr_Print'
C:\Users\BEST_A~1\AppData\Local\Temp/cciQ6IcR.o:EPython.cpp:(.text+0x1c9): undef
ined reference to `_imp__Py_Finalize'
C:\Users\BEST_A~1\AppData\Local\Temp/ccsZl3MR.o:EStartup.cpp:(.text+0x156): unde
fined reference to `TTF_Init'
C:\Users\BEST_A~1\AppData\Local\Temp/ccsZl3MR.o:EStartup.cpp:(.text+0x1aa): unde
fined reference to `screen'
C:\Users\BEST_A~1\AppData\Local\Temp/ccsZl3MR.o:EStartup.cpp:(.text+0x1e6): unde
fined reference to `screen'
C:\Users\BEST_A~1\AppData\Local\Temp/ccsZl3MR.o:EStartup.cpp:(.text+0x200): unde
fined reference to `screen'
C:\Users\BEST_A~1\AppData\Local\Temp/ccsZl3MR.o:EStartup.cpp:(.text+0x287): unde
fined reference to `_imp__Py_Initialize'
C:\Users\BEST_A~1\AppData\Local\Temp/ccMPtZma.o:toolshed.cpp:(.text+0x188): unde
fined reference to `keystates'
C:\Users\BEST_A~1\AppData\Local\Temp/ccMPtZma.o:toolshed.cpp:(.text+0x1e1): unde
fined reference to `keystates'
C:\Users\BEST_A~1\AppData\Local\Temp/ccMPtZma.o:toolshed.cpp:(.text+0x23a): unde
fined reference to `keystates'
C:\Users\BEST_A~1\AppData\Local\Temp/ccMPtZma.o:toolshed.cpp:(.text+0x293): unde
fined reference to `keystates'
C:\Users\BEST_A~1\AppData\Local\Temp/ccMPtZma.o:toolshed.cpp:(.text+0x491): unde
fined reference to `event_struct'
C:\Users\BEST_A~1\AppData\Local\Temp/ccMPtZma.o:toolshed.cpp:(.text+0x4a0): unde
fined reference to `event_struct'
C:\Users\BEST_A~1\AppData\Local\Temp/ccMPtZma.o:toolshed.cpp:(.text+0x4b7): unde
fined reference to `event_struct'
C:\Users\BEST_A~1\AppData\Local\Temp/ccMPtZma.o:toolshed.cpp:(.text+0x4c6): unde
fined reference to `event_struct'
C:\Users\BEST_A~1\AppData\Local\Temp/ccMPtZma.o:toolshed.cpp:(.text$_ZN8toolshed
11draw_spriteEv[toolshed::draw_sprite()]+0x23): undefined reference to `PCamera'

C:\Users\BEST_A~1\AppData\Local\Temp/ccMPtZma.o:toolshed.cpp:(.text$_ZN8toolshed
11draw_spriteEv[toolshed::draw_sprite()]+0x3e): undefined reference to `PCamera'

C:\Users\BEST_A~1\AppData\Local\Temp/ccMPtZma.o:toolshed.cpp:(.text$_ZN8toolshed
11draw_spriteEv[toolshed::draw_sprite()]+0x43): undefined reference to `SCREEN_W
IDTH'
C:\Users\BEST_A~1\AppData\Local\Temp/ccMPtZma.o:toolshed.cpp:(.text$_ZN8toolshed
11draw_spriteEv[toolshed::draw_sprite()]+0x6d): undefined reference to `PCamera'

C:\Users\BEST_A~1\AppData\Local\Temp/ccMPtZma.o:toolshed.cpp:(.text$_ZN8toolshed
11draw_spriteEv[toolshed::draw_sprite()]+0x85): undefined reference to `PCamera'

C:\Users\BEST_A~1\AppData\Local\Temp/ccMPtZma.o:toolshed.cpp:(.text$_ZN8toolshed
11draw_spriteEv[toolshed::draw_sprite()]+0x8a): undefined reference to `SCREEN_H
EIGHT'
C:\Users\BEST_A~1\AppData\Local\Temp/ccMPtZma.o:toolshed.cpp:(.text$_ZN8toolshed
11draw_spriteEv[toolshed::draw_sprite()]+0x96): undefined reference to `screen'
C:\Users\BEST_A~1\AppData\Local\Temp/ccMPtZma.o:toolshed.cpp:(.text$_ZN8toolshed
11draw_spriteEv[toolshed::draw_sprite()]+0xac): undefined reference to `PCamera'

C:\Users\BEST_A~1\AppData\Local\Temp/ccMPtZma.o:toolshed.cpp:(.text$_ZN8toolshed
11draw_spriteEv[toolshed::draw_sprite()]+0xc0): undefined reference to `PCamera'

C:\Users\BEST_A~1\AppData\Local\Temp/ccj66qyl.o:update.cpp:(.text+0x11e): undefi
ned reference to `screen'
C:\Users\BEST_A~1\AppData\Local\Temp/ccj66qyl.o:update.cpp:(.text+0x132): undefi
ned reference to `screen'
C:\Users\BEST_A~1\AppData\Local\Temp/ccj66qyl.o:update.cpp:(.text+0x13e): undefi
ned reference to `screen'
C:\Users\BEST_A~1\AppData\Local\Temp/ccj66qyl.o:update.cpp:(.text+0x14d): undefi
ned reference to `event_struct'
C:\Users\BEST_A~1\AppData\Local\Temp/ccj66qyl.o:update.cpp:(.text+0x15c): undefi
ned reference to `event_struct'
C:\Users\BEST_A~1\AppData\Local\Temp/ccj66qyl.o:update.cpp:(.text+0x165): undefi
ned reference to `gameover'
C:\Users\BEST_A~1\AppData\Local\Temp/ccj66qyl.o:update.cpp:(.text+0x16c): undefi
ned reference to `GameState'
C:\Users\BEST_A~1\AppData\Local\Temp/ccj66qyl.o:update.cpp:(.text+0x175): undefi
ned reference to `event_struct'
C:\Users\BEST_A~1\AppData\Local\Temp/ccj66qyl.o:update.cpp:(.text+0x17e): undefi
ned reference to `event_struct'
C:\Users\BEST_A~1\AppData\Local\Temp/ccj66qyl.o:update.cpp:(.text+0x195): undefi
ned reference to `keystates'
C:\Users\BEST_A~1\AppData\Local\Temp/ccj66qyl.o:update.cpp:(.text+0x1a3): undefi
ned reference to `gameover'
C:\Users\BEST_A~1\AppData\Local\Temp/ccj66qyl.o:update.cpp:(.text+0x1aa): undefi
ned reference to `GameState'
C:\Users\BEST_A~1\AppData\Local\Temp/ccj66qyl.o:update.cpp:(.text+0x1c3): undefi
ned reference to `keystates'
C:\Users\BEST_A~1\AppData\Local\Temp/ccj66qyl.o:update.cpp:(.text+0x1d0): undefi
ned reference to `PCamera'
C:\Users\BEST_A~1\AppData\Local\Temp/ccj66qyl.o:update.cpp:(.text+0x1df): undefi
ned reference to `PCamera'
C:\Users\BEST_A~1\AppData\Local\Temp/ccj66qyl.o:update.cpp:(.text+0x1f5): undefi
ned reference to `PCamera'
C:\Users\BEST_A~1\AppData\Local\Temp/ccj66qyl.o:update.cpp:(.text+0x202): undefi
ned reference to `PCamera'
C:\Users\BEST_A~1\AppData\Local\Temp/ccj66qyl.o:update.cpp:(.text+0x241): undefi
ned reference to `keystates'
C:\Users\BEST_A~1\AppData\Local\Temp/ccj66qyl.o:update.cpp:(.text+0x24e): undefi
ned reference to `PCamera'
C:\Users\BEST_A~1\AppData\Local\Temp/ccj66qyl.o:update.cpp:(.text+0x25d): undefi
ned reference to `PCamera'
C:\Users\BEST_A~1\AppData\Local\Temp/ccj66qyl.o:update.cpp:(.text+0x273): undefi
ned reference to `PCamera'
C:\Users\BEST_A~1\AppData\Local\Temp/ccj66qyl.o:update.cpp:(.text+0x280): undefi
ned reference to `PCamera'
C:\Users\BEST_A~1\AppData\Local\Temp/ccj66qyl.o:update.cpp:(.text+0x2bf): undefi
ned reference to `keystates'
C:\Users\BEST_A~1\AppData\Local\Temp/ccj66qyl.o:update.cpp:(.text+0x2cc): undefi
ned reference to `PCamera'
C:\Users\BEST_A~1\AppData\Local\Temp/ccj66qyl.o:update.cpp:(.text+0x2dc): undefi
ned reference to `PCamera'
C:\Users\BEST_A~1\AppData\Local\Temp/ccj66qyl.o:update.cpp:(.text+0x2f1): undefi
ned reference to `PCamera'
C:\Users\BEST_A~1\AppData\Local\Temp/ccj66qyl.o:update.cpp:(.text+0x2fe): undefi
ned reference to `PCamera'
C:\Users\BEST_A~1\AppData\Local\Temp/ccj66qyl.o:update.cpp:(.text+0x33d): undefi
ned reference to `keystates'
C:\Users\BEST_A~1\AppData\Local\Temp/ccj66qyl.o:update.cpp:(.text+0x34a): undefi
ned reference to `PCamera'
C:\Users\BEST_A~1\AppData\Local\Temp/ccj66qyl.o:update.cpp:(.text+0x35a): undefi
ned reference to `PCamera'
C:\Users\BEST_A~1\AppData\Local\Temp/ccj66qyl.o:update.cpp:(.text+0x36f): undefi
ned reference to `PCamera'
C:\Users\BEST_A~1\AppData\Local\Temp/ccj66qyl.o:update.cpp:(.text+0x37c): undefi
ned reference to `PCamera'
C:\Users\BEST_A~1\AppData\Local\Temp/ccj66qyl.o:update.cpp:(.text+0x3bb): undefi
ned reference to `keystates'
C:\Users\BEST_A~1\AppData\Local\Temp/ccj66qyl.o:update.cpp:(.text+0x3e5): undefi
ned reference to `screen'
collect2: ld returned 1 exit status



By the way, do any tags exist that have a similar effect to the [spoiler][/spoiler] tags?
In your first post, i read errors like this:

...
/Users/hercules/trunk/SDL-1.2/./src/main/win32/SDL_win32_main.c:220: undefined r
eference to `SDL_strlcat'
/Users/hercules/trunk/SDL-1.2/./src/main/win32/SDL_win32_main.c:243: undefined r
eference to `SDL_strlcpy'
/Users/hercules/trunk/SDL-1.2/./src/main/win32/SDL_win32_main.c:244: undefined r
eference to `SDL_strlcat'
/mingw/lib/libSDLmain.a(SDL_win32_main.o): In function `console_main':
/Users/hercules/trunk/SDL-1.2/./src/main/win32/SDL_win32_main.c:296: undefined r
...

This looked like a problem in linking the SDL library. After all, if the compiler reads the SDL header properly, but the library isn't linked, that reference should be undefined. But this time, i see absolutely no relation to SDL with the errors:

...
C:\Users\BEST_A~1\AppData\Local\Temp/cccIAZvE.o:main.cpp:(.text+0x172): undefine
d reference to `SCREEN_BPP'
C:\Users\BEST_A~1\AppData\Local\Temp/cccIAZvE.o:main.cpp:(.text+0x17b): undefine
d reference to `SCREEN_HEIGHT'
C:\Users\BEST_A~1\AppData\Local\Temp/cccIAZvE.o:main.cpp:(.text+0x184): undefine
d reference to `SCREEN_WIDTH'
C:\Users\BEST_A~1\AppData\Local\Temp/cccIAZvE.o:main.cpp:(.text+0x25a): undefine
...

Variables like SCREEN_BPP, _HEIGHT, and _WIDTH, i expect to be defined in main.cpp, or some user-file, so the undefined reference is doubly puzzling to me. Are these not variables you yourself declared? If so, where are they defined?

...
C:\Users\BEST_A~1\AppData\Local\Temp/cciQ6IcR.o:EPython.cpp:(.text+0x13f): undef
ined reference to `_imp__PyModule_GetDict'
C:\Users\BEST_A~1\AppData\Local\Temp/cciQ6IcR.o:EPython.cpp:(.text+0x156): undef
ined reference to `_imp__PyDict_GetItemString'
C:\Users\BEST_A~1\AppData\Local\Temp/cciQ6IcR.o:EPython.cpp:(.text+0x166): undef
ined reference to `_imp__PyCallable_Check'
C:\Users\BEST_A~1\AppData\Local\Temp/cciQ6IcR.o:EPython.cpp:(.text+0x17f): undef
ined reference to `_imp__PyObject_CallObject'
C:\Users\BEST_A~1\AppData\Local\Temp/cciQ6IcR.o:EPython.cpp:(.text+0x188): undef
ined reference to `_imp__PyErr_Print'
...

There are still undefined references with the Python library. The only Pythong reference i see in your line is "-Lc:\Python26\libs". Is there anything else you should be doing?

Also, have you considered investing time in learning how to make makefiles? At first, they can feel complex, but problems like this can be reduced when you're not doing everything on one line.

"Does the order I type the source files into the command line matter?"

When MinGW goes into main.cpp, it'll look at all the headers main includes to get the definitions of all the functions. Linking, i believe, does not happen until every file has been compiled into an intermediate file format. Therefore, not, i don't think it should matter. Does changing the order of files change anything?
Wow, how did I not notice.

Somehow I forgot to compile EDeclarations.cpp

Here is the new command line:
g++ -Lc:\Python26\libs main.cpp button.cpp EDeclarations.cpp EbClassUnit.cpp ECamera.cpp ECFGParse.cpp ECleanup.cpp EDraw.cpp EFPS.cpp ELoad_Image.cpp EPython.cpp EStartup.cpp main.cpp sprites.cpp cleanup.cpp toolshed.cpp update.cpp -o ORR.exe -lmingw32 -lPython26 -lSDLmain -lSDL_image -lSDL_ffmpeg -lSDL

And the new Error output:
c:\source\ORR>g++ -Lc:\Python26\libs main.cpp button.cpp EDeclarations.cpp EbCla
ssUnit.cpp ECamera.cpp ECFGParse.cpp ECleanup.cpp EDraw.cpp EFPS.cpp ELoad_Image
.cpp EPython.cpp EStartup.cpp main.cpp sprites.cpp cleanup.cpp toolshed.cpp upda
te.cpp -o ORR.exe -lmingw32 -lPython26 -lSDLmain -lSDL_image -lSDL_ffmpeg -lSDL
ECamera.cpp: In destructor `camera::~camera()':
ECamera.cpp:12: warning: converting to non-pointer type `int' from NULL
ECamera.cpp:13: warning: converting to non-pointer type `int' from NULL
C:\Users\BEST_A~1\AppData\Local\Temp/cc2ycLBn.o:main.cpp:(.text+0xfe): multiple
definition of `SDL_main'
C:\Users\BEST_A~1\AppData\Local\Temp/ccvSu02B.o:main.cpp:(.text+0xfe): first def
ined here
C:\Users\BEST_A~1\AppData\Local\Temp/ccUEMx2Y.o:cleanup.cpp:(.text+0xfe): multip
le definition of `clean_up()'
C:\Users\BEST_A~1\AppData\Local\Temp/ccoYIvg9.o:ECleanup.cpp:(.text+0xfe): first
defined here
C:\Users\BEST_A~1\AppData\Local\Temp/ccVQsphj.o:EPython.cpp:(.text+0x11f): undef
ined reference to `_imp__PyString_FromString'
C:\Users\BEST_A~1\AppData\Local\Temp/ccVQsphj.o:EPython.cpp:(.text+0x12f): undef
ined reference to `_imp__PyImport_Import'
C:\Users\BEST_A~1\AppData\Local\Temp/ccVQsphj.o:EPython.cpp:(.text+0x13f): undef
ined reference to `_imp__PyModule_GetDict'
C:\Users\BEST_A~1\AppData\Local\Temp/ccVQsphj.o:EPython.cpp:(.text+0x156): undef
ined reference to `_imp__PyDict_GetItemString'
C:\Users\BEST_A~1\AppData\Local\Temp/ccVQsphj.o:EPython.cpp:(.text+0x166): undef
ined reference to `_imp__PyCallable_Check'
C:\Users\BEST_A~1\AppData\Local\Temp/ccVQsphj.o:EPython.cpp:(.text+0x17f): undef
ined reference to `_imp__PyObject_CallObject'
C:\Users\BEST_A~1\AppData\Local\Temp/ccVQsphj.o:EPython.cpp:(.text+0x188): undef
ined reference to `_imp__PyErr_Print'
C:\Users\BEST_A~1\AppData\Local\Temp/ccVQsphj.o:EPython.cpp:(.text+0x1c9): undef
ined reference to `_imp__Py_Finalize'
C:\Users\BEST_A~1\AppData\Local\Temp/cco7oTtc.o:EStartup.cpp:(.text+0x156): unde
fined reference to `TTF_Init'
C:\Users\BEST_A~1\AppData\Local\Temp/cco7oTtc.o:EStartup.cpp:(.text+0x287): unde
fined reference to `_imp__Py_Initialize'
C:\Users\BEST_A~1\AppData\Local\Temp/ccUEMx2Y.o:cleanup.cpp:(.text+0x129): undef
ined reference to `_imp__Py_Finalize'
collect2: ld returned 1 exit status

In Engine.h, I have:
#pragma once//Define only if you are using MinGW on windows#define MinGW#include <SDL/SDL.h>#include <SDL/SDL_image.h>#include <iostream>#include <string>#include <stdlib.h>#include <stdio.h>#include <map>#include <fstream>#include <SDL/SDL_ttf.h>#ifdef MinGW#include <PYTHON/Python.h>#else#include <Python.h>#endif#include "EClass.h"#include "EPrototypes.h"#include "EDeclarations.h"


I do include the library and header for python, so, why do I still get errors from it.

Looking through the errors, I notice it says:
C:\Users\BEST_A~1\AppData\Local\Temp/cc2ycLBn.o:main.cpp:(.text+0xfe): multiple
definition of `SDL_main'
C:\Users\BEST_A~1\AppData\Local\Temp/ccvSu02B.o:main.cpp:(.text+0xfe): first def
ined here
C:\Users\BEST_A~1\AppData\Local\Temp/ccUEMx2Y.o:cleanup.cpp:(.text+0xfe): multip
le definition of `clean_up()'
C:\Users\BEST_A~1\AppData\Local\Temp/ccoYIvg9.o:ECleanup.cpp:(.text+0xfe): first
defined here

Why do I get those two errors in MinGW, but not in msvc?

And no, I don't believe changing the order of files changes anything.

Big thanks to all who are helping me!

This topic is closed to new replies.

Advertisement