Help using MinGW to compile a SFML project.

I'm trying to call g++.exe from MinGW to compile a SFML project, but I'm having problems with the linker. I'm not using an IDE, just Notepad++ and and .exe (so I can use my flash drive for programming)... I can compile a normal .cpp project, and it turns into a perfect running application, so I know that part works. I'll show you how I'm doing this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include<stdlib.h>
#include<iostream>
#include<string>
using namespace std;

int main()
{
	while (1)
	{
		string MakeFrom;
		string MakeTo;
		char input;
		string linkers;
		string Final = "MinGW\\bin\\g++ -o ";
		string exit;
		
		cout<<"What program would you like to compile?"<<endl;
		getline(cin, MakeFrom);
		cout<<"What file would you like create?"<<endl;
		getline(cin, MakeTo);
		
		Final += MakeTo + " " + MakeFrom;
		
		cout<<"Any linkers? (Y/N)"<<endl;
		cin>>input;
		if (input == 'Y' || input == 'y')
		{
			cout<<"What linkers?"<<endl;
			cin.clear();
			cin.ignore();
			getline(cin, linkers);
			Final += " -l " + linkers;
		}
	
		system(Final.c_str());
		
		cout<<"Will that be all?"<<endl;
		cin>>exit;
		if (exit == "Yes" || exit == "yes" || exit == "YEs" || exit == "YES")
		{
			return 0;
		}
	}
	return 0;
}


The error it gives me is as follows:
g++: libsfml-system.a: No such file or directory

However, libsfml-system.a is in the lib\ folder of MinGW, where I was told to put it. How do I fix this?? Thank you for any help you can give!

- Kyle

EDIT: I added the -l in front of the linker.
Last edited on
"*.a" ???
Library file?
(I doubt, so ignore it)
Does your workspace support library files? If so, just add it into the library list. If not, then I don't know, because I'm using VS2005, sorry
Um... Sorry, but I have no clue what you mean by
Does your workspace support library files?


- Kyle
This means : "Support a custom library list or not?" (Load additional library files from files (specific addresses))

I'm not sure "*.a" is library files or not, and if my ans is wrong, you may ignore.
In that case, yes it should. SHOULD. As in, when I compile the program using Code::Blocks it works fine. I just want to compile from my program.

- Kyle
Last edited on
g++: libsfml-system.a: No such file or directory

This looks like you're feeding it the name libsfml-system. Unless you've changed the names of the libraries it should be sfml-system for the release version or sfml-system-d for the debug version.


However, libsfml-system.a is in the lib\ folder of MinGW, where I was told to put it.

Who told you to put it there?
Um... Nope. They all have libsfml- in front of them, I didn't rename them either. I was told to put them there at the SFML website. Right at the top under "Copy the SFML development files to your Code::Blocks installation directory": http://www.sfml-dev.org/tutorials/1.6/start-cb.php. Am I being completely retarded and linking to the *.a's and I'm suppose to be linking to the *.dll's? Aaaaaaaaaaaaaaaaaaaaand, yes. I just tried that out... I'm glad to know I coded the compiler correctly though! I did however had to add a -l in front of sfml-system.dll. Thank you for helping.

- Kyle
Topic archived. No new replies allowed.