我有一个项目,我一直在OS X上编码,我现在正试图在Windows上构建.我已经设置了MinGW,创建了一个makefile,经过大量的重复编译后,所有内容都会编译,但是当它到达链接器步骤时,会出现大量错误:
SourceFile.cpp:(.text+0x1809): undefined reference to 'glEnable@4'
Run Code Online (Sandbox Code Playgroud)
链接器命令,省略所有source.o名称是相当简单的:
g++ -lglu32 -lopengl32
Run Code Online (Sandbox Code Playgroud)
我也试过切换链接顺序,并包含.a文件的完整路径,所有给我相同的结果.在编译器步骤中使用_STDCALL_SUPPORTED和_M_IX86宏没有任何区别.
如果它是相关的,我正在使用GLee,我正在直接构建到我的程序中(虽然我也尝试了glew,并得到了相同的结果).
任何帮助,将不胜感激.
所以我在使用Fortran到C库时遇到了一些麻烦.现在,在我遇到问题之前,我可以告诉你我不能像某些论坛网站所建议的那样使用g2c.
现在,问题.当我尝试编译一个非常大的项目时,我得到以下内容:
[from the makefile...] g++ -L [~200 dirs] -l [~200 libs] -lf2c
/usr/lib/libf2c.so: undefined reference to 'MAIN__'
collect2: ld returned 1 exit status
make: *** [all] Error 1
Run Code Online (Sandbox Code Playgroud)
现在,我已经检查了我的/usr/lib目录并提出了以下内容:
$ locate libf2c
/usr/lib/libf2c.so
/usr/lib/libf2c.so.0
/usr/lib/libf2c.so.0.22
Run Code Online (Sandbox Code Playgroud)
至少,它就在那里.我用谷歌,告诉我进入...
sudo rm /usr/lib/libf2c.so && sudo ln -s /usr/lib/libf2c.a /usr/lib/libf2c.so
Run Code Online (Sandbox Code Playgroud)
...有助于.关于库的陈旧性的一些东西意味着gcc不再正确地链接到它,并且试图找到没有一个的主要方法.所以我做到了.但是,在我链接到.a库之后,g ++现在根本找不到库.
g++ -L [~200 dirs] -l [~200 libs] -lf2c
/usr/bin/ld: cannot find -lf2c
collect2: ld returned 1 exit status
make: *** [all] Error 1
Run Code Online (Sandbox Code Playgroud)
所以实际上我倒退了.任何人都有任何关于我应该从哪里去的想法?
编辑:所以我想我弄清楚了.我按照这个重新安装了libs.现在它神奇地不抱怨fortran main不存在.谢谢你的帮助.
我在Mac OS X上使用Qt 4.7和Cmake 2.8.3以及g ++ 4.2.1.
在我的一个文件中使用静态或全局变量时,我遇到了一个奇怪的链接器错误.这是错误:
ld: duplicate symbol ColorTrail::calculateColorUniformLocation in CMakeFiles/GLBall.dir/src/DesktopMain.cpp.o and CMakeFiles/GLBall.dir/src/ColorTrail.cpp.o
collect2: ld returned 1 exit status
Run Code Online (Sandbox Code Playgroud)
calculateColorUniformLocation是ColorTrail类的静态成员......但它甚至根本不在DesktopMain.cpp中使用!
这是我尝试过的:重命名变量并不能解决问题.将变量移出类并使其成为普通的全局变量也无法解决问题
文件ColorTrail.h:
#ifndef COLORTRAIL
#define COLORTRAIL 9
#include "GlobalConstants.h"
#include <vector>
using namespace std;
class ColorTrail
{
private:
//note that this is NOT a Q_OBJECT
static GLint calculateColorUniformLocation;
//omitted for brevity
};
GLint ColorTrail::calculateColorUniformLocation;
#endif
Run Code Online (Sandbox Code Playgroud)
DesktopMain.cpp使用ColorTrail类,但不是静态而且从不引用变量.
任何人都知道什么可能是错的/ Qt有类似的问题?
所以,我是C++的总菜鸟,我需要认真的帮助.我打赌一些普通用户这甚至不是问题,所以请帮助我.
我在Visual Studio Professional中将其写为Win32控制台文件.
#include <iostream>
using namespace std;
int main()
{
int i = 100;
return 0;
}
Run Code Online (Sandbox Code Playgroud)
在控制台中我得到以下内容:
1>------ Build started: Project: Project1_RenatoAlegre, Configuration: Debug Win32 ------
1>Build started 1/25/2012 3:09:03 PM.
1>InitializeBuildStatus:
1> Touching "Debug\Project1_RenatoAlegre.unsuccessfulbuild".
1>ClCompile:
1> All outputs are up-to-date.
1>ManifestResourceCompile:
1> All outputs are up-to-date.
1>MSVCRTD.lib(crtexew.obj) : error LNK2019: unresolved external symbol _WinMain@16 referenced in function ___tmainCRTStartup
1>c:\users\ren\documents\visual studio 2010\Projects\Project1_RenatoAlegre\Debug\Project1_RenatoAlegre.exe : fatal error LNK1120: 1 unresolved externals
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:03.37
========== …Run Code Online (Sandbox Code Playgroud) 我正在尝试在我的Xcode项目中使用glew,但我得到了这个: Apple Mach-O Linker (Id) Error... Undefined symbols for architecture x86_64
我正在使用我从sourceforge网站下载的当前版本的glew .

我有这个代码的问题,从现有的.lib(CryptoLib.lib)编写包装函数:
mycode.ccp
#include "stdafx.h"
#pragma managed(push, off)
#include "CryptoLib.h"
#pragma comment (lib, "CryptoLib.lib")
#pragma managed(pop)
using namespace System;//This is a C++-CLI project.
__declspec(dllexport) void Encrypt(unsigned char *Data, unsigned char *RandomNr)
{
CryptoLib_Encrypt(Data, RandomNr);
}
Run Code Online (Sandbox Code Playgroud)
cryptolib.h
#ifndef _CRYPTOLIB_H_
#define _CRYPTOLIB_H_
#define PUBLIC
//This procedure is written in c++ code
extern void CryptoLib_Encrypt(unsigned char *Data, unsigned char *RandomNr);
#endif /* _CRYPTOLIB_H_ */
Run Code Online (Sandbox Code Playgroud)
我已经连接了cryptolib.h和cryptolib,但我仍然得到"未解析的令牌Cryptolib_Encrypt"和"未解析的外部符号Cryptolib_Encrypt"错误.
谁能告诉我为什么?
谢谢你的帮助
确切的错误消息:
error LNK2028: unresolved token (0A000006) "void __cdecl CryptoLib_Encrypt(unsigned char *,unsigned char *)" (?CryptoLib_Encrypt@@$$FYAXPAE0@Z) referenced in function …Run Code Online (Sandbox Code Playgroud) 我正在尝试将Apptentive添加到IOS应用程序中.已经有相当多的外部库被使用,例如Admob和Google分析.
我按照这个指南来写这封信,但我不能让它融合.看到下面讨厌的失败信息:
Undefined symbols for architecture armv7:
"_kCTUnderlineStyleAttributeName", referenced from:
-[ATTTTAttributedLabel commonInit] in libApptentiveConnect.a(TTTAttributedLabel.o)
"_CTFontCopyName", referenced from:
___NSAttributedStringByScalingFontSize_block_invoke in libApptentiveConnect.a(TTTAttributedLabel.o)
"_CTFontGetSize", referenced from:
___NSAttributedStringByScalingFontSize_block_invoke in libApptentiveConnect.a(TTTAttributedLabel.o)
"_kCTForegroundColorFromContextAttributeName", referenced from:
_NSAttributedStringBySettingColorFromContext in libApptentiveConnect.a(TTTAttributedLabel.o)
___NSAttributedStringBySettingColorFromContext_block_invoke in libApptentiveConnect.a(TTTAttributedLabel.o)
"_CTFramesetterSuggestFrameSizeWithConstraints", referenced from:
-[ATTTTAttributedLabel textRectForBounds:limitedToNumberOfLines:] in libApptentiveConnect.a(TTTAttributedLabel.o)
-[ATTTTAttributedLabel sizeThatFits:] in libApptentiveConnect.a(TTTAttributedLabel.o)
"_CTFontGetUnderlineThickness", referenced from:
-[ATTTTAttributedLabel drawStrike:inRect:context:] in libApptentiveConnect.a(TTTAttributedLabel.o)
"_CTLineGetGlyphRuns", referenced from:
-[ATTTTAttributedLabel drawBackground:inRect:context:] in libApptentiveConnect.a(TTTAttributedLabel.o)
-[ATTTTAttributedLabel drawStrike:inRect:context:] in libApptentiveConnect.a(TTTAttributedLabel.o)
"_CTFrameGetLineOrigins", referenced from:
-[ATTTTAttributedLabel characterIndexAtPoint:] in libApptentiveConnect.a(TTTAttributedLabel.o)
-[ATTTTAttributedLabel drawFramesetter:attributedString:textRange:inRect:context:] in libApptentiveConnect.a(TTTAttributedLabel.o)
-[ATTTTAttributedLabel drawBackground:inRect:context:] in …Run Code Online (Sandbox Code Playgroud) 我正在尝试在我的Raspberry Pi A +上安装Neopixels库.起初我做了这个,并试图运行代码,但它不起作用.我再次重新安装Raspbian并仔细安装了标头和库我得到了这个:
> Downloading https://pypi.python.org/…/s…/s/setuptools/setuptools-5.7.zip
Extracting in /tmp/tmpkD2xEW
Now working in /tmp/tmpkD2xEW/setuptools-5.7
Building a Setuptools egg in /home/pi/rpi_ws281x/python
/home/pi/rpi_ws281x/python/setuptools-5.7-py2.7.egg
running install
running bdist_egg
running egg_info
creating rpi_ws281x.egg-info
writing rpi_ws281x.egg-info/PKG-INFO
writing top-level names to rpi_ws281x.egg-info/top_level.txt
writing dependency_links to rpi_ws281x.egg-info/dependency_links.txt
writing manifest file 'rpi_ws281x.egg-info/SOURCES.txt'
reading manifest file 'rpi_ws281x.egg-info/SOURCES.txt'
writing manifest file 'rpi_ws281x.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-armv6l/egg
running install_lib
running build_py
creating build
creating build/lib.linux-armv6l-2.7
copying neopixel.py -> build/lib.linux-armv6l-2.7
running build_ext
building '_rpi_ws281x' extension
swigging rpi_ws281x.i to rpi_ws281x_wrap.c
swig -python …Run Code Online (Sandbox Code Playgroud) 我是iOS的新手,并试图在Swift教程中使用AppGuru Facebook集成的项目中实现Facebook SDK.但是我在构建应用程序时遇到此链接器命令错误:
错误是找不到框架架构x84_64的螺栓(链接器命令失败,退出代码为1)
这是一个截图:

我正在按照本教程学习如何在Rust中创建一个非常基本的操作系统.这是我目前的状态:
Cargo.toml
[package]
name = "blog_os"
version = "0.1.0"
authors = ["Philipp Oppermann <dev@phil-opp.com>"] # Here I used my own details
[lib]
crate-type = ["staticlib"]
Run Code Online (Sandbox Code Playgroud)
SRC/lib.rs
#![feature(lang_items)]
#![no_std]
#[no_mangle]
pub extern fn rust_main() {}
#[lang = "eh_personality"] extern fn eh_personality() {}
#[lang = "panic_fmt"] #[no_mangle] pub extern fn panic_fmt() -> ! {loop{}}
Run Code Online (Sandbox Code Playgroud)
x86_64的-blog_os.json
{
"llvm-target": "x86_64-unknown-none",
"data-layout": "e-m:e-i64:64-f80:128-n8:16:32:64-S128",
"linker-flavor": "gcc",
"target-endian": "little",
"target-pointer-width": "64",
"target-c-int-width": "32",
"arch": "x86_64",
"os": "none",
"disable-redzone": true,
"features": "-mmx,-sse,+soft-float"
}
Run Code Online (Sandbox Code Playgroud)
这是Makefile. …