>> 에러 메시지

LCSManager.obj : error LNK2001: "class CMsgProcess theMsgProcess" (?theMsgProcess@@3VCMsgProcess@@A) 외부 기호를 확인할 수 없습니다.


>> 원인

LCSManager.h 파일에 extern CMsgProcess theMsgProcess; 선언

다른 .cpp에서 theMsgProcess 를 사용하기 위해서 #include "LCSManager.h" 만 추가 후 사용

컴파일 시 error LNK2001


>> 해결 방법

LCSManager.cpp 파일에 CMsgProcess theMsgProcess; 추가


>> 설명

컴파일 단계에서의 extern 선언은 그냥 이름일 뿐이고 구체적인 주소는 정해지지 않은 상태

구체적인 주소를 정해주는 것은 링크 단계


>> 결론

기초 공부를 다시 좀 하자!!!

컴파일러, OS, 자료구조, 알고리즘

뼈가되고 살이되는 기본기가 부족해...

안정적인 DNS서비스 DNSEver DNS server, DNS service
Posted by 키르히아이스
,

참고 : http://stackoverflow.com/questions/30430789/c-hash-deprecation-warning

VS2015 에서 이전 버전 VS 프로젝트 컴파일 시 hash_map 에러 발생 : C2338

IntelliSense: static assertion failed with "<hash_map> is    
deprecated and will be REMOVED. Please use <unordered_map>. You can define
_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS to acknowledge that you have 
received this warning."
Error   C2338   <hash_map> is deprecated and will be REMOVED. Please use 
<unordered_map>. You can define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS to 
acknowledge that you have received this warning.    


프로젝트 속성 -> C/C++ -> 전처리기에 아래 항목 추가

_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS=1;


안정적인 DNS서비스 DNSEver DNS server, DNS service
Posted by 키르히아이스
,

참고 : http://www.gpgstudy.com/forum/viewtopic.php?p=66294


>> 동적 DLL 사용할 때 LNK2019 에러 발생

error LNK2019: "__declspec(dllimport) public: ~~~


=================================================================================


>> DLL 로직

#ifdef DLLEXPORT     #define DLL_API __declspec(dllexport) #else     #define DLL_API __declspec(dllimport) #endif

class DLL_API cBase { cBase();
virtual cBase();
};

>> 동적 DLL의 lib 파일을 추가 해 줘야 함

#include "Base.h" #pragma comment(lib,"Base.lib") class cChild : public cBase { cChild(); virtual cChile(); };


안정적인 DNS서비스 DNSEver DNS server, DNS service
Posted by 키르히아이스
,


1. cppcheck 다운 및 설치

http://sourceforge.net/projects/cppcheck/


2. Visual Studio 설정

- [도구(T)] -> [외부 도구(E)] -> [추가]


3. 인수

--enable=all --enable=style -q --template vs $(ProjectDir)


-j [job count] : multithread로 체크


>> 파일 검사

Arguments : -j 8 --enable=warning,style,performance,portability,information --std=c++11 --inline-suppr --quiet --template="{file}({line}): {severity} ({id}): {message}" $(ItemPath)


>> 프로젝트 검사

Arguments : -j 8 --enable=warning,style,performance,portability,information --std=c++11 --inline-suppr --quiet --template="{file}({line}): {severity} ({id}): {message}" $(ProjectDir)


4. cppcheck 실행

- cppcheck 실행할 프로젝트 선택 후 [도구(T)] -> [cppcheck] 실행 하면 VS 출력창에 결과 출력



>> cppcheck 주요 검수 항목

 - 배열 인덱스 참조 위반

 - 생성자가 없는 클래스

 - 생성자가 초기화하지 않는 변수

 - 잘못된 메모리 초기화

 - 베이스 크래스의 소멸자는 가상 함수로 선언하지 않는 경우

 - 사용하지 않는 private 함수

 - operator= 가 self의 레퍼런스를 반환하지 않는 경우

 - operator= 가 자신과 동일한 타입의 객체를 할당하지 않는 경우

 - obsolete (폐기된) 함수(mktemp, gets, scanf)를 사용하는 경우

 - 메모리 누수

 - sprintf를 잘못 사용하는 경우

 - 숫자를 0으로 나누는 경우

 - null 포인터를 역참조 하는 경우

 - 초기화하지 않은 변수나 데이터를 사용하는 경우

 - 입력 스트림에 fflush()를 사용하는 경우

 - memset, memcpy 등이 클래스에서 사용될 때 경고



안정적인 DNS서비스 DNSEver DNS server, DNS service
Posted by 키르히아이스
,