g++

gfortran undefined references

和自甴很熟 提交于 2019-12-24 14:50:27
问题 I'm trying to compile a program that depends on a lot of things. I use and modify the makefile provided to stand for my computer settings, but I keep getting a lot of undefined references in the last step of compilation. The command line that causes the troubles is: gfortran -o ../cosmomc ParamNames.o Matrix_utils.o settings.o IO.o cmbtypes.o Planck_like.o cmbdata.o WeakLen.o & bbn.o lrggettheory.o mpk.o bao.o supernovae.o HST.o SDSSLy-a-v3.o CMB_Cls_simple.o paramdef.o propose.o params_CMB.o

What does 0x4 from cmp 0x4(%esi),%ebx assembly instruction mean?

白昼怎懂夜的黑 提交于 2019-12-24 13:12:44
问题 What does 0x4 from the following assembly line mean? cmp 0x4(%esi),%ebx je ... When this compare returns equal and the jump is performed the registers have the values: %esi 0xe944d6d0 %ebx 0xe94ceccc Sorry for asking such a simple question but I'm having a hard time searching such paranthesis notation with google. Spent more than half an hour while under time pressure. 回答1: That is AT&T syntax, in Intel syntax it would be: cmp ebx,[esi+4] Note that the order of operands is reversed. In Intel

Porting data serialization code from C++ linux/mac to C++ windows

此生再无相见时 提交于 2019-12-24 11:00:03
问题 I have a software framework compiled and running successfully on both mac and linux. I am now trying to port it to windows (using mingw). So far, I have the software compiling and running under windows but its inevitably buggy. In particular, I have an issue with reading data that was serialized in macos (or linux) into the windows version of the program (segfaults). The serialization process serializes values of primitive variables (longs, ints, doubles etc.) to disk. This is the code I am

Getting the size of a micro SD card via C++

我的梦境 提交于 2019-12-24 10:59:05
问题 I am looking for some function that will return the total capacity of a micro SD card mounted to /dev/sdb. I do not care so much about free space I care about total capacity of the drive. I need a reliable and accurate function. If there is none in existence how would I go about creating one? Thanks! 回答1: strace for blockdev tells me you could use: #include <iostream> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <sys/ioctl.h> #include <linux/fs.h> int main() {

Why does std::put_time not compile using multiple compilers?

丶灬走出姿态 提交于 2019-12-24 10:58:19
问题 std::put_time does not seem to work. The following snippet is taken directly from en.cpp.reference.com. #include <iostream> #include <iomanip> #include <ctime> int main() { std::time_t t = std::time(nullptr); std::tm tm = *std::localtime(&t); std::cout.imbue(std::locale("ru_RU.utf8")); std::cout << "ru_RU: " << std::put_time(&tm, "%c %Z") << '\n'; std::cout.imbue(std::locale("ja_JP.utf8")); std::cout << "ja_JP: " << std::put_time(&tm, "%c %Z") << '\n'; } Several compilers agree that put_time

How to debug a cmake/make project in VSCode?

坚强是说给别人听的谎言 提交于 2019-12-24 10:40:02
问题 I'm making a project and in order to assist in building, I'm using CMake . However, I notice that I can't debug. Here's my launch.json: { "version": "0.2.0", "configurations": [ { "name": "Debug", "type": "gdb", "request": "launch", "target": "./build/bin/CHIP8", "cwd": "${workspaceRoot}", "preLaunchTask": "build" } ] } And here's my tasks.json: { "version": "2.0.0", "tasks": [ { "label": "build", "type": "shell", "command": "cd build && cmake .. && make" } ] } I can't find anything online to

g++ Undefined reference static member variable

China☆狼群 提交于 2019-12-24 10:33:19
问题 I am Compiling this using g++ and a makefile. The g++ version is 4.1.2 20080704. Here is the simplified code which still contains the error: #ifdef __cplusplus extern "C" { #endif class MyClass { public: MyClass() {}; MyClass& operator=(MyClass&); static MyClass& instance() { return log; }; private: static MyClass log; }; //MyClass MyClass::log; int main() { MyClass& myClass = MyClass::instance(); return 0; } #ifdef __cplusplus } //extern "C" #endif When I compile with 'g++ MyClass.cpp" I get

C++ pthread member function [duplicate]

为君一笑 提交于 2019-12-24 10:24:51
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: pthread Function from a Class I have this code that I can't get to compile because of the pthread_create line: void* gtk_functor::_threaded_run(void* win) { Gtk::Window* w = static_cast<Gtk::Window*>(win); Gtk::Main::run(*w); delete w; } void gtk_functor::operator ()(Gtk::Window& win, bool threaded) { if (threaded) { pthread_t t_num; pthread_create(&t_num, NULL, (void* (*)(void*))&gtk_functor::_threaded_run,

Linking Cuda in C++ issue

江枫思渺然 提交于 2019-12-24 09:41:53
问题 I've searched existing questions, but I can't seem to solve this. I have a blur_mask.cc file with: #include <iostream> #include <ctime> #include <opencv2/highgui/highgui.hpp> #include <opencv2/gpu/gpu.hpp> #include <vector_types.h> #include <cuda.h> #include <cuda_runtime.h> extern "C" void gpuBlurMask(unsigned char* srcData, int srcStep, uchar3* dst, int dstStep, int width, int height, float *mask, int maskStep, int maskWidth, int maskHeight, int blockSize=16); using namespace std; using

Help using PCRE in C++

一笑奈何 提交于 2019-12-24 09:32:38
问题 this is my first time trying to build a C++ application, so I'm kind of lost. I've looked at some examples but I still dont really know what's wrong. #include <iostream> #include <stdio.h> #include <windows.h> #include <pcrecpp.h> #include <string> #include <cstring> using namespace std; int main() { char title[256]; char url[256]; string song, diff; HWND hwnd = FindWindow("WindowsForms10.Window.8.app.0.33c0d9d", NULL); GetWindowTextA(hwnd, title, 255); pcrecpp::RE re("^osu! - (.*) \\[(.*)\\]