Troubleshooting2010. 12. 14. 12:24
발생했던 문제점들에 대한 해결 방법들을 공유합니다.

- boost
    - 1_44_0으로 갈아탐

- 변환시 vcproj 패스 설정 오류
    - Property Manager > Common Properties > User Macro의 경로중 하나가 잘못 컨버팅되서 재조정.
    - Ex) D:XXX/YYY/ZZZ/ZZZ 처럼... 2010으로의 자동 변환 후에 ZZZ가 두번 들어가 있었음.

- vs2010 error C2039: 'back_insert_iterator'
    - 인클루드 코드 삽입: #include <iterator>
    - PCH에 넣어도 되고, 에러가 난 파일의 헤더에 넣어도 되고~
   
- warning MSB8012: TargetPath does not match the Library's OutputFile property value
    - 이름을 맞춰줌
        - Property Page > Configuration Properties > General - Target Name과 Target Extension
        - Property Page > Configuration Properties > Librarian > General - Output File
    - http://blog.kalmbach-software.de/2010/04/27/converting-vc-projects-to-vc2010-warning-msb8012/
   
- Constructor for class 'Foo' is declared 'explicit'
    - 참조나 포인터가 아닌 객체로 함수의 인자가 되는 경우, 복사 생성이 암시적으로 발생하는데...
    - 복사생성자가 explicit으로 되어있을 경우, 2010에서는 error처리를 해준다. 땡큐!
    - 2010전에는 이것을 error로 처리 안 해줘서 그냥 넘어갔었고, 그래서 잘못된 것인지도 몰랐던거임. -_-;
   
- queue
    - queItems.c.clear()를 사용하고 있는 코드 발견 -_-;;;
    - Queue에 swap이 없긴 하지만, 저런식의 사용은 안 좋다고 본다.
    - 다른 방식으로 clear 할 수 있다
        - queItems.swap( queue<int>() ); 
        - std::swap( m_InfoQue, queue<int>() );

- warning MSB4011:
    "D:\XXX\XXX-Props\KUF2_PhysicalPath.props" cannot be imported again.
    It was already imported at
    "D:\XXX\XXX-Props\KUF2_Paths.props (4,5)".
    This is most likely a build authoring error. This subsequent import will be ignored.
    - Property Manger를 열어서 경고가 뜬 프로젝트의 Property Sheet 참조를 확인 해본다.
    - 이 경우는 임포트가 두 번 되어서 무시하겠다는 건데, 삭제 해주니 해결되었음.

- error LNK2038: mismatch detected for ‘_ITERATOR_DEBUG_LEVEL’: value ‘0′ doesn’t match value ‘2′
    - http://stackoverflow.com/questions/4130044/what-does-iterator-debug-level-1-mean
         _ITERATOR_DEBUG_LEVEL = 0 (in release mode)
        _ITERATOR_DEBUG_LEVEL = 1 (in release mode if _SECURE_SCL is defined)
        _ITERATOR_DEBUG_LEVEL = 2 (in debug mode)        
    - http://blogs.msdn.com/b/vcblog/archive/2009/06/23/stl-performance.aspx
   
- #error _ITERATOR_DEBUG_LEVEL == 2 must imply _HAS_ITERATOR_DEBUGGING == 1 .
    - 코드가 아닌 곳에 디파인 되어 있을 수 있는데, 다음 2가지 경우가 있음.
      텍스트 검색으로 _HAS_ITERATOR_DEBUGGING을 찾아서 수동으로 변경.
        - 프로젝트 파일에 _HAS_ITERATOR_DEBUGGING이 0으로 디파인되어 있는 경우.
          Property Page > Configuration Properties > C/C++ > Preprocessor - Preprocessor Definitions
        - *.props 파일에 디파인되어 있을 수 있음.
        - Runtime Library가 일치하지 않는 프로젝트가 존재할 수 있음.
   
- XXX.lib(xxx.obj) : error LNK2019: unresolved external symbol
    - Menu > Project > Project Dependencies - 여기서 체크박스만 해주면 안되네;;
    - Menu > Project > Properties > Common Properties - Framework and References에서 Add New Reference... 눌러서 추가해 줘야함.
   
- 외부 라이브러리 2010으로 리빌드하면서 MSB8012 경고 잡아주기
    - yaml
    - loki
    - squirrel
    - sqplus

- libcpmtd.lib(xdebug.obj) : warning LNK4098: defaultlib 'libcmt.lib' conflicts with use of other libs; use /NODEFAULTLIB:library
    - Ignore Specific Default Libraries에 libcmt.lib 추가
    - 지금까진 libcmt를 무시하라는 에러메세지가 뜬다고 해도 다른 방법으로 해결했었는데, 이번엔 잘 모르겠음;; 그냥 추가;;
    - Properties > Configuration Properties > Linker > Input - Ignore Specific Default Libraries
   
- warning C4717: 'SquirrelObject::Set<SquirrelObject>' : recursive on all control paths, function will cause runtime stack overflow   
    - 템플릿 매치 우선순위에 대한 문제였습니다.        
        - http://stackoverflow.com/questions/4427683/template-functions-priority-is-diferent-between-vs2005-and-vs2010
        - VS2005와 VS2010에서의 결과가 다릅니다.
        - Foo(const Foo&); ? Foo(Foo&) 로 변경해서 해결
    - 어쨌든 좀 혼란스러운 점이 있는데, 이를 C++ committee에서 곧 결정할 것이고, VS2010에서 이를 바로 반영한다고 합니다.

- :VCEnd" exited with code 1.
    - Exit code 1 indicates ~~~ path is not correct.
    - Post-Build Event에서 copy 명령이 있는데, 거기서 문제 발생.
    - 1이라는 말은 경로가 잘 못되어 있다는 말임. 경로 바꿔주고 해결.
    - 위에 기술된 warning MSB8012을 해결하기 위해서 경로들을 바꾸다 보니 발생했음.   

- LINK : fatal error C1047: The object or library file 'D:\XXX\YYY\ZZZ.lib' was created with an older compiler than other objects; rebuild old objects and libraries
    - ZZZ.lib 또는 ZZZ.lib가 쓰는 xxx.lib가 2010에서 빌드된 lib이 아니란 말.
    - 해당 라이브러리 빌드하면 해결됨.


[ 참조 ]

- Visual Studio 2010 C++ Project Upgrade Guide
    - http://blogs.msdn.com/b/vcblog/archive/2010/03/02/visual-studio-2010-c-project-upgrade-guide.aspx

- VS2010의 새로운 기능
    - 한: http://msdn.microsoft.com/ko-kr/library/dd465215.aspx
    - 영: http://msdn.microsoft.com/en-us/library/dd465215.aspx

- auto 사용
    - 추가 옵션 창에서 설정해 줘야함
    - Menu > Project > Properties > Configuration Properties > C/C++ > Command Line
        - Additional Options에서 다음을 입력 ( /Zc:auto )
    - ...하지만 설정 안 해줘도 됨 -_-; /Zc:auto- 하기 위해서는 설정해야할 것 같음.
    - http://msdn.microsoft.com/en-us/library/dd293615.aspx

- XP를 지원하기 위해 _WIN32_WINNT는 0X0501으로 정의
    - http://msdn.microsoft.com/en-us/library/aa383745(v=vs.85).aspx

- Tools > Options > Projects and Solutions > VC++ Project Settings - Build Timinig의 정보가 좀 더 자세하게 변경되었음
Posted by codevania
Tip2010. 12. 3. 16:14

방법은 이 곳을 참조
http://msdn.microsoft.com/en-us/library/xcb2z8hs.aspx


위 링크에서 만든 함수의 이름은 SetThreadName이다.
문제는 금방 생성한 스레드에 대해서 SetThreadName을 호출하면,
 스레드의 이름이 설정될 때도, 그렇지 못할 때도 있다는 것이다.

스레드의 이름을 설정하는 것에는 SetThreadName이 호출되는 시점이 매우 중요하다.
스레드가 정말 생성된 시점에서 SetThreadName을 호출하지 않으면 스레드 이름 설정이 안된다.
왜냐하면 스레드 생성 함수를 사용한다고 해서, 바로 스레드가 만들어 지는 것이 아니기 때문이다.


그래서 어떻게 해야된다는 말인고 하니...
이렇게 하면 안되고~

이렇게 해야 한다는 말이다.

'Tip' 카테고리의 다른 글

SEH  (0) 2011.03.31
Rvalue References and Perfect Forwarding  (0) 2011.01.12
Remote Debugging  (0) 2010.11.23
IsNaN  (0) 2010.11.02
Failed to create .NET Frameworks PropertyGrid component  (0) 2010.08.20
Posted by codevania
Troubleshooting2010. 12. 3. 16:05
프로그램 실행중 갑자기 아래와 같은 에러 메세지를 내뱉는다면?
This Application has requested the Runtime to terminate it in an unusual way.
즉, 이런 다이얼로그 박스 말이다.


이 때 아마 난감할 것이다. 왜냐면 콜스택이 깨져있으니 말이다.


이런 상황은 십중팔구 abort() 때문인데, 왜 이렇게 되는지는 여기(날개의 기억)를 참조하도록 하자.


이때는 "Exception" Dialog에서 설정을 하면 예외 발생의 First chance에서 바로 잡을 수 있다.

- Menu > Debug > Exceptions... (Ctrl + Alt + E)
   아래 C++ Exceptions를 체크해 준다


- 이제부터는 그냥 디버깅 하다보면, 예외 발생시 브레이크 할 수 있다.
  그리고 우리가 원하는 예외 발생 시점에서의 콜스택을 얻을 수 있다.
  문제 해결 후에는 꺼주자... 아무래도 이게 활성화 되어있으면 좀 더 느려지겠지 ㅎ




'Troubleshooting' 카테고리의 다른 글

The procedure entry point Wmemcpy_s could not be located in msvcr100.dll  (0) 2011.01.11
Conversion from VS2005 to VS2010  (0) 2010.12.14
마일스 사운드 버그  (3) 2010.11.17
intrin.h errors  (0) 2010.10.28
using namespace std;  (0) 2010.10.27
Posted by codevania