Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Building Error With Latest Source and -std=c++11 Flag  (Read 2803 times)

0 Members and 1 Guest are viewing this topic.

Ruckamongus

  • Jr. Member
  • **
  • Posts: 70
    • View Profile
Building Error With Latest Source and -std=c++11 Flag
« on: May 23, 2014, 07:34:20 am »
Hello all, I tried building the latest source with the G++ flag "-std=c++11", but it gives a compile error in src/SFML/Main/MainWin32.cpp. The error comes from:

extern int main(int argc, char* argv[]);

////////////////////////////////////////////////////////////
int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, INT)
{
    return main(__argc, __argv);//Undefined reference to both of these variables.
}
 

It got me thinking... how did it compile without the C++11 flag in the first place? I tried searching the source, but couldn't find any definition of "__argc" or "__argv". Is it perhaps a WinAPI shadowing issue?
« Last Edit: May 23, 2014, 07:37:43 am by Ruckamongus »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
AW: Building Error With Latest Source and -std=c++11 Flag
« Reply #1 on: May 23, 2014, 07:59:58 am »
Do you have an int main function?
I assume you're linking sfml-main, right?
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email

Ruckamongus

  • Jr. Member
  • **
  • Posts: 70
    • View Profile
Re: AW: Building Error With Latest Source and -std=c++11 Flag
« Reply #3 on: May 23, 2014, 08:11:41 am »
Do you have an int main function?
I assume you're linking sfml-main, right?
I was just trying to build SFML, no project on my own at all.

[/quote]
Google can be quite useful: http://stackoverflow.com/questions/17959385/using-argc-and-argv-in-mingw
I searched the forum; didn't realize it was MinGW related.

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: AW: Building Error With Latest Source and -std=c++11 Flag
« Reply #4 on: May 23, 2014, 08:48:59 am »
I was just trying to build SFML, no project on my own at all.
I see.

What MinGW version are you using? You might want to check your stdlib.h header, to see if  __argc and __argv got declared.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

 

anything