|
Re: C++11 won't compile on Eclipse Mars [message #1719160 is a reply to message #1719060] |
Tue, 05 January 2016 17:06 |
David Vavra Messages: 1426 Registered: October 2012 |
Senior Member |
|
|
I get this only when the dialect is left untouched. Post the build log output of a compile. if it doesn't have the -std=c++11 or -std=c++0x flag then you didn't select it in the compiler dialog page.
Here's a small program:
#include <iostream>
using namespace std;
#include <string.h>
#include <gsl/gsl_matrix.h>
#include <gsl/gsl_multifit.h>
int main (void)
{
printf("Starting...\n");
fflush(stdout);
auto x = 7;
int i, j, nr = 5, nc = 3;
gsl_matrix * A = gsl_matrix_calloc (nr, nc);
return 0;
}
And here is the build log with C++11 was selected
Note that the compile command starts g++ -std=c++0x -O0 -g3 -Wall
make all
Building file: ../src/GSL_TEST.cpp
Invoking: GCC C++ Compiler
g++ -std=c++0x -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/GSL_TEST.d" -MT"src/GSL_TEST.o" -o "src/GSL_TEST.o" "../src/GSL_TEST.cpp"
../src/GSL_TEST.cpp: In function 'int main()':
../src/GSL_TEST.cpp:19:6: warning: unused variable 'x' [-Wunused-variable]
auto x = 7;
^
../src/GSL_TEST.cpp:20:5: warning: unused variable 'i' [-Wunused-variable]
int i, j, nr = 5, nc = 3;
^
../src/GSL_TEST.cpp:20:8: warning: unused variable 'j' [-Wunused-variable]
int i, j, nr = 5, nc = 3;
^
../src/GSL_TEST.cpp:21:14: warning: unused variable 'A' [-Wunused-variable]
gsl_matrix * A = gsl_matrix_calloc (nr, nc);
^
Finished building: ../src/GSL_TEST.cpp
Building target: GSL_TEST
Invoking: GCC C++ Linker
g++ -o "GSL_TEST" ./src/GSL_TEST.o -lgsl -lgslcblas -lm
Finished building target: GSL_TEST
|
|
|
Re: C++11 won't compile on Eclipse Mars [message #1719250 is a reply to message #1719160] |
Wed, 06 January 2016 15:36 |
Stephen Dolley Messages: 3 Registered: January 2016 |
Junior Member |
|
|
OK. Somehow the dialect selection got set back. I've fixed that and now auto is OK, but unique_ptr gets underlined in red with "Symbol 'unique_ptr' could not be resolved", even though it compiles and runs OK. Here is my program:
#include <iostream>
#include <memory>
using namespace std;
int main() {
auto i = 6;
unique_ptr<int> heapInt(new int{7});
cout << "!!!Hello World!!! Int is " << i << " HeapInt:" << *heapInt << endl;
return 0;
}
Here is my build log.
Info: Internal Builder is used for build
g++ -std=c++0x -O0 -g3 -Wall -c -fmessage-length=0 -o "src\\TestC++11.o" "..\\src\\TestC++11.cpp"
g++ -o TestC++11.exe "src\\TestC++11.o"
[Updated on: Wed, 06 January 2016 15:50] Report message to a moderator
|
|
|
Re: C++11 won't compile on Eclipse Mars [message #1726356 is a reply to message #1719250] |
Fri, 11 March 2016 18:54 |
Hristian Temp Messages: 3 Registered: March 2016 |
Junior Member |
|
|
===== UPDATE HEADING ======
Solution to the problem "Symbol 'cout' could not be resolved"
Unlike in Java or Python, etc., in C++ one does not select "File/New/C++ project", but "File/New/Project". And then from the newly open window, expand the "C/C++ option" and select "C++ Project".
Personally, I find this totally NOT normal, especially if one uses Eclipse for Python and Java.
Certainly, one has to follow the setup steps listed in Eclipse "C/C++ Development User Guide", "Before you begin" section. I accessed this from the Eclipse Workbench "C/C++ Development" link.
===== UPDATE ======
Hello.
I would very much appreciate if you post the solution, when you find one.
After searching on the Internet for quite a while, I did this:
- I just downloaded Eclipse for C++. I installed MinGW.
- I added this directory to the path.
- I added "-static-libgcc -static-libstdc++" to C++ Build/Settings/MinGW LIkner/Miscellaneous.
And I still get error, "Symbol 'cout' could not be resolved" when I create a new Hello project.
I find so laughable and totally ridiculous that one cannot even run a simple Hello project. I just wanted to see how C++ is and how it runs on Eclipse. And it turned into a total disaster that took my entire evening away while searching on the Internet. This really sucks from the perspective I am looking at it now. A product which cannot even create, build and run a "Hello World" project. The first in my life!!!
[Updated on: Fri, 11 March 2016 20:52] Report message to a moderator
|
|
|
|
Powered by
FUDForum. Page generated in 0.03211 seconds