Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
Im a beginner level Java coder and I decided to get into C++ coding. After reading the basics (similar enought to Java) decided to try the apoach of reading other peoples code.
I found the following code of an imap mail client, but when triing to compile it with g++ (gcc 4.6.3) it shows some errors that seem to have something to do with the scope of the used namespaces.
Where is the error here or what kind of error should i be 'googling' for?, 'cause I couldn find the answer there.
Here's a link to the code, 'cause Im not sure about licensing issues (like if I should be citing the author):
imap_email_client
Thanks in advance for all your help and sorry for all the forum rules missconceptions i could have commited.
The code you referenced isn't any C++ code, but code written in a language called C#.
On the other hand g++ is just a C++ compiler. Meaning it doesn't know any C# and it will not compile any C# code.
You'll need a C# compiler instead to compile the code you referenced. As Mono (see: http://www.mono-project.com/Main_Page) comes along with a C# compiler gmcs you might want to try if you're able to compile with
gmcs name-of-your-source-file
if it is installed on your system.
On my system I was able to compile the referenced sources with it.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I'm playing with compiling C++ from native Windows CMD via VS 2017 compiler (vsvarsall.bat setup).
Is there any way to reduce the output of cl command, like Microsoft rigths for compiler and linker?
Also, offtop question: is it possible to compile code with UNICODE or ANSI strings (like I'm able to build from Visual Studio IDE), or am I gotta use manual #defines?
For your first question, see the /nologo compiler flag.
I'd guess the second is why people are voting to close--there's quite a variety of ways to deal with ANSI/Unicode strings, and without quite a bit more definition of what you really want, chances are pretty poor that anybody can give a meaningful answer.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
I have a project which I would like to code on both an Ubuntu and a Windows machine. On Ubuntu I'm using gcc, and on windows I would like to use MSVC.
Is it a good idea to compile the same code with 2 different compilers like this? Or would I run into issues down the road?
Thanks.
It is an excellent idea. In the past, I've found a bunch of bugs in my code that I could only see after switching compilers.
If you want to compile for different platforms, you have to compile with different compilers (even if they are different versions of the same compiler).
If you compile with both GCC and MSVC, you will find you can't use a lot of the extensions that each compiler provides. You will also find annoyances like MSVC puts an underscore on the front of functions like _open. Basically, this comes down to "welcome to the wonderful world of portable coding".
On the other hand, once you start writing code for two compilers, it becomes much easier to add a third - and I would recommend adding Clang to the mix as a cheap and cheerful static analysis tool.
Microsoft is making it easy, by allowing you compile code directly from Visual Studio on a Linux box. It's pretty cool.
https://blogs.msdn.microsoft.com/vcblog/2016/03/30/visual-c-for-linux-development/
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
Let's say we've got a first program called Program1.exe which contains the necessary information to create and compile another application called Program2.exe. Actually it could also load that information from a txt file or whatever.
Googling, I've found that this is "easy" to do in C#, using Visual Studio:
How to programatically build and compile another c# project from the current project
Programmatically Invoke the C# Compiler
The problem is that I'm not using (and can't use) C#, but C++. Summing it up, my question is if that I can do this same thing using C++.
I would prefer to do it without additional libraries, but if that's not possible, or if it's too hard to do, you can also recommend any library allowing it.
I think you'll probably have noticed it, but my goal is to use it under Windows so I don't care if it's not portable.
Thanks everybody.
It's trivial (if maybe a bit odd) for a C++ program to compile and run another based on code stored in a text file. Debugging that other program, however, isn't.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I'm writing a basic command line operating system for the raspberry pi, much like those on computers from the 70's and early 80's. I have made the basic text input / output with assembly and would like to incorporate a BASIC interpreter into my code. I was thinking of writing my own version of BASIC and an interpreter in C++/Java (maybe not, since it's compiled into bytecode) then compiling it into ARM assembly for the raspberry pi, is this possible?
P.S I considered writing it in assembly, but figured that would be too complicated for my abilities.
Yes, it's possible since once you have a C++ compiler for your taget platform. You can use any language you want/need to, including Java since once all needed tools to compile/interpret are available in the target platform. You can do in assembly too. But do you really need/want to? it's really a lot of job without no much fun.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
Do you know a good, concise (not a book, possibly free documentation) reference that explains the basics of how a c++ compiler works? I think it'd be beneficial for better understanding some rules of c++ programming.
GCC Internals free ebook.
The purpose of this book is to address
the demands of GCC hackers. We start
with a description of GCC 3.4.1
architecture focusing on the source
code parser. We chose this version of
GCC because we used this version
mostly. Then we address the problem of
extension development. We present the
GCC Extensibility Modules (GEM)
project in the next chapter. GEM
provides a number of hooks throughout
GCC source code. It is implemented as
a patch to GCC. A GEM-based compiler
extension is developed as a
stand-alone program. When the
extension is completed, only its
source code is distributed compared
with distributing the source code of
the GCC if GEM is not used. We give
examples that demonstrate GEM
programming at the end of the book.
(EDIT: Sorry, I missed you don't want a book. But I still think this is great resource of information you are looking for. You certainly don't need to read it as a whole, you can go only through the sections you are interested in.)
I found this university site which explains the steps of the compilation process. It covers how to compile your code into an executable, a shared library, or a dynamically linked library using GCC. It also covers how the compiler knows where to look for header files and libraries, and other topics.