一个工程,解决方案配置release win32,能够正常生成解决方案。添加一个新类,再次生成解决方案就出错了,错误:
Segment.obj : error LNK2019: 无法解析的外部符号 __imp___invalid_parameter_noinfo,该符号在函数 "public: __thiscall std::_Vector_const_iterator<struct CSegment::ATag,class std::allocator<struct CSegment::ATag> >::_Vector_const_iterator<struct CSegment::ATag,class std::allocator<struct CSegment::ATag> >(struct CSegment::ATag *,class std::_Container_base_aux const *)" (??0?$_Vector_const_iterator@UATag@CSegment@@V?$allocator@UATag@CSegment@@@std@@@std@@QAE@PAUATag@CSegment@@PBV_Container_base_aux@1@@Z) 中被引用2>.\Release/Elastography.exe : fatal error LNK1120: 1 个无法解析的外部命令
类CSegment的头文件Segment.h内部如下:#pragma once#include "float.h"
#include<vector>
using namespace std;class CSegment
{
typedef struct Graph
{
int iStart, iEnd;
BYTE weight;
}Graph; typedef struct ATag
{
int pnum;
int MaxEdgeWeight;
double mean, var;
}ATag;
typedef struct Aposition
{
int h1;
int h2;
int w1;
int w2;
int num;
}Aposition;public:
void Getpixeldata(BYTE *pixeldata,int inwidth,int inheight);
void BinaryandSection(BYTE nw,BYTE nh); //_二值化,分块
void ConstructGraph(int neighbor_relation); //_建图根据像素临边数(0,1,2,3)
void QuickSort(int left,int right); //_快速排序
void BeginRgbSegment(int neighbors,int k,double alpha);//_RGB分割,在存在_grayimg前提下
void ROIareas(); //_RGB分割后,_每个ROI图像块位置信息
public:
CSegment(void);
~CSegment(void);
public:
BYTE *data; //_像素数据
int height;
int width;
int  areanum; _区域数目
vector<Graph> graphs; //_图
vector<ATag> areaInfo; //_每个区域的信息
vector<Aposition> areaposition;//_每个区域的位置
int *pixelTag;     //_记录每个像素所属子区域号
};

解决方案 »

  1.   

    我把这个类(Segment.h和Segment.cpp内代码完全不变)添加到另外一个新建的MFC工程里,又能正常生成解决方案,这是怎么回事?
      

  2.   

    typedef struct ATag
    {
    int  pnum;
    int  MaxEdgeWeight;
    double mean, var;
    }ATag;typedef struct Aposition
    {
    int  h1;
    int  h2;
    int  w1;
    int  w2;
    int  num;
    }Aposition;
    放到全局可能会好点。STL就是这样的,有时候换个位置就编译通过了。
    我也经常碰这样,以前很紧张的。后来淡定了。不是自己的问题