r******y 发帖数: 2 | 1 编译出错: error LNK2019: unresolved external symbol _random referenced in ...
error LNK2019: unresolved external symbol _srandom referenced in ...
我有#include , 为什么还会出这样的错呢?是不是在VC++ .net里编译C程序有
什么要特别设置的呢?我试过VC++ 6.0,碰到同样问题.
谢谢! |
|
k******n 发帖数: 35 | 2 有一个关于调用win32 dll的问题想请教大家。所用平台是win xp + VS2005.
自己写了一个win32 DLL,在VBA和VC++都测试成功。但是我想在同一个solution里测试
,也就是说在一个solution里有2个projects,一个是DLL,另一个是testor。想用
testor去调用DLL来测试,但是总也不成功。我在Testor里加了DLL作为reference和
dependency,而且在link的时候还链接了DLL。错误信息总是LNK2019: unresolved
external symbol _aa_sum@8 referenced (aa_sum是DLL中的一个函数)。
请大家指教,谢谢!
1>Compiling...
1>Tester.cpp
1>Linking...
1>Tester.obj : error LNK2019: unresolved external symbol _aa_sum@8
referenced in function _wmain
1>C:\programming\Storage\StorageDLL\Debug |
|
c******s 发帖数: 270 | 3 要被继承的类(DllObject)定义在Project A, 用DLL导出. 而子类(MyClass)定义在
Project B.
在Project A中, 我定义了宏MYDLL_BUILD.
// Config_Project_A.h
#if !defined(MYDLL_BUILD)
# pragma comment(lib, "myDll.lib")
#endif
#if defined(MYDLL_BUILD)
# define MYDLL_API __declspec(dllexport)
#else
# define MYDLL_API __declspec(dllimport)
#endif
// DllObject.h
class MYDLL_API DllObject
{
public:
virtual ~DllObject() {}
protected:
DllObject() { m_count = 3; }
priv... 阅读全帖 |
|
n*******r 发帖数: 22 | 4 在Visual Studio上编译总是有错,哪位大侠能不能帮我看看是什么原因?
error LNK2019: unresolved external symbol "private: __thiscall
Singleton2::Singleton2(void)" (??0?$Singleton2@H@@AAE@XZ)
referenced in function "public: static class Singleton2 * __cdecl
Singleton2::GetInstance(void)" (?
GetInstance@$Singleton2@H@@SAPAV1@XZ)
// Singleton.h
template class Singleton2
{
private:
Singleton2(void);
~Singleton2(void);
Singleton2(const Singleton2&);
Singleton2& operator=(const Si... 阅读全帖 |
|
b*******g 发帖数: 57 | 5 感谢前辈csiscoder经过实测的耐心细致的回复!给一千个赞!
运行了您修改的程序,bug free!
不过,还有个问题请求指点:
如果我将程序分别存在.h和.cpp文件里,为何有这样的报错呢:“error LNK2019:
unresolved external symbol”
--------------------------------------------------------------------
LeetCode.h内容为:
#include
#include
#include
template
class Point {
public:
T x;
T y;
Point() : x(0), y(0) {}
Point(T a, T b) : x(a), y(b) {}
};
//Find k closest points to origin
template
vector > findkClosestPoints(... 阅读全帖 |
|
g*******s 发帖数: 59 | 6 friend ostream & operator <<(ostream &output, const Complex &rhs)
{
output<<"("<
return output;
}
can compile and run well;
however if inside class define
friend ostream & operator <<(ostream &output, const Complex &rhs);
outside class
template
ostream & operator <<(ostream &output, const Complex &rhs)
{
output<<"("<
return output;
}
ERROR:
main.obj : error LNK2019: unresolved external symbol |
|
y****e 发帖数: 23939 | 7 我的程序用到了openGL 1.3的几个函数,比如glLoadTransposeMatrix。这些函数声明
在glext.h里面。编译的时候没问题,但连接的时候出错:
error LNK2019: unresolved external symbol _glLoadTransposeMatrixf@4
referenced in function ....
我运行了glewinfo,显示可以支持到GL_VERSION_2_1。而这些函数是GL1.3里面的,按
理说应该没有问题啊。望不吝赐教,万分感激。 |
|
p***o 发帖数: 1252 | 8 I got a linking error:
>cl 1.cpp 2.cpp /EHsc
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.30319.01 for 80
x86
Copyright (C) Microsoft Corporation. All rights reserved.
1.cpp
2.cpp
Generating Code...
Microsoft (R) Incremental Linker Version 10.00.30319.01
Copyright (C) Microsoft Corporation. All rights reserved.
/out:1.exe
1.obj
2.obj
2.obj : error LNK2019: unresolved external symbol "int i" (?i@@3HA) referenc
ed in function _main
1.exe : fatal error LNK1120: 1 unresolved extern... 阅读全帖 |
|
y****e 发帖数: 23939 | 9 有几个函数象glDeleteBuffers, glGenBuffers在glext.h中declare,但编译时链接出
错:LNK2019。请不吝赐教。 |
|
m***x 发帖数: 492 | 10 Using VS2010, a class can be exported from DLL. the client can access it
without problem. when put it into a namespace, the client program has link
error: unsolved external objs...
Any idea? thanks
the dll header file is:
#pragma once
#ifndef ECONOMICS_API_DCL
#ifdef ECONOMICS_EXPORTS
#define ECONOMICS_API_DCL __declspec(dllexport)
#else
#define ECONOMICS_API_DCL __declspec(dllimport)
#endif
#endif
namespace Economics
{
class ECONOMICS_API_DCL InterestRate
{
publi... 阅读全帖 |
|
y****e 发帖数: 23939 | 11 首先,这个程序在Linux下用g++编译通过,没有任何问题。但是在Visual C++下编译时
,编译通过,但是出现下面链接错误:
error LNK2019: unresolved external symbol _gsl_vector_ptr referenced in
function "void __cdecl refalidf(struct gsl_vector const *,void *,struct gsl_
vector *)" (?refalidf@@YAXPBUgsl_vector@@PAXPAU1@@Z)
有这样两个函数:
1. static double refalifn(const gsl_vector * v, void *params)
2. static void refalidf(const gsl_vector * v, void *params, gsl_vector *
df)
问题出在第二个函数上。如果只有第一个函数,程序在VC++下也能编译链接通过。可是
这两个函数实在没有太大差别啊?难道是第二个函数有两个gsl_vector *指针?
谢... 阅读全帖 |
|
h**********c 发帖数: 4120 | 12 Just jumped a similar error of a project of my own:
LINK : debug\qtwagon2012.exe not found or not built by the last incremental
link; performing full link
Creating library debug\qtwagon2012.lib and object debug\qtwagon2012.exp
glwidget.obj : error LNK2019: unresolved external symbol "public: static
class qtLight * __cdecl qtLightSingleton::getInstance(void)" (?getInstance@
qtLightSingleton@@SAPAVqtLight@@XZ) referenced in fu
nction "public: void __thiscall GLWidget::slotLight3dMoveOrders(int,... 阅读全帖 |
|
y****e 发帖数: 23939 | 13 I paste the full code to if anybody can help me out.
the function refalifn and refalifnfast are good to compile on vc++.
But the function refalidf and refalifdf will have this LNK2019 error on vc++
. Same code compiles OK on g++. It must be some kind of restraint with
visual c++.
static double refalifn(const gsl_vector * v, void *params)
{
Dict *dict = (Dict *) params;
double x = gsl_vector_get(v, 0);
double y = gsl_vector_get(v, 1);
double a = gsl_vector_get(v, 2);
EMData *t... 阅读全帖 |
|
c*****m 发帖数: 1160 | 14 是一个5年旧的C++项目,一年前被移到VC2010里面,在Debug模式下很正常,所以现在
release 出去都是debug版本。
但是选择到Release下面编译就出错,出错的信息是:
Error 1 error LNK2019: unresolved external symbol __strdate_s
referenced in function "int __cdecl _strdate_s<32>(char (&)[32])" (??$_
strdate_s@$0CA@@@YAHAAY0CA@D@Z) C:\src\DebugLog.obj Perf
等500个类似错误。
出错信息所指的是 _strdate_、_strtime_s、strcat_s、sprintf_s等链接失败。这些
都是标准库函数啊,有include time.ht, string等,编译都已经通过了的。
我已经比较了在Debu状态下和Release状态下的link的参数:
Debug下:
/OUT:"C:\src\Debug \Perf.dll" /INCREMENTAL ... 阅读全帖 |
|