jaydubeww Posted April 30, 2012 Share Posted April 30, 2012 Hi all, I'm new to C++ and having a bit of trouble compiling the basic LEBuilder Gamelib project. I added all the include/search directories and now I receive these build errors: Also note: I haven't changed anything to the files. The Error occurs on the last line in the .cpp; RunClass(main). ||=== main, Release ===| C:Programmingprojects_codeblocksbasic_frameworkmainsourcesrcmain.cpp||In function 'int main(int, char**)':| C:Programmingprojects_codeblocksbasic_frameworkmainsourcesrcmain.cpp|32|error: expected ';' before 'app'| C:Programmingprojects_codeblocksbasic_frameworkmainsourcesrcmain.cpp|32|warning: statement is a reference, not call, to function 'main'| C:Programmingprojects_codeblocksbasic_frameworkmainsourcesrcmain.cpp|32|warning: statement has no effect| C:Programmingprojects_codeblocksbasic_frameworkmainsourcesrcmain.cpp|32|error: 'app' was not declared in this scope| ||=== Build finished: 2 errors, 2 warnings ===| the RunClass() definition in Application.h namespace GameLib { #define RunClass(UserApp,...) int main(int argc, char* argv[]) { /*chdir(__VA_ARGS__);*/ UserApp app(argc,argv); app.Load(); app.Run(); return app.GetResult(); } the .h #pragma once #include "GameLib.h" // GameLib #define APPNAME "main" #define APPVER "0.0.0.0" class main : public Application { public: main(int argc, char* argv[]); // Constructor void RenderActive3D(); // Overridden 3D rendering void RenderActive2D(); // Overridden 2D rendering Cube cube, ground; // Create cube and ground void Load(); // Overridden scene loading and population stuff Material material; // Material for cube and ground DirectionalLight sun; // Create sun }; the .cpp #include "main.h" main::main(int argc, char* argv[]): Application("data",APPNAME" "APPVER) { // TODO: Add stuff here which is done once per application launch } void main::Load() { game.scene.cam.Move(0,0,-2); sun.Turn(Vec3(45)); material.Load("Models/CobbleStones/CobbleStones.mat"); cube.Paint(material); ground.Paint(material); ground.Scale(Vec3(10,1,10)); ground.SetPosition(Vec3(0,-2,0)); } void main::RenderActive3D() { if(Keyboard::I****()) Quit(); double n=AppSpeed(); cube.Turn(n,n*2,0); } void main::RenderActive2D() { Draw::Text(50,50,"%0.0f",FPS()); } RunClass(main); Quote Link to comment Share on other sites More sharing options...
cassius Posted May 1, 2012 Share Posted May 1, 2012 Metetron usualy answers gamelib questions. He hasn't been around lately. Maybe he has gone to look for lummooja Quote amd quad core 4 ghz / geforce 660 ti 2gb / win 10 Blender,gimp,silo2,ac3d,,audacity,Hexagon / using c++ Link to comment Share on other sites More sharing options...
Canardia Posted May 1, 2012 Share Posted May 1, 2012 I think you can't call a class "main", because it conflicts with the main function. You could call it "Main" though, and class names should always start with capital letter. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Clackdor Posted May 1, 2012 Share Posted May 1, 2012 I think you can't call a class "main", because it conflicts with the main function. You could call it "Main" though, and class names should always start with capital letter. Says who? Quote Link to comment Share on other sites More sharing options...
jaydubeww Posted May 2, 2012 Author Share Posted May 2, 2012 Metatron was right, my main class 'main' was interfering with Gamelibs method 'main'. Now it seems to be looking for OpenGL commands. I figured I should add 'C:/mingw/lib' to my search directory, but that didn't help. Note: These are not all of the errors, but I figured you got the jist of it. .libGameLibGameLib.o:GameLib.cpp|| undefined reference to `glMatrixMode@4'| .libGameLibGameLib.o:GameLib.cpp|| undefined reference to `glPushMatrix@0'| .libGameLibGameLib.o:GameLib.cpp|| undefined reference to `glLoadIdentity@0'| .libGameLibGameLib.o:GameLib.cpp|| undefined reference to `glFrustum@48'| .libGameLibGameLib.o:GameLib.cpp|| undefined reference to `glMatrixMode@4'| .libGameLibGameLib.o:GameLib.cpp|| undefined reference to `glPushMatrix@0'| .libGameLibGameLib.o:GameLib.cpp|| undefined reference to `glLoadIdentity@0'| .libGameLibGameLib.o:GameLib.cpp|| undefined reference to `glScalef@12'| .libGameLibGameLib.o:GameLib.cpp|| undefined reference to `gluLookAt@72'| .libGameLibGameLib.o:GameLib.cpp|| undefined reference to `glEnable@4'| .libGameLibGameLib.o:GameLib.cpp|| undefined reference to `glBlendFunc@8'| .libGameLibGameLib.o:GameLib.cpp|| undefined reference to `glCullFace@4'| .libGameLibGameLib.o:GameLib.cpp|| undefined reference to `glEnable@4'| .libGameLibGameLib.o:GameLib.cpp|| undefined reference to `glColor4f@16'| .libGameLibGameLib.o:GameLib.cpp|| undefined reference to `glEnable@4'| .libGameLibGameLib.o:GameLib.cpp|| undefined reference to `glCullFace@4'| .libGameLibGameLib.o:GameLib.cpp|| undefined reference to `glPushMatrix@0'| .libGameLibGameLib.o:GameLib.cpp|| undefined reference to `glGetIntegerv@8'| .libGameLibGameLib.o:GameLib.cpp|| undefined reference to `gluOrtho2D@32'| ||More errors follow but not being shown.| ||Edit the max errors limit in compiler options...| ||=== Build finished: 50 errors, 0 warnings ===| I'd check the GameLib tutorials, but those seem to be down quite often.. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.