I created a new c++-project in Eclipse.
This is the code:
#include <argp.h>
#include <iostream>
using namespace std;
int main() {
// ...
return 0;
}
However I get the following compiler-error:
fatal error: argp.h: No such file or directory
Is argp.h part of the compiler? I´m using MinGW-GCC-toolchain in Eclipse.
Related
I'm ntrying to use json parser from "nlohmann" v3.11.2,
I'm following the docs so I have coped the `single_include/nlohmann/* in my include/nlohmann folder
#include "nlohmann\json.hpp"
//...
//this throws a "intellisense" error: => nlohmann has no member json
using json=nlohmann::json;
int main (void){
read_json();
}
void read_json(){
//
}
I'm on VS15 on Win10, building 64bit
#include "nlohmann\json.hpp" should be #include <nlohmann/json.hpp>
I download SFML 2.5.1, I put it in same folder as my code. But not working!
My code:
#include <SFML/Graphics.hpp>
using namespace std;
int main() {
return 0;
}
It's return an error:
sfml.cpp:1:29: fatal error: SFML/Graphics.hpp: No such file or directory
#include <SFML/Graphics.hpp>
^
compilation terminated.
I also try <path/to/SMFL/...> but not working too
Please help me
#include <iostream>
#include <opencv2/opencv.hpp>
#include <string>
#include <tesseract/baseapi.h>
using namespace std;
using namespace cv;
int main() {
string text;
Mat im;
tesseract::TessBaseAPI* ocr = new tesseract::TessBaseAPI();
return 0;
}
This gives me the error unresolved external symbol in TessBaseAPI. My tesseract should be properly downloaded, in command prompt, "tesseract --version" says I'm using version 5.0, its added to my path. I also tried following this https://github.com/vtempest/tesseract-ocr-sample which didn't work and gave me the linker error.
I have the following code:
#include <string>
#include <iostream>
using namespace std;
int main()
{
string myString = "This is a string";
return 0;
}
When I compile it with g++ I get the following error:
The procedure entry point
_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC1EPKcRKS3_ could not be located in the dynamic link library cygstdc++-6.dll.
I've tried re-installing cygwin but that didn't fix anything, does anyone have any ideas?
I'm trying to create a c++ library for the purpose of controlling a signal generator. I have a working script that compiles into an executable that runs the way I want, and now I want to create a static library with a 'signal' class such that the code can be integrated into a larger library being created by the research collaboration I'm part of for all the hardware we have. However, I'm having trouble compiling a test program (test.cc) for the signal.cpp source code and signal.h that I've written.
Here's signal.cpp:
#include "signal.h"
#include <iostream>
#include <fstream>
#include <string.h>
using namespace std;
signal::signal(){
myfile.open("/dev/usbtmc1");
}
signal::~signal(){
myfile.close();
}
int signal::on(){
myfile<<"*RST\n";
myfile<<":DISPLAY OFF\n";
myfile<<"FUNC1:PULS:HOLD WIDT\n";
myfile<<"FUNC1:PULS:TRAN:LEAD 2.5NS\n";
myfile<<"FUNC1:PULS:TRAN:TRA 2.5NS\n";
myfile<<":FUNC1:PULS:WIDT 20NS\n";
myfile<<":FUNC1 PULS\n";
myfile<<":VOLT1 5.0V\n";
myfile<<":VOLT1:OFFS 1.797V\n";
myfile<<":FREQ1 100HZ\n";
myfile<<":OUTP1:IMP:EXT MAX\n";
myfile<<":ARM:SOUR1 IMM|INT\n";
myfile<<":OUTP1 ON\n";
myfile<<":OUTP1:COMP ON\n";
return 0;
}
int signal::off(){;
myfile<<"*RST\n";
return 0;
}
int signal::write(char comstring[80]){
strcat(comstring,"\n");
myfile<<comstring;
return 0;
}
Here's signal.h:
#ifndef SIGNAL_H
#define SIGNAL_H
#include <iostream>
#include <fstream>
#include <string.h>
//using namespace std;
class signal{
private:
std::ofstream myfile;
public:
signal();
~signal();
int on();
int off();
int write(char comstring[80]);
};
#endif
And the little test program I've written to try out calling the signal class:
#include "signal.h"
using namespace std;
int main(){
signal ser;
ser.on();
}
I can get the signal.cpp and the signal.h files to compile into a signal.so dynamic object, but when I try to call 'g++ test.cc -o test -l signal.h' at the terminal, I get the error:
signal.h:4:20: error: iostream: No such file or directory
signal.h:5:19: error: fstream: No such file or directory
signal.h:9: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘signal’
I'm confused by this, as I thought iostream and fstream were part of the c++ standard library and therefore wouldn't need to be linked when compiling using g++. Could anyone please illuminate me as to what I should fix or try to sort this? Many thanks. Sam.
Hoping your all files are in same folder.
g++ -I . test.cpp signal.cpp -o test