g++

Cannot compile mergevec.cpp from Haartraining tutorial

喜夏-厌秋 提交于 2020-01-02 04:40:27
问题 I have been following this tutorial ( http://note.sonots.com/SciSoftware/haartraining.html ) to do some Haar training. I am currently stuck on creating the training samples, specifically the combining of the .vec files. I am provided with this ( http://note.sonots.com/SciSoftware/haartraining/mergevec.cpp.html ) file and a description of how to build it for Linux (Ubuntu 11.04). Here lies my problem, I am unable to build the mergevec code. The only error is "fatal error: cvhaartraining.h: No

How the code run when exist override ambigous function?

…衆ロ難τιáo~ 提交于 2020-01-02 04:06:28
问题 I can not fully understand the code result when exist override ambigous function. I have a libray libMy , which contains two class A and B . The code shows as follows // A.h #ifndef included_A_h #define included_A_h class A { public: void print(); }; #endif // A.cpp #include "A.h" #include <iostream> void A::print() { std::cout << "A from library" << std::endl; } // B.h #ifndef included_B_h #define included_B_h class A; class B { public: void printA(A &a); }; #endif // B.cpp #include "B.h"

GCC/LD cannot find link library

女生的网名这么多〃 提交于 2020-01-02 03:34:51
问题 OS: Windows 7 Enterprise x64 IDE: Eclipse Juno/CDT Compiler: MinGW 4.6.2 (C:\MinGW) Like user697111, I cannot get ld.exe to find an external library. Simple programs compile and link fine, but when I try to add SQL funcionality with the supplied library, I get this error message in Eclipse: "c:/mingw/bin/../lib/gcc/mingw32/4.6.2/../../../../mingw32/bin/ld.exe: cannot find -lC:\MinGW\lib\libodbc32.a". I specified C:\MinGW\lib as the Project Library Path. I specified C:\MinGW\lib\libodbc32.a as

What files are actually included when compiling

ぃ、小莉子 提交于 2020-01-02 02:31:05
问题 I have a very large code, a lot of which is legacy code. I want to know which of all these files are taking part in the compilation. The code is written in GNU compilers and mostly in C/C++, but some in other programs too. Any advice will be highly appreciated. Thanks, Moshe. I am compiling under linux with a mix of scripts/makefiles. I want to somehow 'wrap' this build with a tool which will give an output of all the source files used in the build, preferably with absolute path names. What

How to avoid multiple definition linking error?

左心房为你撑大大i 提交于 2020-01-02 02:20:31
问题 Beside moving the hello() function into another source (.cpp) file or renaming the function. Is there any other methods to avoid the linking error? staticLibA.h #ifndef _STATIC_LIBA_HEADER #define _STATIC_LIBA_HEADER int hello(void); int hello_staticLibA_only(void); #endif staticLibA.cpp #include "staticLibA.h" int hello(void) { printf("\nI'm in staticLibA\n"); return 0; } int hello_staticLibA_only(void) { printf("\nstaticLibA: hello_staticLibA_only\n"); return 0; } output: g++ -c -Wall -fPIC

g++ compile error

不羁岁月 提交于 2020-01-02 02:01:39
问题 I'm a newbie in Ubuntu. I tried to compile a simple "Hello World!" c++ code in Ubuntu 11.04, with that code (in terminal): gcc -Wall -W -Werror tex.cpp -o tex. but compiler returned a lot of errors : /tmp/ccL8c1p8.o: In function `main': tex.cpp:(.text+0xa): undefined reference to `std::cout' tex.cpp:(.text+0xf): undefined reference to `std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)'

C++ Error “failure: locale::facet::_S_create_c_locale name not valid” when running program from command line

帅比萌擦擦* 提交于 2020-01-01 11:52:08
问题 I seem to have a problem with locales in C++. When I run my programm from within Eclipse, it all works fine. However, when I try to run from the command line, I keep getting this error: failure: locale::facet::_S_create_c_locale name not valid This is the code that triggers the error: // Set up UTF8 file stream string fileName = "./sz.txt"; wifstream inFileStream; try { setlocale(LC_ALL, ""); inFileStream.open(fileName.c_str()); inFileStream.imbue(locale("")); if(!inFileStream) { return EXIT

std::vector<std::string> crash

孤街醉人 提交于 2020-01-01 10:48:45
问题 This question is continuation of my question. Here is problematic code. a.h: #include <string> #include <vector> std::vector<std::string> foo(); a.cpp #include "a.h" std::vector<std::string> foo() { std::vector<std::string> v; return v; } and finally main.cpp: #include "a.h" #include <iostream> int main() { std::vector<std::string> s = foo(); return 0; } Compilation as following (main.cpp is compiled with STL debugging flag): g++ -c a.cpp g++ -D_GLIBCXX_DEBUG main.cpp a.o When running a.out,

Linked cannot find symbols, but libraries are read and symbols exist

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-01 09:47:21
问题 I've been trying to compile my project and I'm getting undefined reference errors. eg.: installertest.cpp:(.text+0x9d1): undefined reference to `XmlRpcValue::makeArray()' ... installertest.cpp:(.text+0xede): undefined reference to `dbcancel' installertest.cpp:(.text+0xefd): undefined reference to `dbfcmd' installertest.cpp:(.text+0xf0f): undefined reference to `dbsqlexec' installertest.cpp:(.text+0xf2d): undefined reference to `SHA1_Init' ... My command-line is: g++ -o installertest \ -lsybdb

g++ including boost library

五迷三道 提交于 2020-01-01 09:38:08
问题 i builded my boost library with bjam, and then moved all the .a files into c:\Server\libs\boost_1_46_0\lib if i want to compile my program there is some error: the compile command g++ -Ic:\Server\libs\boost_1_46_0\ -Lc:\Server\libs\boost_1_46_0\lib\ -lboost_thread-mgw45-mt-1_46 -o try1 try1.cpp the errors C:\Users\FEHERG~1\AppData\Local\Temp\ccB46To7.o:try1.cpp:(.text+0xe9): undefined reference to `_imp___ZN5boost6thread4joinEv' C:\Users\FEHERG~1\AppData\Local\Temp\ccB46To7.o:try1.cpp:(.text