'Programming/Visual Studio'에 해당되는 글 6건

  1. 2010.01.13 error LNK2005:
  2. 2010.01.13 error LNK2059
  3. 2010.01.13 error LNK1104 1
  4. 2010.01.13 error LNK2019 fatal, error LNK1120
  5. 2009.12.19 VisualStudio 메모리 누수 체크 사용하기
  6. 2009.12.19 error LNK2005: 에러

 

문제 소스

error 발생 원인

< 해결방법 1 >

< 해결방법 2 >

< AAA.h >

struct  AAA

{

int a;

int b;

}TEST;

 

 

< main.cpp >

#include "AAA.h"

void main()

{

TEST.a = 100;

}

 

 

 

 

< AAA.h >

struct  AAA

{

int a;

int b;

}TEST; 

 

 

< main.cpp >

#include "AAA.h"

void main()

{

TEST.a = 100;

}

 

< AAA.h >

struct  AAA

{

int a;

int b;

};

 

 

< main.cpp >

#include "AAA.h"

void main()

{

AAA TEST;

TEST.a = 100;

}

< AAA.h >

 

 

 

 

 

 

 

< main.cpp >

struct  AAA

{

int a;

int b;

}TEST;

 

void main()

{

TEST.a = 100;

}

'Programming > Visual Studio' 카테고리의 다른 글

error LNK2059  (0) 2010.01.13
error LNK1104  (1) 2010.01.13
error LNK2019 fatal, error LNK1120  (0) 2010.01.13
VisualStudio 메모리 누수 체크 사용하기  (0) 2009.12.19
error LNK2005: 에러  (0) 2009.12.19
Posted by 시그v

 

전역변수로 사용하던

float m_vStartPoint3D[3] = {0.0f, 0.0f, 0.0f};

float m_vEndPoint3D[3] = {0.0f, 0.0f, 0.0f};

 

이런 형태를

Class 하여

 

{

public:

float m_vStartPoint3D[3];

float m_vEndPoint3D[3];

.

.

.

}

 

생성자

{

m_vStartPoint3D[3] = {0.0f, 0.0f, 0.0f};

m_vEndPoint3D[3] = {0.0f, 0.0f, 0.0f};

.

.

.

}

형태로 바꾸었다.그런데 Error 발생

 

1>.\SourceFiles\AAA.cpp(18) : error C2059: syntax error : '{'

1>.\SourceFiles\AAA.cpp(18) : error C2143: syntax error : missing ';' before '{'

1>.\SourceFiles\AAA.cpp(18) : error C2143: syntax error : missing ';' before '}'

1>.\SourceFiles\AAA.cpp(19) : error C2059: syntax error : '{'

1>.\SourceFiles\AAA.cpp(19) : error C2143: syntax error : missing ';' before '{'

1>.\SourceFiles\AAA.cpp(19) : error C2143: syntax error : missing ';' before '}'

 

해결방법은 {0.0f, 0.0f, 0.0f} -> (0.0f, 0.0f, 0.0f) 형태로 바꿔준다.

'Programming > Visual Studio' 카테고리의 다른 글

error LNK2005:  (0) 2010.01.13
error LNK1104  (1) 2010.01.13
error LNK2019 fatal, error LNK1120  (0) 2010.01.13
VisualStudio 메모리 누수 체크 사용하기  (0) 2009.12.19
error LNK2005: 에러  (0) 2009.12.19
Posted by 시그v

 

LINK : fatal error LNK1104: cannot open file '(...생략...).intermediate.manifest'

< error 발생 원인 >

dll파일이 생성 되는 위치를 변경 발생 하였다.

해결방법은 dll파일이 있는 경로로 바꿔 주면 된다.


 < 해결 방법 >

  1. dll파일경로를  ./bin/경로로 변경 하였다고 한다면
    Project -> Property -> Linker -> Manifest File -> Manifest File 에서

(기존경로).intermediate.manifest -> ./bin/(기존경로).intermediate.manifest 변경하면 된다.

 

  1. manifest파일을 생성하지 않게 하는 방법

Project -> Property -> Linker -> Manifest File -> Generate Manifest

Yes에서 No 변경한다.

'Programming > Visual Studio' 카테고리의 다른 글

error LNK2005:  (0) 2010.01.13
error LNK2059  (0) 2010.01.13
error LNK2019 fatal, error LNK1120  (0) 2010.01.13
VisualStudio 메모리 누수 체크 사용하기  (0) 2009.12.19
error LNK2005: 에러  (0) 2009.12.19
Posted by 시그v

 

참고  <http://edible.egloos.com/1240411>
LNK2019, LNK1120 Error 발생이유...

1. 헤더를 include 하고 프로젝트에 헤더 .cpp 포함하지 않을 경우...

2. .h .cpp 함수원형 함수호출을 해놓고 정작 함수 구현을 했을 경우...

3. .c .cpp 프로젝트에서 같이 사용할 .h include하고 .cpp include 하지 않을 경우...


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

-aaa.h-

void CheckLNK2019(int ntest);

-aaa.cpp-

void LNK2019Test() {

CheckLNK2019(nTemp);

}

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



< 내가 실수한 부분 >
-test.h-

class test

{

void CheckLNK2019(int ntest);

};

-test.cpp-

void test::LNK2019Test() {       test:: =>이걸 빼먹었다;;;

            (생략)

}

'Programming > Visual Studio' 카테고리의 다른 글

error LNK2005:  (0) 2010.01.13
error LNK2059  (0) 2010.01.13
error LNK1104  (1) 2010.01.13
VisualStudio 메모리 누수 체크 사용하기  (0) 2009.12.19
error LNK2005: 에러  (0) 2009.12.19
Posted by 시그v

MFC를 사용하여 프로그램을 개발하고 있다면,

#ifdef _DEBUG
#define new
DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif


위의 코드를 .cpp 화일에 넣어 프로그램이 종료 되었을때 아래와 같이 누수된 메모리를 할당하는 부분의 소스 코드와 라인 수를 출력 해준다.

Detected memory leaks!
Dumping objects ->
d:\sample\sample.cpp(35) : {48} client block at 0x003739D0, subtype 0, 4 bytes long.
 Data: <(   > 28 00 00 00
d:\sample\sample.cpp(34) : {47} client block at 0x00373990, subtype 0, 4 bytes long.
 Data: <    > 1E 00 00 00
Object dump complete.


위의 예에서는 두 블록의 메모리 누수가 검출 되었는데 각 라인의 의미는

 

 



d:\sample\sample.cp (35) : {48} client block at 0x003739D0, subtype 0, 4 bytes long.


sample.cpp 화일의 35번째 라인에서 할당된 메모리가 누수되었고 그것은 48번째로 할당된 메모리이며 메모리 주소는 0x003739d0, 4Byte가 누수되었다는 의미로 해석할 수 있다.

MFC를 사용하지 않은 프로그램의 경우 위의 DEFINE 문으로는 DEBUG_NEW를 찾을 수 없다는 컴파일 에러를 내뱉는데 그 경우엔 위의 DEFINE 문과 함께 아래와 같은 라인을 헤더에 삽입해서 해결할 수 있다.

#if !defined(_AFXDLL)
   #include <windows.h>
   #include <crtdbg.h>
   #if defined(DEBUG) | defined(_DEBUG)
      #if !defined(DEBUG_NEW)
         #define DEBUG_NEW new(_CLIENT_BLOCK, __FILE__, __LINE__)
      #endif
   #endif
#endif


DEBUG_NEW를 새로이 정의함으로써 DEBUG_NEW를 찾을 수 없는 문제를 해결한다.

간혹 malloc 을 이용한 메모리 할당은 위의 내용이 적용이 되질 않는데 이 경우엔 아래의 문장을 소스코드에 삽입한다.

- 헤더 화일에는 아래라인을 추가
#define DEBUG_MALLOC(size) _malloc_dbg(size, _NORMAL_BLOCK, __FILE__ , __LINE__)

- malloc을 재정의 하려는 소스 코드에 아래 라인을 추가.
#define malloc DEBUG_MALLOC


위의 방법들로 memory leak dump 에서 할당된 소스 코드와 라인수를  바로 찾을 수 있다.

 

 

[펌] 개발자의 끄적임 http://cromit.tistory.com/6

'Programming > Visual Studio' 카테고리의 다른 글

error LNK2005:  (0) 2010.01.13
error LNK2059  (0) 2010.01.13
error LNK1104  (1) 2010.01.13
error LNK2019 fatal, error LNK1120  (0) 2010.01.13
error LNK2005: 에러  (0) 2009.12.19
Posted by 시그v

error LNK2005: "public: __thiscall Cdefine::Cdefine(void)" (??0Cdefine@@QAE@XZ) already defined in Fluid_Simulation_menu.obj

error LNK2005: "public: __thiscall Cdefine::~Cdefine(void)" (??1Cdefine@@QAE@XZ) already defined in Fluid_Simulation_menu.obj

 

헤더 파일에 함수의 정의해서 그렇다.

에러를 보면 Cdefine(void)와 ~Cdefine(void) 함수가 헤더파일에 정의되어서 뜨는 에러이다.

'Programming > Visual Studio' 카테고리의 다른 글

error LNK2005:  (0) 2010.01.13
error LNK2059  (0) 2010.01.13
error LNK1104  (1) 2010.01.13
error LNK2019 fatal, error LNK1120  (0) 2010.01.13
VisualStudio 메모리 누수 체크 사용하기  (0) 2009.12.19
Posted by 시그v
이전버튼 1 이전버튼

블로그 이미지
Computer graphics & Programming
시그v

공지사항

Yesterday
Today
Total

달력

 « |  » 2024.4
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30

최근에 올라온 글

최근에 받은 트랙백

최근에 달린 댓글

믹시