Trouble moving code from CodeBlocks to Eclipse [message #1821182] |
Thu, 06 February 2020 12:05  |
Eclipse User |
|
|
|
Im a newcomer to both eclipse and programming, as i've only recently started programing classes in school. Yesterday, i created this code in CodeBlocks, and it seems to be running fine, but after copying it to eclipse, the process stops with and error. For the input.in and output.out files, i went to new file and made them from there, which automatically added them to the source folder, or so it seems. I don't really understand why it would work in one IDE, but not the other.
(Also, other programs do work in Eclipse. I did set up the mingw, etc)
#include <iostream>
#include <fstream>
using namespace std;
long long v[1000000];
ifstream fin("input.in");
ofstream fout("output.out");
int main()
{
long long k, l=2, i=0, x;
long long s=0;
fin >> k;
k=(k*(k+1))/2;
while(i<k)
{
if(v[l]==0)
{
s=s+l;
for(long long j=2*l; j<1000000; j+=l)
{
v[j]=1;
}
i++;
}
l++;
}
fout << s;
return 0;
}
|
|
|
|
Re: Trouble moving code from CodeBlocks to Eclipse [message #1821626 is a reply to message #1821440] |
Mon, 17 February 2020 12:01  |
Eclipse User |
|
|
|
Not sure how you physically "..but after copying it to eclipse.." ,but do not like your comment about " copying to source " .
Prefer not to dwell on how you did it , here is my suggestion.
In Eclipse - create plain, default "Hello world" project of your choice.
Then copy contents of your main Qt file into Eclipse main file - just the contents.
Plain text to text copy.
Add / correct necessary #includes etc. , build the new project and watch for smoke.
|
|
|
Powered by
FUDForum. Page generated in 0.04777 seconds