-1

I have C:\MinGW and C:\wxWidgets. My wxWidgets is nicely installed and built. Im trying to compile a "Hello World" program in notepad using Command Line Prompt.

I can compile this main.cpp just fine:

#include <iostream>
using namespace std;
int main() {
    cout << "Hello World" << endl;
    return 0;
}

with: g++ -std=c++11 main.cpp

When I try to compile a wxWidgets simple line like this:

#include <wx/wx.h>

g++ main.cpp

I get errors (wx/wx.h doesn't exist)

What is the syntax to compile the program using the command line?

I have tried g++ -std=c++11 -Ic:/wxWidgets/include main.cpp

and I still get errors. I am missing a lot of things. I have to compile with command line and without an IDE.

Also, any explaination about -I or about what is linking / how to link, would be appreciated. I am new to C++

marirena
  • 300
  • 2
  • 10
  • what about a nice IDE? – Miki Jul 09 '15 at 19:02
  • I must not use IDE. It's about a homework – marirena Jul 09 '15 at 19:07
  • @marirena May be use a Makefile additionally then, or at least a shell script: [Here](http://stackoverflow.com/questions/26026331/what-is-the-purpose-of-creating-object-files-separately-and-then-linking-them-to) are some hints what to do. If that's a homework task, you already should have found some explanations how to correctly link additional libraries in your text book. Also have a look [here](http://stackoverflow.com/questions/12573816/what-is-an-undefined-reference-unresolved-external-symbol-error-and-how-do-i-fix), how to resolve linker errors in general. – πάντα ῥεῖ Jul 09 '15 at 19:08

1 Answers1

0

Even, or maybe especially, if you're new to something, reading the documentation is strongly recommended.

VZ.
  • 21,740
  • 3
  • 39
  • 42