- 전처리기(preprocessor)로 컴파일 시 오류를 발생시키는 방법을 소개합니다.
#error
전처리기를 사용하시면 됩니다.
#ifdef Qoo1
#error ***** ERROR ***** Qoo1 is defined ******
#endif
// AsioTCPServer.cpp | |
// | |
// : Defines the entry point for the console application. | |
// | |
#if (_MSC_VER >= 1300) // VC++ 7.0(2003) or over | |
#include "stdafx.h" | |
#include <tchar.h> | |
#include <errno.h> | |
#else |
@REM ---------------------------------------------------- | |
@REM Rewmotecap.cmd | |
@REM Example command for captruing eremote network packet | |
@REM using wireshark and tcpdump. | |
@REM First written by j2doll. September 10th 2016. | |
@REM https://github.com/j2doll | |
@REM http://j2doll.tistory.com | |
@REM ---------------------------------------------------- | |
@REM install putty and wireshark on your windows pc. |
// constparam | |
// 읽기(R) 쓰기(W) 인자. read/write paramter. | |
void refparam(int& param) | |
{ | |
param = 10; | |
} | |
// 읽기전용 인자를 const로 설정. set the read-only parameter to const type. | |
void constparam(const int& param) |
// DB.h | |
// source from leveldb of code.google | |
class DB | |
{ | |
public: | |
DB() { } | |
virtual ~DB() {} | |
private: // No copying allowed |
// UseDB.cpp | |
#include "DB.h" | |
DB db1, db2; | |
db1 = db2; // error | |
DB db3(db1); // error |
#error
전처리기를 사용하시면 됩니다.#ifdef Qoo1
#error ***** ERROR ***** Qoo1 is defined ******
#endif
// alias namespace | |
// code from : http://www.boost.org/doc/libs/1_41_0/libs/statechart/doc/tutorial.html | |
namespace sc = boost::statechart; | |
// SScc2dx.cpp | |
// http://www.jesusbosch.com/2012/06/creating-and-using-sprite-sheets-in.html | |
_batchNode = CCSpriteBatchNode::batchNodeWithFile("gamePlayPack.pvr");this->addChild(_batchNode); | |
CCSpriteFrameCache::sharedSpriteFrameCache()->addSpriteFramesWithFile("gamePlayPack.plist"); | |
_ship = CCSprite::spriteWithSpriteFrameName( "ufo.png" ); | |
CCSize winSize = CCDirector::sharedDirector()->getWinSize();_ship->setPosition( ccp(winSize.width * 0.1, winSize.height * 0.5) ); |
// overring.cpp | |
// simple overriding example | |
#include <iostream> | |
using namespace std; | |
class A | |
{ | |
public: | |
A() { cout << "A()" << endl; } |
// Exam28.cpp | |
// 9/21/2000 (rk) | |
// Last modified: 3/10/2002 (RK) | |
// test the routine KILL_PROC_BY_NAME to terminate a process | |
#include <windows.h> | |
#include <tlhelp32.h> | |
#include <iostream.h> | |
#ifdef BORLANDC |