Tag Info

New answers tagged

0

No, you can't do that. There's no gcc pragma for compile in this way. The most similar is the Microsoft Visual C++ #pragma comment(lib, …) or #pragma comment(linker, …) [1] [2] for noting that some libraries should be included in the link procedure. Hi, GCC. How are you doing? In case you forgot, this source file you're looking at right now is written ...


0

You could decide that all your things are plugins. Then compile them with gcc -shared -fPIC -O thing1.cc -o thing1.so and have a main stub program doing dlopen(3) on ./thing1.so then dlsym on God; on Linux you could have binfmt_misc tricks to make that more transparent. If you insist on having self-containing programs, notice that GCC has the ...


1

gcc will compile C and C and C++ as C++ simply as a result of you naming the files appropriately, the preprocessor doesn't come into that. You'll need extern "C" blocks around your C declarations in your C++ files to make sure the linker can link stuff correctly, though. But what you're describing is almost never going to be helpful. If you're using a ...


4

The main entry point is God. Be it a C or C++ source file, it is the center of the application. Only in the same way that nitrogen is the center of a pine tree. It is where everything starts, but there's nothing about C or C++ that makes you put the "center" of your application in main(). A great many C and C++ programs are built on an event loop or an ...


0

You could simply copy the headers provided in your /usr/include path. No? Obviously don't forget to link the library when you compile your sources. I tried and it works like a charm!


2

What exact command do you use to build executable of your program? You need to tell g++ about additional directories with project-specific headers and libraries. If you have libcurlcpp.a copied into $proj_home/lib and libcurlcpp.h copied into $proj_home/hdr this will be something like: $ g++ your_program.cpp -Ihdr -Llib -lcurlcpp -static -o ...



Top 50 recent answers are included