I learn C ++ with Code :: Blocks, and every time I try to create a new class, I get an error:
undefined reference to `WinMain@16'
Here is the code I used:
Main class
#include "Lime.h" #include <iostream> using namespace std; int main() { Lime lime; return 0; }
Lime Class (.ccp):
#include "Lime.h" #include <iostream> using namespace std; Lime::Lime() { cout<<"Hi!"; }
Lime Header (.h):
#ifndef LIME_H #define LIME_H class Lime { public: Lime(); }; #endif
If someone knows how to fix this, please tell me!
Try the following: Settings→ Compiler, click the tab Build options, check the box
Settings
Compiler
Build options
Explicitly add currently compiling a file directory to the compiler search directory
PS
The next time you create a new class, in the section, File policymake sure you select the checkboxes
File policy
Add project path
,
, .
? , CodeBlocks . , - . .
? , , CodeBlocks header/cpp, , ( ). .
, , , Windows GUI , . , Bucky .
, Windows, . WinMain , main.
main
CodeBlocks, - , , . , "Windows", "", , . , cout, , - , . , main .
cout
. .
. , Project/target option " " , . "" , " ".
Project/target option
"Project" --> "Build Options . . .""Linker Settings""Link libraries" "Add": mingw32;libSDL.a;libSDLmain.a"Search directories" --> "Linker"MinGW! !
"Project" --> "Build Options . . ."
"Linker Settings"
"Link libraries"
"Add"
mingw32;libSDL.a;libSDLmain.a
"Search directories" --> "Linker"
, OK. . !
, . / , .
... , , " ", "" , ( ).cbp ... , .h .cpp ... ... ..
, , , head. , #include "Burrito.h", head . Dev-cpp.
: - > , " ",
: undefined `WinMain @16 ' undefined ' class-name:: class-name() ' CodeBlocks
→ . g++ ++ 11 ISO ++ [-std = ++ 11]"" [F9]. , .
, "main.cpp" . , , , .
Source: https://habr.com/ru/post/1524856/More articles:Sorry, we are unable to access the page you requested:https://fooobar.com/questions/1524851/index.htmlПроблемы с GLSL 1.2 floor() в Vertex Shader - openglWhat is the complexity of this double cycle - cКак остановить zsh от расширения * (звездочки) в командной строке? - zshWhy did I say that the "master" does not refer to a commit "when I use git-subtree? - gitIOS app - Rails 4 and development as a backend - ios7Qt: set columns in treeView - c ++Set limit for div in scrollable table - javascriptInability to set up a test environment with grunts, phantoms and mocha - gruntjsArray.first Vs Array.shift in Ruby - arraysAll Articles
https://fooobar.com/questions/1524851/index.html