PDA

View Full Version : how to compile the hello example in codeblocks?



creatxr
11-21-2014, 08:32 PM
-std=c++0x ?

it can't work.


#include <ClanLib/core.h>
#include <ClanLib/application.h>
using namespace clan;
class ConsoleProgram
{
public:
static int main(const std::vector &args);
};
// Create global application object:
// You MUST include this line or the application start-up will fail to
// locate your console application object.
Application app(&ConsoleProgram::main);
int ConsoleProgram::main(const std::vector<std::string> &args) // Setup clanCore:
{
SetupCore setup_core;
// Create a console Window if one does not exist:
ConsoleWindow console_window("Console");
// Write a line to the console:
Console::write_line("Hello World!");
// Wait for a key so the window won't close immediately.
Console::wait_for_key();
return 0;
}

creatxr
11-24-2014, 06:15 PM
undefined reference to `clan::Application::main'|


#include <ClanLib/application.h>
#include <ClanLib/core.h>
#include <ClanLib/display.h>
#include <ClanLib/d3d.h>
#include <ClanLib/gl.h>
#include <ClanLib/swrender.h>
#include <ClanLib/gui.h>

class Program
{
public:
static int main(const std::vector<std::string> &args);
};


int Program::main(const std::vector<std::string> &args) {
return 0;
}

clan::Application app(&Program::main);

creatxr
11-24-2014, 06:45 PM
i think i get it.

1) add all lib to setting->compiler->linker settings->link libs (16 libs)
2) projects build options ("{Compiler|Linker} settings -> Other [linker ]options"). add -pthread