vc2005 프로젝트를 vc2008 프로젝트로 변환시 발생하는 것으로 보인다.

컴파일러 경고(수준 3) C4748

오류 메시지

함수에서 최적화를 사용하지 않으므로 /GS를 지정해도 로컬 버퍼 오버런에서 매개 변수 및 지역 변수를 보호할 수 없습니다.
/GS can not protect parameters and local variables from local buffer overrun because optimizations are disabled in function

기본적으로 활성화되어 있는 /GS(버 퍼 보안 검사)는 함수의 최적화 기능을 사용하지 않는 한 함수의 매개 변수와 지역 변수에서 로컬 버퍼 오버런이 발생하지 않도록 보호할 수 없습니다.

함수에 jmp 또는 jcc와 같은 흐름 제어 문이 포함된 인라인 어셈블리 코드가 있는 경우 컴파일러는 최적화를 비활성화합니다.

이 경고를 해결하고 /GS를 사용하여 로컬 버퍼 오버런에서 매개 변수와 지역 변수를 보호하려면 최적화를 활성화해야 합니다.

http://msdn.microsoft.com/ko-kr/library/ms235398%28VS.80%29.aspx

MSDN 도움말을 찾아보니...

아아-_- ... 뭘 어떻게 하라는건지...;; orz;;


대부분의 구글 검색 결과도 MSDN 도움말의 답습일뿐
뽀족한 해결책은 제시하지 못하고 있는 상황에서 방황하던 중...

ogre 포럼에서 아래와 같은 주옥같은 답변을 찾아내게되었다 -_-)/

I've found the error: -
저는 에러를 찾았어요 >ㅁ<)/

Visual Studio 2008 SP1 turns off /O2 optimization when upgrading from VS 2005. Even if it *Looks* like its on, it may not be. Check that its actually in the command line (also - it is Bold in the IDE if its enabled).
비주얼 스튜디오 2008 SP1 은 O2 최적화를 꺼버립니다. VC2005 에서 업그레이드할때 말예요! 켜진 것처럼 보이지만, 그렇치 않습니다. 실제로 적용도는지 확인할 필요가 있어요. 커맨드라인에서 말이죠. ( IDE상에서는 굵고 진하게 볼드체로 되어있어야 합니다. )

I hope this helps someone googling :)
구글링을 통해 다른 분들에게 도움이 되었으면 좋겠내요 ^_^

http://www.ogre3d.org/forums/viewtopic.php?f=10&t=49787

와 >ㅁ<)/ 천사님!!


실제 Configuration Properties 의
C/C++/Optimization/Optmization 속성을 보면 볼드체가 아닌걸 확인할 수 있었다.

직접 항목을 다시 선택해주면 볼드체로 바뀌며 다시 링크를 해보면 C4748 경고는 사라지게 된다. ~(-_-)~








이올린에 북마크하기(0) 이올린에 추천하기(0)
2010/02/11 22:39 2010/02/11 22:39

vc2005 __RPC__ 컴파일 에러

Posted at 2009/12/16 13:59// Posted in msvc
TSF 관련 코드를 빌드하던중 아래와 같은 에러가 발생!
1>c:\program files\microsoft sdks\windows\v6.0\include\textstor.h(270) : error C2061: syntax error : identifier '__RPC__in'
1>c:\program files\microsoft sdks\windows\v6.0\include\textstor.h(275) : error C2061: syntax error : identifier '__RPC__in_opt'
1>c:\program files\microsoft sdks\windows\v6.0\include\textstor.h(279) : error C2061: syntax error : identifier '__RPC__out'
1>c:\program files\microsoft sdks\windows\v6.0\include\textstor.h(282) : error C2061: syntax error : identifier '__RPC__out'
1>c:\program files\microsoft sdks\windows\v6.0\include\textstor.h(288) : error C2061: syntax error : identifier '__RPC__out'
1>c:\program files\microsoft sdks\windows\v6.0\include\textstor.h(294) : error C2061: syntax error : identifier '__RPC__out_ecount_part'
해결 방법은~

stdafx.h 에 아래 내용을 추가 ~(-_-)~

[code c++]
#include <rpcsal.h>


http://www.tech-archive.net/Archive/Media/microsoft.public.windowsmedia.sdk/2007-02/msg00105.html
이올린에 북마크하기(0) 이올린에 추천하기(0)
2009/12/16 13:59 2009/12/16 13:59

python vc2005 에서 swig 사용하기

Posted at 2009/02/05 13:36// Posted in python/pyswig
SWIG 홈페이지
http://www.swig.org/

SWIG 다운로드
http://www.swig.org/download.html

The Latest Release

The latest development release is swig-1.3.38. View the release notes. Windows users should download swigwin-1.3.38 which includes a prebuilt executable.

파이썬 홈페이지
http://www.python.org/

파이썬 다운로드
http://www.python.org/download/

Download Standard Python Software

For the MD5 checksums and OpenPGP signatures, look at the detailed Python 2.6.1 page:



VC2005 준비 작업
- 테스트 프로젝트 생성
- swig.exe 와 lib 을 테스트 프로젝트로 복사


StdAfx.h 추가 내용
[code c++]
// PYTHON
#ifdef _DEBUG
# undef _DEBUG
# include <python.h>
# define _DEBUG
#else
# include <python.h>
#endif


main.cpp 예제 코드
[code c++]
#include "stdafx.h"

int _tmain(int argc, _TCHAR* argv[])
{
Py_Initialize();

PyRun_SimpleString("print('haha')");

Py_Finalize();
return 0;
}


결과
haha
계속하려면 아무 키나 누르십시오 . . .

core.h 파일 추가
[code c++]
#pragma once

void info(const char* msg);


core.cpp 파일 추가
[code c++]
#include "stdafx.h"
#include "core.h"

void info(const char* msg)
{
puts(msg);
}


core.i 파일 추가

%module core

%{
#include "core.h"
%}

%include "core.h"


python_binding.h 파일 추가
[code c++]
#pragma once

void Py_LoadModules();


python_binding.cpp 파일 추가
[code c++]
#include "stdafx.h"

#pragma warning(disable:4996) // 문자열 함수 관련 경고 무시
#include "core_wrap.inc"

void Py_LoadModules()
{
init_core();
}


main.cpp 코드 수정
[code c++]
#include "stdafx.h"
#include "python_binding.h"

int _tmain(int argc, _TCHAR* argv[])
{
Py_Initialize();

Py_LoadModules();

PyRun_SimpleString("import core;core.info('ruru')");

Py_Finalize();
return 0;
}



사용자 지정 빌드 단계 구성
1. core.i 오른 클릭 -> 팝업 메뉴/속성 선택
2. core.i 속성 페이지 -> 사용자 지정 빌드 단계 선택
3. 내용 편집
- 명령줄: swig.exe -c++ -python -o $(InputName)_wrap.cpp $(InputPath)
- 설명: swig 인터페이스 파일 생성
- 출력: $(InputName)_wrap.cpp
- 추가 종속성: core.h


MSDN 참고자료:
http://msdn.microsoft.com/ko-kr/library/hefydhhy(VS.80).aspx
이올린에 북마크하기(0) 이올린에 추천하기(0)
2009/02/05 13:36 2009/02/05 13:36

import subprocess

devEnvPath = "DEVENV.exe 경로"
configName = "Release 나 Debug"
solutionPath = "VC 솔류션 (sln 파일) 경로"
solutionLogPath = "컴파일 결과가 저장될 로그 경로"

devEnvCmd = '%(devEnvPath)s "%(solutionPath)s" /build %(configName)s /out "%(solutionLogPath)s"' % locals()
devEnvProc = subprocess.call(devEnvCmd)


devenv 의 실행 결과는 stdout 으로 출력되는 것이 아니라 로그 파일로 저장됩니다.

그러므로 일단 실행 시켜놓은 다음 로그 파일을 계속 체크하면서
내용을 화면에 뿌려주어야 합니다. (tail -f log.txt 같은 기능을 만들어야 합니다)


def DevEnv_Compile(devEnvPath, solutionPath, configName, interval=0.5):
"VC2005 컴파일"
solutionHead, ext = os.path.splitext(solutionPath)
solutionLogPath = solutionHead + ".log"

# 로그 파일이 존재한다면 삭제한다 (삭제가 안된다면 이미 실행중일 가능성이 높음)
if os.access(solutionLogPath, os.R_OK):
if not RemoveFile(solutionLogPath):
print("DEVENV.MAY_BE_ALREADY_RUNNING")
return

# 컴파일러 실행
devEnvCmd = '%(devEnvPath)s "%(solutionPath)s" /build %(configName)s /out "%(solutionLogPath)s"' % locals()

print("compile:")
print("\t%s" % devEnvCmd)
devEnvProc = RunProcess(devEnvCmd)

try:
print "\twait_for_logging"
while devEnvProc.poll() is None:
if os.access(solutionLogPath, os.R_OK):
break
else:
time.sleep(interval)

print "\tstart"
logFile = open(solutionLogPath)
while devEnvProc.poll() is None:
oldPos = logFile.tell()
line = logFile.readline()
if line:
print("\t%s" % line.rstrip())
else:
time.sleep(interval)
logFile.seek(oldPos)
print "\tend"
except KeyboardInterrupt:
print("\tstop")
KillProcess(devEnvProc)


devenv 는 별도 프로세스로 실행되므로,
파이썬 스크립트가 중단되어도 devenv 는 종료되지 않습니다.

그러므로 ctrl+c 같은 예외 상황이 발생하면 아래에서 만든 KillProcess 로
devenv 를 종료시켜주어야 합니다.

이올린에 북마크하기(0) 이올린에 추천하기(0)
2009/02/04 15:55 2009/02/04 15:55
파이썬의 프로세스 중단은 os.kill 이지만 윈도우에서는 작동하지 않습니다.
그러므로 ctypes 를 이용해 프로세스 종료 함수를 만들어주어야 합니다.


import ctypes

KERNEL32 = ctypes.windll.kernel32

def RunProcess(cmd):
"프로세스 실행"
return sp.Popen(cmd)

def KillProcess(proc):
"프로세스 종료"
KERNEL32.TerminateProcess(int(proc._handle), -1)

proc = RunProcess("실행파일명 인자1 인자2")
raw_input()
KillProcess(proc)


참고:
http://code.activestate.com/recipes/347462/
이올린에 북마크하기(0) 이올린에 추천하기(0)
2009/02/04 15:47 2009/02/04 15:47