g++

undefined reference to symbol even when nm indicates that this symbol is present in the shared library 2

本秂侑毒 提交于 2019-12-23 06:04:07
问题 I found same question here but the answer doesn't help me. I'm writing test app to use nglib library. But when I try to compile it I get undefined references: $ g++ test1.cpp -L. -lnglib test1.cpp: In function ‘int main()’: /tmp/cchcKZfx.o:test1.cpp:function main: error: undefined reference to 'Ng_Init()' /tmp/cchcKZfx.o:test1.cpp:function main: error: undefined reference to 'Ng_NewMesh()' ... /tmp/cchcKZfx.o:test1.cpp:function main: error: undefined reference to 'Ng_Exit()' collect2: ld

undefined reference to symbol even when nm indicates that this symbol is present in the shared library 2

蓝咒 提交于 2019-12-23 06:03:58
问题 I found same question here but the answer doesn't help me. I'm writing test app to use nglib library. But when I try to compile it I get undefined references: $ g++ test1.cpp -L. -lnglib test1.cpp: In function ‘int main()’: /tmp/cchcKZfx.o:test1.cpp:function main: error: undefined reference to 'Ng_Init()' /tmp/cchcKZfx.o:test1.cpp:function main: error: undefined reference to 'Ng_NewMesh()' ... /tmp/cchcKZfx.o:test1.cpp:function main: error: undefined reference to 'Ng_Exit()' collect2: ld

How to pass a string type path to boost::filesystem:path's constructor?

假如想象 提交于 2019-12-23 05:45:10
问题 I have the following class using boost filesystem, but encountered the problem when compiling. /// tfs.h file: #include <boost/filesystem.hpp> #include <iostream> #include <string> using namespace boost; using namespace std; class OSxFS { public: OSxFS(string _folderPath) { mFolderPath(_folderPath); } string ShowStatus() { try { filesystem::file_status folderStatus = filesystem::status(mFolderPath); cout<<"Folder status: "<<filesystem::is_directory(folderStatus)<<endl; } catch(filesystem:

Can't run executables from nautilus

守給你的承諾、 提交于 2019-12-23 05:17:59
问题 (the warning that shows up) On Ubuntu 18.04, I compiled a c++ sample which only included stdio.h and an empty main function using g++ test.cpp -o test . No errors popped up and I had no issues running it from the terminal. However, once I go on nautilus and try to run it by clicking on test , a warning pops up, asking me to pick a program to open the shared library. How do I make sure the program is compiled as an executable/ is seen as an executable by the file manager? Edit: stat output on

G++ and LTO: how to separate declaration and definition?

笑着哭i 提交于 2019-12-23 04:57:15
问题 Since LTO can resolve inline symbols from other object files, I tried to separate declaration and definition for inline functions. Here is the 3 files, dep.hpp , dep.cpp and main.cpp , where main.cpp and dep.cpp are linked together and dep.hpp is #include d in both: // dep.hpp, declaration #ifndef _DEP_HPP_ #define _DEP_HPP_ inline void sayHello(); #endif // dep.cpp, definition #include "dep.hpp" #include <iostream> inline void sayHello() { std::cout << "Hello World!" << std::endl; } // main

g++ with DevIL: unable to link

房东的猫 提交于 2019-12-23 04:29:31
问题 Firstly, I am using Fedora and learning OpenGL. I would like to work with DevIL a little, so I installed both DevIL and DevIL-ILUT packages from the official repository. I have a test code for loading and rendering a file available, so I decided to test it (I will be learning some DevIL basics at my course, and we were given that file to make sure DevIL works fine for us). The file contains line: #include "IL/devil_cpp_wrapper.hpp" so I copied the IL directory (which we also have available)

Linking FORTRAN and C++ objects files

為{幸葍}努か 提交于 2019-12-23 04:14:07
问题 I am going to call a C++ function from FORTRAN, for which I am using ISO_C_Binding module. After compaction of the FORTRAN main file and C++ function with commands gfortran -c mlp8.f90 g++ -c mean_cpp.cc Which will create the objects files but in the linking phase as suggested by some members I am going to use the commands g++ mlp8.o mean_cpp.o -o main –lgfortran I.e. using C++ compiler with linking to FORTRAN libraries but it gives error like /Cygnus/cygwin-b20/H-i586-cygwin32/i586-win32/bin

Variable dissapears in binary which is available in static lib

拥有回忆 提交于 2019-12-23 03:27:30
问题 I have the problem mentioned. I create an object inside a static lib, it is there when I run nm on the static lib, but when i link the lib to a binary and run nm it has disappeared. I know this problem has been asked before, but I could not find any answers. It is important for me to be able to retain that variable in the binary because we are trying to implement version checks for static libs in a binary. Please help. Thank you. Example code follows: test.h #ifndef TEST_H #define TEST_H

How to specialize a templated member-function into a templated class in C++?

二次信任 提交于 2019-12-23 03:14:34
问题 With regards to this question: How to create specialization for a single method in a templated class in C++? ... I have this class: template <typename T> class MyCLass { public: template <typename U> U myfunct(const U& x); }; // Generic implementation template <typename T> template <typename U> U MyCLass<T>::myfunct(const U& x) {...} And I want to specialize myfunct for double s. This is what I do: // Declaring specialization template <> template <typename T> double MyCLass<T>::myfunct(const

Visual Studio 2008 awful performance

不问归期 提交于 2019-12-23 03:14:08
问题 I have ported a piece of C++ code, that works out of core, from Linux(Ubuntu) to Windows(Vista) and I realized that it works about 50times slower on VS2008! I removed all the out of core parts and now I just have a piece of code that has nothing to do with the hard disk. I set compiler parameters to O2 in Project Properties but still get about 10times slower than g++ in linux! Does anybody have an idea why it is this much slower under VS? I really appreciate any kind of hint! Thanks, 回答1: Do